FrontUserMapper.xml
23.2 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<?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.frontUser.mapper.FrontUserMapper">
<resultMap type="FrontUser" id="FrontUserResult">
<result property="id" column="id" />
<result property="orgId" column="org_id" />
<result property="parentOrgName" column="parent_org_name" />
<result property="userName" column="userName" />
<result property="loginName" column="loginName" />
<result property="password" column="password" />
<result property="mail" column="mail" />
<result property="phone" column="phone" />
<result property="userType" column="userType" />
<result property="parentId" column="parentId" />
<result property="deleteStatus" column="deleteStatus" />
<result property="dataStatus" column="dataStatus" />
<result property="upNum" column="upNum" />
<result property="nowNum" column="nowNum" />
<result property="contractMoney" column="contractMoney" />
<result property="storageTime" column="storageTime" />
<result property="lastUpdataTime" column="lastUpdataTime" />
<result property="operator" column="operator" />
<result property="signingTime" column="signingTime" />
<result property="endTime" column="endTime" />
<result property="creditTime" column="creditTime" />
<result property="updateTime" column="updateTime" />
<result property="orderNo" column="orderNo" />
<result property="ramark" column="ramark" />
<result property="needaudit" column="needaudit" />
<result property="auditDs" column="auditDs" />
<result property="modifyPsdPage" column="modifyPsdPage" />
<result property="reportNum" column="reportNum" />
<result property="financeNum" column="financeNum" />
<result property="reports" column="reports" />
<result property="email" column="email" />
<result property="noticeEmail" column="noticeEmail" />
<result property="otherEmailInfo" column="otherEmailInfo" />
<result property="emailAttachment" column="emailAttachment" />
<result property="emailAttachmentInfo" column="emailAttachmentInfo" />
<result property="openId" column="open_id" />
<result property="deptName" column="dept_name" />
<association property="dept" column="dept_id" javaType="Dept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<sql id="selectFrontUserVo">
select id, org_id, parent_org_name,reportNum,financeNum ,reports,email,noticeEmail,otherEmailInfo,emailAttachmentInfo,emailAttachment,userName, loginName, password, mail, phone, userType, parentId, deleteStatus, dataStatus, upNum, nowNum, contractMoney, storageTime, lastUpdataTime, operator, signingTime, endTime, creditTime, updateTime, orderNo, ramark, needaudit, auditDs, modifyPsdPage,open_id from front_user
</sql>
<sql id="selectFrontUserVo1">
select f.id, f.org_id,d.dept_name, f.parent_org_name,f.reportNum,f.financeNum ,f.reports,f.email,f.noticeEmail,f.otherEmailInfo,f.emailAttachmentInfo,f.emailAttachment,f.userName, f.loginName, f.password, f.mail, f.phone, f.userType,f.parentId, f.deleteStatus, f.dataStatus, f.upNum, f.nowNum, f.contractMoney, f.storageTime, f.lastUpdataTime, f.operator, f.signingTime, f.endTime, f.creditTime, f.updateTime, f.orderNo, f.ramark, f.needaudit, f.auditDs, f.modifyPsdPage from front_user f,front_dept d
</sql>
<resultMap id="deptResult" type="Dept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="Role">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<select id="selectFrontUserList" parameterType="FrontUser" resultMap="FrontUserResult">
<include refid="selectFrontUserVo1"/>
<where>
f.org_id=d.id
<if test="id != null "> and f.id = #{id}</if>
<if test="orgId != null "> and f.org_id = #{orgId}</if>
<if test="parentOrgName != null and parentOrgName != '' "> and f.parent_org_name = #{parentOrgName}</if>
<if test="userName != null and userName != '' "> and f.userName like concat("%", #{userName},"%")</if>
<if test="loginName != null and loginName != '' "> and f.loginName like concat("%", #{loginName},"%")</if>
<if test="password != null and password != '' "> and f.password = #{password}</if>
<if test="mail != null and mail != '' "> and f.mail = #{mail}</if>
<if test="phone != null and phone != '' "> and f.phone = #{phone}</if>
<if test="userType != null and userType != '' "> and f.userType = #{userType}</if>
<if test="parentId != null and parentId != '' "> and f.parentId = #{parentId}</if>
<if test="deleteStatus != null and deleteStatus != '' "> and f.deleteStatus = #{deleteStatus}</if>
<if test="dataStatus != null and dataStatus != '' "> and f.dataStatus = #{dataStatus}</if>
<if test="upNum != null "> and f.upNum = #{upNum}</if>
<if test="nowNum != null "> and f.nowNum = #{nowNum}</if>
<if test="contractMoney != null "> and f.contractMoney = #{contractMoney}</if>
<if test="storageTime != null "> and f.storageTime = #{storageTime}</if>
<if test="lastUpdataTime != null "> and f.lastUpdataTime = #{lastUpdataTime}</if>
<if test="operator != null and operator != '' "> and f.operator = #{operator}</if>
<if test="signingTime != null "> and f.signingTime = #{signingTime}</if>
<if test="endTime != null "> and f.endTime = #{endTime}</if>
<if test="creditTime != null "> and f.creditTime = #{creditTime}</if>
<if test="updateTime != null "> and f.updateTime = #{updateTime}</if>
<if test="orderNo != null "> and f.orderNo = #{orderNo}</if>
<if test="ramark != null and ramark != '' "> and f.ramark = #{ramark}</if>
<if test="reportNum != null and reportNum != '' "> and f.reportNum = #{reportNum}</if>
<if test="financeNum != null and financeNum != '' "> and f.financeNum = #{financeNum}</if>
<if test="reports != null and reports != '' "> and f.reports = #{reports}</if>
<if test="email != null and email != '' "> and f.email = #{email}</if>
<if test="noticeEmail != null and noticeEmail != '' "> and f.noticeEmail = #{noticeEmail}</if>
<if test="otherEmailInfo != null and otherEmailInfo != '' "> and f.otherEmailInfo = #{otherEmailInfo}</if>
<if test="emailAttachment != null and emailAttachment != '' "> and f.emailAttachment = #{emailAttachment}</if>
<if test="emailAttachmentInfo != null and emailAttachmentInfo != '' "> and f.emailAttachmentInfo = #{emailAttachmentInfo}</if>
<if test="auditDs != null "> and f.auditDs = #{auditDs}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(f.creditTime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(f.creditTime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="modifyPsdPage != null "> and f.modifyPsdPage = #{modifyPsdPage}</if>
</where>
</select>
<select id="selectFrontUserByMonList" parameterType="FrontUser" resultMap="FrontUserResult">
select f.* from front_user f,monitor_info_new m
<where>
f.id=m.userId
<if test="deleteStatus != null and deleteStatus != '' "> and f.deleteStatus = #{deleteStatus}</if>
<if test="dataStatus != null and dataStatus != '' "> and f.dataStatus = #{dataStatus}</if>
</where>
</select>
<select id="getFrontUserById" parameterType="Long" resultMap="FrontUserResult">
<include refid="selectFrontUserVo"/>
<where>
id = #{id}
</where>
</select>
<select id="selectFrontUserById" parameterType="Long" resultMap="FrontUserResult">
SELECT u.id, u.org_id, u.loginname, u.username, u.mail, u.phone, u.password, u.dataStatus, u.deleteStatus, u.storageTime, u.ramark,
u.reportNum, u.financeNum, u.reports, u.email, u.upNum,u.noticeEmail,u.otherEmailInfo,u.emailAttachment,u.emailAttachmentInfo,
d.id, d.parent_id, d.dept_name, d.is_enable AS dept_status,
r.role_id, r.role_name, r.role_key, u.auditDs,u.modifyPsdPage ,r.role_sort, r.data_scope, r.status AS role_status, u.needaudit
FROM front_user u
LEFT JOIN front_dept d ON u.org_id = d.id
LEFT JOIN front_user_role ur ON u.id = ur.user_id
LEFT JOIN front_role r ON r.role_id = ur.role_id
where u.id = #{id}
</select>
<select id="selectFrontUserByUserName" parameterType="String" resultMap="FrontUserResult">
select * from front_user where userName=#{userName}
</select>
<select id="getFrontUserByOrgId" parameterType="Long" resultMap="FrontUserResult">
<include refid="selectFrontUserVo" />
<where>
<if test="orgId != null "> and org_id = #{orgId} and dataStatus = 0</if>
</where>
</select>
<insert id="insertFrontUser" parameterType="FrontUser" useGeneratedKeys="true" keyProperty="id">
insert into front_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgId != null ">org_id,</if>
<if test="parentOrgName != null and parentOrgName != '' ">parent_org_name,</if>
<if test="userName != null and userName != '' ">userName,</if>
<if test="loginName != null and loginName != '' ">loginName,</if>
<if test="password != null and password != '' ">password,</if>
<if test="mail != null and mail != '' ">mail,</if>
<if test="phone != null and phone != '' ">phone,</if>
<if test="userType != null and userType != '' ">userType,</if>
<if test="parentId != null and parentId != '' ">parentId,</if>
<if test="deleteStatus != null and deleteStatus != '' ">deleteStatus,</if>
<if test="dataStatus != null and dataStatus != '' ">dataStatus,</if>
<if test="upNum != null ">upNum,</if>
<if test="nowNum != null ">nowNum,</if>
<if test="contractMoney != null ">contractMoney,</if>
<if test="storageTime != null ">storageTime,</if>
<if test="lastUpdataTime != null ">lastUpdataTime,</if>
<if test="operator != null and operator != '' ">operator,</if>
<if test="signingTime != null ">signingTime,</if>
<if test="endTime != null ">endTime,</if>
<if test="creditTime != null ">creditTime,</if>
<if test="updateTime != null ">updateTime,</if>
<if test="orderNo != null ">orderNo,</if>
<if test="ramark != null and ramark != '' ">ramark,</if>
<if test="reportNum != null and reportNum != '' ">reportNum,</if>
<if test="financeNum != null and financeNum != '' ">financeNum,</if>
<if test="reports != null and reports != '' ">reports,</if>
<if test="email != null and email != '' ">email,</if>
<if test="noticeEmail != null and noticeEmail != '' ">noticeEmail,</if>
<if test="otherEmailInfo != null and otherEmailInfo != '' ">otherEmailInfo,</if>
<if test="emailAttachment != null and emailAttachment != '' ">emailAttachment,</if>
<if test="emailAttachmentInfo != null and emailAttachmentInfo != '' ">emailAttachmentInfo,</if>
<if test="needaudit != null and needaudit != '' ">needaudit,</if>
<if test="auditDs != null "> auditDs, </if>
<if test="modifyPsdPage != null "> modifyPsdPage, </if>
<if test="openId != null ">open_id, </if>
<if test="vxType != null ">vx_type, </if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgId != null ">#{orgId},</if>
<if test="parentOrgName != null and parentOrgName != '' ">#{parentOrgName},</if>
<if test="userName != null and userName != '' ">#{userName},</if>
<if test="loginName != null and loginName != '' ">#{loginName},</if>
<if test="password != null and password != '' ">#{password},</if>
<if test="mail != null and mail != '' ">#{mail},</if>
<if test="phone != null and phone != '' ">#{phone},</if>
<if test="userType != null and userType != '' ">#{userType},</if>
<if test="parentId != null and parentId != '' ">#{parentId},</if>
<if test="deleteStatus != null and deleteStatus != '' ">#{deleteStatus},</if>
<if test="dataStatus != null and dataStatus != '' ">#{dataStatus},</if>
<if test="upNum != null ">#{upNum},</if>
<if test="nowNum != null ">#{nowNum},</if>
<if test="contractMoney != null ">#{contractMoney},</if>
<if test="storageTime != null ">#{storageTime},</if>
<if test="lastUpdataTime != null ">#{lastUpdataTime},</if>
<if test="operator != null and operator != '' ">#{operator},</if>
<if test="signingTime != null ">#{signingTime},</if>
<if test="endTime != null ">#{endTime},</if>
<if test="creditTime != null ">#{creditTime},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="orderNo != null ">#{orderNo},</if>
<if test="ramark != null and ramark != '' ">#{ramark},</if>
<if test="reportNum != null and reportNum != '' ">#{reportNum},</if>
<if test="financeNum != null and financeNum != '' ">#{financeNum},</if>
<if test="reports != null and reports != '' ">#{reports},</if>
<if test="email != null and email != '' ">#{email},</if>
<if test="noticeEmail != null and noticeEmail != '' ">#{noticeEmail},</if>
<if test="otherEmailInfo != null and otherEmailInfo != '' ">#{otherEmailInfo},</if>
<if test="emailAttachment != null and emailAttachment != '' ">#{emailAttachment},</if>
<if test="emailAttachmentInfo != null and emailAttachmentInfo != '' ">#{emailAttachmentInfo},</if>
<if test="needaudit != null and needaudit != '' ">#{needaudit},</if>
<if test="auditDs != null ">auditDs,</if>
<if test="modifyPsdPage != null ">modifyPsdPage,</if>
<if test="auditDs != null ">#{auditDs},</if>
<if test="modifyPsdPage != null ">#{modifyPsdPage},</if>
<if test="openId != null ">#{openId},</if>
<if test="vxType != null ">#{vxType},</if>
</trim>
</insert>
<update id="updateFrontUser" parameterType="FrontUser">
update front_user
<trim prefix="SET" suffixOverrides=",">
<if test="orgId != null ">org_id = #{orgId},</if>
<if test="parentOrgName != null and parentOrgName != '' ">parent_org_name = #{parentOrgName},</if>
<if test="userName != null and userName != '' ">userName = #{userName},</if>
<if test="loginName != null and loginName != '' ">loginName = #{loginName},</if>
<if test="password != null and password != '' ">password = #{password},</if>
<if test="mail != null and mail != '' ">mail = #{mail},</if>
<if test="phone != null and phone != '' ">phone = #{phone},</if>
<if test="userType != null and userType != '' ">userType = #{userType},</if>
<if test="parentId != null and parentId != '' ">parentId = #{parentId},</if>
<if test="deleteStatus != null and deleteStatus != '' ">deleteStatus = #{deleteStatus},</if>
<if test="dataStatus != null and dataStatus != '' ">dataStatus = #{dataStatus},</if>
<if test="upNum != null ">upNum = #{upNum},</if>
<if test="nowNum != null ">nowNum = #{nowNum},</if>
<if test="contractMoney != null ">contractMoney = #{contractMoney},</if>
<if test="storageTime != null ">storageTime = #{storageTime},</if>
<if test="lastUpdataTime != null ">lastUpdataTime = #{lastUpdataTime},</if>
<if test="operator != null and operator != '' ">operator = #{operator},</if>
<if test="signingTime != null ">signingTime = #{signingTime},</if>
<if test="endTime != null ">endTime = #{endTime},</if>
<if test="creditTime != null ">creditTime = #{creditTime},</if>
<if test="updateTime != null ">updateTime = #{updateTime},</if>
<if test="orderNo != null ">orderNo = #{orderNo},</if>
<if test="ramark != null">ramark = #{ramark},</if>
<if test="reportNum != null and reportNum != '' ">reportNum = #{reportNum},</if>
<if test="financeNum != null and financeNum != '' ">financeNum = #{financeNum},</if>
<if test="reports != null and reports != '' ">reports = #{reports},</if>
<if test="email != null and email != '' ">email = #{email},</if>
<if test="noticeEmail != null ">noticeEmail = #{noticeEmail},</if>
<if test="otherEmailInfo != null ">otherEmailInfo = #{otherEmailInfo},</if>
<if test="emailAttachment != null and emailAttachment != '' ">emailAttachment = #{emailAttachment},</if>
<if test="emailAttachmentInfo != null and emailAttachmentInfo != '' ">emailAttachmentInfo = #{emailAttachmentInfo},</if>
<if test="needaudit != null and needaudit != '' ">needaudit = #{needaudit},</if>
<if test="auditDs != null ">auditDs = #{auditDs},</if>
<if test="modifyPsdPage != null ">modifyPsdPage = #{modifyPsdPage},</if>
<if test="email != null ">email = #{email},</if>
<if test="reportNum != null ">reportNum = #{reportNum},</if>
<if test="financeNum != null ">financeNum = #{financeNum},</if>
</trim>
where id = #{id}
</update>
<update id="updateUserOpenId">
update front_user set open_id = #{openId}, vx_type = 1 where id = #{id}
</update>
<delete id="deleteFrontUserById" parameterType="Integer">
delete from front_user where id = #{id}
</delete>
<delete id="deleteFrontUserByIds" parameterType="String">
delete from front_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByOpenId" parameterType="java.lang.String">
delete from front_user where open_id = #{openId} and vx_type = 2
</delete>
<select id="checkLoginNameUnique" parameterType="String" resultType="int">
select count(1) from front_user where loginName=#{loginName}
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="FrontUserResult">
select id, phone from front_user where phone=#{phonenumber}
</select>
<select id="findUserByLoginName" resultType="com.lhcredit.project.business.frontUser.domain.FrontUserMon">
SELECT
id,
org_id as orgId,
parent_org_name as parentOrgName,
userName as userName,
loginName as loginName,
`password`,
mail,
phone,
userType,
parentId,
deleteStatus,
dataStatus,
upNum,
nowNum,
contractMoney,
storageTime,
lastUpdataTime,
operator,
signingTime,
endTime,
creditTime,
needaudit,
modifyPsdPage,
reports
FROM
front_user where loginName = #{loginName} AND `password` = #{password}
</select>
<select id="selectFrontUserByPid" parameterType="FrontUser" resultMap="FrontUserResult">
SELECT f.*,d.dept_name FROM front_user f,`front_dept` d,(SELECT o.dept_id FROM front_user u LEFT JOIN `org_dept` o ON u.org_id=o.org_id WHERE u.id=#{id} ) AS dept
WHERE f.org_id=dept.dept_id AND d.id=f.org_id
<if test="deptName!=null and deptName!=''">
and d.`dept_name` like concat('%', #{deptName}, '%')
</if>
<if test="userName!=null and userName!=''">
and f.userName like concat('%', #{userName}, '%')
</if>
<if test="phone!=null and phone!=''">
and f.phone like concat('%', #{phone}, '%')
</if>
<if test="dataStatus!=null and dataStatus!=''">
and f.dataStatus=#{dataStatus}
</if>
<if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
AND date_format(f.creditTime,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
</if>
<if test="doneTime != null and doneTime != ''"><!-- 结束时间检索 -->
AND date_format(f.creditTime,'%y%m%d') <= date_format(#{doneTime},'%y%m%d')
</if>
</select>
<select id="selectFrontUserByOpenId" resultType="com.lhcredit.project.business.frontUser.domain.FrontUserMon"
parameterType="java.lang.String">
SELECT
id,
org_id as orgId,
parent_org_name as parentOrgName,
userName as userName,
loginName as loginName,
`password`,
mail,
phone,
userType,
parentId,
deleteStatus,
dataStatus,
upNum,
nowNum,
contractMoney,
storageTime,
lastUpdataTime,
operator,
signingTime,
endTime,
creditTime,
needaudit,
modifyPsdPage,
reports,
open_id as openId
FROM front_user where open_id = #{openid1} and vx_type = 1
</select>
<select id="selectFrontUserByOpenId1" parameterType="java.lang.String" resultType="com.lhcredit.project.business.frontUser.domain.FrontUserMon">
SELECT
id,
org_id as orgId,
parent_org_name as parentOrgName,
userName as userName,
loginName as loginName,
`password`,
mail,
phone,
userType,
parentId,
deleteStatus,
dataStatus,
upNum,
nowNum,
contractMoney,
storageTime,
lastUpdataTime,
operator,
signingTime,
endTime,
creditTime,
needaudit,
modifyPsdPage,
reports,
open_id as openId
FROM front_user where open_id = #{openid1}
</select>
</mapper>