CountryNameMapper.xml
2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lhcredit.project.business.country.mapper.CountryNameMapper">
<resultMap type="CountryName" id="CountryResult">
<result property="jc" column="jc" />
<result property="gj" column="gj" />
<result property="en" column="en" />
<result property="jcCode" column="jc_code" />
</resultMap>
<sql id="selectCountryVo">
select jc, gj, en,jc_code from country
</sql>
<select id="selectCountryList" parameterType="CountryName" resultMap="CountryResult">
<include refid="selectCountryVo"/>
<where>
<if test="jc != null and jc != '' "> and jc = #{jc}</if>
<if test="gj != null and gj != '' "> and gj = #{gj}</if>
<if test="en != null and en != '' "> and en = #{en}</if>
<if test="jcCode != null and jcCode != '' "> and jc_code = #{jcCode}</if>
</where>
</select>
<select id="selectCountryById" parameterType="String" resultMap="CountryResult">
<include refid="selectCountryVo"/>
where jc = #{jc}
</select>
<insert id="insertCountry" parameterType="CountryName">
insert into country
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jc != null and jc != '' ">jc,</if>
<if test="gj != null and gj != '' ">gj,</if>
<if test="en != null and en != '' ">en,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jc != null and jc != '' ">#{jc},</if>
<if test="gj != null and gj != '' ">#{gj},</if>
<if test="en != null and en != '' ">#{en},</if>
</trim>
</insert>
<update id="updateCountry" parameterType="CountryName">
update country
<trim prefix="SET" suffixOverrides=",">
<if test="gj != null and gj != '' ">gj = #{gj},</if>
<if test="en != null and en != '' ">en = #{en},</if>
</trim>
where jc = #{jc}
</update>
<delete id="deleteCountryById" parameterType="String">
delete from country where jc = #{jc}
</delete>
<delete id="deleteCountryByIds" parameterType="String">
delete from country where jc in
<foreach item="jc" collection="array" open="(" separator="," close=")">
#{jc}
</foreach>
</delete>
</mapper>