DriverMapper.xml
8.73 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?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.ruoyi.driver.mapper.DriverMapper">
<resultMap type="Driver" id="DriverResult">
<result property="id" column="id"/>
<result property="jobCode" column="jobCode"/>
<result property="companyCode" column="companyCode"/>
<result property="brancheCompanyCode" column="brancheCompanyCode"/>
<result property="personnelName" column="personnelName"/>
<result property="papersCode" column="papersCode"/>
<result property="icCardCode" column="icCardCode"/>
<result property="personnelType" column="personnelType"/>
<result property="posts" column="posts"/>
<result property="card" column="card"/>
<result property="telphone" column="telphone"/>
<result property="icRfid" column="icRfid"/>
<result property="idRfid" column="idRfid"/>
<result property="tagRfid" column="tagRfid"/>
<result property="remark" column="remark"/>
<result property="lineName" column="lineName"/>
<result property="lineCode" column="lineCode"/>
</resultMap>
<sql id="selectDriverVo">
select id,
jobCode,
companyCode,
brancheCompanyCode,
personnelName,
papersCode,
icCardCode,
personnelType,
posts,
card,
telphone,
icRfid,
idRfid,
tagRfid,
remark,
lineName,
lineCode
from driver
</sql>
<select id="selectDriverList" parameterType="Driver" resultMap="DriverResult">
<include refid="selectDriverVo"/>
<where>
<if test="jobCode != null and jobCode != ''">and jobCode = #{jobCode}</if>
<if test="companyCode != null and companyCode != ''">and companyCode = #{companyCode}</if>
<if test="brancheCompanyCode != null and brancheCompanyCode != ''">and brancheCompanyCode =
#{brancheCompanyCode}
</if>
<if test="personnelName != null and personnelName != ''">and personnelName like concat('%',
#{personnelName}, '%')
</if>
<if test="papersCode != null and papersCode != ''">and papersCode = #{papersCode}</if>
<if test="icCardCode != null and icCardCode != ''">and icCardCode = #{icCardCode}</if>
<if test="personnelType != null and personnelType != ''">and personnelType = #{personnelType}</if>
<if test="posts != null and posts != ''">and posts = #{posts}</if>
<if test="card != null and card != ''">and card = #{card}</if>
<if test="telphone != null and telphone != ''">and telphone = #{telphone}</if>
<if test="icRfid != null and icRfid != ''">and icRfid = #{icRfid}</if>
<if test="idRfid != null and idRfid != ''">and idRfid = #{idRfid}</if>
<if test="tagRfid != null and tagRfid != ''">and tagRfid = #{tagRfid}</if>
<if test="lineName != null and lineName != ''">and lineName like concat('%', #{lineName}, '%')</if>
<if test="lineCode != null and lineCode != ''">and lineCode = #{lineCode}</if>
</where>
</select>
<select id="selectDriverById" parameterType="Long" resultMap="DriverResult">
<include refid="selectDriverVo"/>
where id = #{id}
</select>
<insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id">
insert into driver
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jobCode != null and jobCode != ''">jobCode,</if>
<if test="companyCode != null and companyCode != ''">companyCode,</if>
<if test="brancheCompanyCode != null">brancheCompanyCode,</if>
<if test="personnelName != null">personnelName,</if>
<if test="papersCode != null">papersCode,</if>
<if test="icCardCode != null">icCardCode,</if>
<if test="personnelType != null">personnelType,</if>
<if test="posts != null">posts,</if>
<if test="card != null">card,</if>
<if test="telphone != null">telphone,</if>
<if test="icRfid != null">icRfid,</if>
<if test="idRfid != null">idRfid,</if>
<if test="tagRfid != null">tagRfid,</if>
<if test="remark != null">remark,</if>
<if test="lineName != null">lineName,</if>
<if test="lineCode != null">lineCode,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jobCode != null and jobCode != ''">#{jobCode},</if>
<if test="companyCode != null and companyCode != ''">#{companyCode},</if>
<if test="brancheCompanyCode != null">#{brancheCompanyCode},</if>
<if test="personnelName != null">#{personnelName},</if>
<if test="papersCode != null">#{papersCode},</if>
<if test="icCardCode != null">#{icCardCode},</if>
<if test="personnelType != null">#{personnelType},</if>
<if test="posts != null">#{posts},</if>
<if test="card != null">#{card},</if>
<if test="telphone != null">#{telphone},</if>
<if test="icRfid != null">#{icRfid},</if>
<if test="idRfid != null">#{idRfid},</if>
<if test="tagRfid != null">#{tagRfid},</if>
<if test="remark != null">#{remark},</if>
<if test="lineName != null">#{lineName},</if>
<if test="lineCode != null">#{lineCode},</if>
</trim>
</insert>
<insert id="saveDrivers">
INSERT INTO driver (
jobCode,
companyCode,
brancheCompanyCode,
personnelName,
papersCode,
icCardCode,
personnelType,
posts,
card,
telphone,
icRfid,
idRfid,
tagRfid,
remark,
lineName,
lineCode
)
VALUES
<foreach collection="drivers" item="item" index="index" separator=",">
(
#{item.jobCode,jdbcType=VARCHAR},
#{item.companyCode,jdbcType=VARCHAR},
#{item.brancheCompanyCode,jdbcType=VARCHAR},
#{item.personnelName,jdbcType=VARCHAR},
#{item.papersCode,jdbcType=VARCHAR},
#{item.icCardCode,jdbcType=VARCHAR},
#{item.personnelType,jdbcType=VARCHAR},
#{item.posts,jdbcType=VARCHAR},
#{item.card,jdbcType=VARCHAR},
#{item.telphone,jdbcType=VARCHAR},
#{item.icRfid,jdbcType=VARCHAR},
#{item.idRfid,jdbcType=VARCHAR},
#{item.tagRfid,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR},
#{item.lineName,jdbcType=VARCHAR},
#{item.lineCode,jdbcType=VARCHAR}
)
</foreach>
on duplicate key update
personnelName = values(personnelName)
</insert>
<update id="updateDriver" parameterType="Driver">
update driver
<trim prefix="SET" suffixOverrides=",">
<if test="jobCode != null and jobCode != ''">jobCode = #{jobCode},</if>
<if test="companyCode != null and companyCode != ''">companyCode = #{companyCode},</if>
<if test="brancheCompanyCode != null">brancheCompanyCode = #{brancheCompanyCode},</if>
<if test="personnelName != null">personnelName = #{personnelName},</if>
<if test="papersCode != null">papersCode = #{papersCode},</if>
<if test="icCardCode != null">icCardCode = #{icCardCode},</if>
<if test="personnelType != null">personnelType = #{personnelType},</if>
<if test="posts != null">posts = #{posts},</if>
<if test="card != null">card = #{card},</if>
<if test="telphone != null">telphone = #{telphone},</if>
<if test="icRfid != null">icRfid = #{icRfid},</if>
<if test="idRfid != null">idRfid = #{idRfid},</if>
<if test="tagRfid != null">tagRfid = #{tagRfid},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="lineName != null">lineName = #{lineName},</if>
<if test="lineCode != null">lineCode = #{lineCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDriverById" parameterType="Long">
delete
from driver
where id = #{id}
</delete>
<delete id="deleteDriverByIds" parameterType="String">
delete from driver where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>