6ed23464a102fb659d1be708201bff77a8442708.svn-base
5.54 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?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.phxl.modules.goods.dao.ctdept.HisCtDeptDao">
<!--BaseResultMap -->
<resultMap id="BaseResultMap"
type="com.phxl.modules.goods.entity.ctdept.HisCtDept">
<id column="id" property="id" jdbcType="BIGINT" />
<result column="hdept_code" property="hdeptCode" jdbcType="VARCHAR" />
<result column="hdept_name" property="hdeptName" jdbcType="VARCHAR" />
<result column="help_code" property="helpCode" jdbcType="VARCHAR" />
<result column="upper_GUID" property="upperGUID" jdbcType="VARCHAR" />
<result column="is_order_right" property="isOrderRight" jdbcType="VARCHAR" />
<result column="category" property="category" jdbcType="VARCHAR" />
<result column="director" property="director" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="VARCHAR" />
<result column="is_last_level" property="isLastLevel" jdbcType="VARCHAR" />
<result column="create_time" property="create_time" jdbcType="TIMESTAMP" />
<result column="update_time" property="update_time" jdbcType="TIMESTAMP" />
</resultMap>
<!--Base_Column_List -->
<sql id="Base_Column_List">id,hdept_code,hdept_name,help_code,upper_GUID,is_order_right,category,director,state,is_last_level,create_time,update_time</sql>
<!-- 批量查询 -->
<select id="batchSelect" resultMap="BaseResultMap" parameterType="java.util.HashMap">
select
<include refid="Base_Column_List" />
from med_hli_dept
<if test="ctcpCodes != null">
where hdept_code in
<foreach item="item" index="index" collection="ctcpCodes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!--批量插入 -->
<insert id="batchInsert" parameterType="list">
insert into med_hli_dept (id,hdept_code,hdept_name,help_code,upper_GUID,is_order_right,category,director,state,is_last_level,create_time,update_time)
values
<foreach collection ="list" item="obj" separator =",">
<trim prefix=" (" suffix=")" suffixOverrides=",">
#{obj.id},
#{obj.hdeptCode},
#{obj.hdeptName},
#{obj.helpCode},
#{obj.upperGUID},
#{obj.isOrderRight},
#{obj.category},
#{obj.director},
#{obj.state},
#{obj.isLastLevel},
#{obj.create_time},
#{obj.update_time}
</trim>
</foreach>
</insert>
<update id="batchUpdate" parameterType="list">
update med_hli_dept
<trim prefix="set" suffixOverrides=",">
<trim prefix="hdept_code=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.hdeptCode != null and obj.hdeptCode != ''">
when id = #{obj.id}
then #{obj.hdeptCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="hdept_name=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.hdeptName != null and obj.hdeptName != ''">
when id = #{obj.id}
then
#{obj.hdeptName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="help_code=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.helpCode != null and obj.helpCode != ''">
when id = #{obj.id}
then #{obj.helpCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="upper_GUID=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.upperGUID != null and obj.upperGUID != ''">
when id = #{obj.id}
then #{obj.upperGUID,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="is_order_right=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.isOrderRight != null and obj.isOrderRight != ''">
when id = #{obj.id}
then #{obj.isOrderRight,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="category=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.category != null and obj.category != ''">
when id = #{obj.id}
then #{obj.category,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="director=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.director != null and obj.director != ''">
when id = #{obj.id}
then #{obj.director,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="state=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.state != null and obj.state != ''">
when id = #{obj.id}
then #{obj.state,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="is_last_level=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.isLastLevel != null and obj.isLastLevel != ''">
when id = #{obj.id}
then #{obj.isLastLevel,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="create_time=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.create_time != null">
when id = #{obj.id}
then #{obj.create_time,jdbcType=DATE}
</if>
</foreach>
</trim>
<trim prefix="update_time=case" suffix="end,">
<foreach collection="list" item="obj" index="index">
<if test="obj.update_time != null">
when id = #{obj.id}
then #{obj.update_time,jdbcType=DATE}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="obj" index="index">
id
= #{obj.id}
</foreach>
</update>
</mapper>