AdministrationAreaMapper.xml
4.55 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?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.Administration.mapper.AdministrationAreaMapper">
<resultMap type="AdministrationArea" id="AdministrationAreaResult">
<result property="id" column="id" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="areaAbbreviation" column="area_abbreviation" />
<result property="rank" column="rank" />
<result property="postcode" column="postcode" />
<result property="areaMark" column="area_mark" />
</resultMap>
<sql id="selectAdministrationAreaVo">
select id, area_code, area_name, area_abbreviation, rank, postcode, area_mark from administration_area
</sql>
<select id="selectAdministrationAreaList" parameterType="AdministrationArea" resultMap="AdministrationAreaResult">
<include refid="selectAdministrationAreaVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="areaCode != null and areaCode != '' "> and area_code = #{areaCode}</if>
<if test="areaName != null and areaName != '' "> and area_name = #{areaName}</if>
<if test="areaAbbreviation != null and areaAbbreviation != '' "> and area_abbreviation = #{areaAbbreviation}</if>
<if test="rank != null and rank != '' "> and rank = #{rank}</if>
<if test="postcode != null and postcode != '' "> and postcode = #{postcode}</if>
<if test="areaMark != null and areaMark != '' "> and area_mark = #{areaMark}</if>
</where>
</select>
<select id="selectAdministrationAreaById" parameterType="Long" resultMap="AdministrationAreaResult">
<include refid="selectAdministrationAreaVo"/>
where id = #{id}
</select>
<insert id="insertAdministrationArea" parameterType="AdministrationArea" useGeneratedKeys="true" keyProperty="id">
insert into administration_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != '' ">area_code,</if>
<if test="areaName != null and areaName != '' ">area_name,</if>
<if test="areaAbbreviation != null and areaAbbreviation != '' ">area_abbreviation,</if>
<if test="rank != null and rank != '' ">rank,</if>
<if test="postcode != null and postcode != '' ">postcode,</if>
<if test="areaMark != null and areaMark != '' ">area_mark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != '' ">#{areaCode},</if>
<if test="areaName != null and areaName != '' ">#{areaName},</if>
<if test="areaAbbreviation != null and areaAbbreviation != '' ">#{areaAbbreviation},</if>
<if test="rank != null and rank != '' ">#{rank},</if>
<if test="postcode != null and postcode != '' ">#{postcode},</if>
<if test="areaMark != null and areaMark != '' ">#{areaMark},</if>
</trim>
</insert>
<update id="updateAdministrationArea" parameterType="AdministrationArea">
update administration_area
<trim prefix="SET" suffixOverrides=",">
<if test="areaCode != null and areaCode != '' ">area_code = #{areaCode},</if>
<if test="areaName != null and areaName != '' ">area_name = #{areaName},</if>
<if test="areaAbbreviation != null and areaAbbreviation != '' ">area_abbreviation = #{areaAbbreviation},</if>
<if test="rank != null and rank != '' ">rank = #{rank},</if>
<if test="postcode != null and postcode != '' ">postcode = #{postcode},</if>
<if test="areaMark != null and areaMark != '' ">area_mark = #{areaMark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAdministrationAreaById" parameterType="Long">
delete from administration_area where id = #{id}
</delete>
<delete id="deleteAdministrationAreaByIds" parameterType="String">
delete from administration_area where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="queryByAreaCode" resultType="com.lhcredit.project.business.Administration.domain.AdministrationArea" resultMap="AdministrationAreaResult">
<include refid="selectAdministrationAreaVo"/>
where area_code = #{newareaCode}
</select>
</mapper>