EmployeeMapper.xml
6.66 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
<?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="cn.com.glsx.dj.system.mapper.EmployeeMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.system.model.Employee" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="employee_id" property="employeeId" jdbcType="INTEGER" />
<result column="account_name" property="accountName" jdbcType="VARCHAR" />
<result column="duty" property="duty" jdbcType="VARCHAR" />
<result column="account_group" property="accountGroup"/>
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="merchant_name" property="merchantName"/>
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="is_open_card" property="isOpenCard" jdbcType="BIT" />
<result column="photo" property="photo" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="wechat_num" property="wechatNum" jdbcType="VARCHAR" />
<result column="customer_num" property="customerNum"/>
<result column="customer_count" property="customerCount"/>
<result column="duty_conf_key" property="dutyConfKey"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.system.dto.EmployeeDTO" extends="BaseResultMap">
<result column="user_id" property="userId"/>
<result column="login_phone" property="loginPhone"/>
<result column="enabled_flag" property="enabledFlag"/>
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, employee_id, account_name, duty,account_group, merchant_id,merchant_name, name, is_open_card, photo, phone,
wechat_num,customer_num,customer_count,duty_conf_key, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="list" parameterType="cn.com.glsx.dj.system.dto.EmployeeDTO" resultMap="DTOResultMap">
select a.id, a.employee_id, a.account_name, a.duty,a.account_group, a.merchant_id,a.merchant_name, a.name, a.is_open_card, a.photo, a.phone,
a.wechat_num,a.customer_num,a.customer_count,a.duty_conf_key, a.created_date, a.updated_date, b.id user_id,b.phone login_phone,b.enabled_flag
from dj_system_employee a
left join dj_system_user b on b.employee_id=a.employee_id and b.deleted_flag='N'
<where>
a.deleted_flag = 'N'
<if test="id != null">
and a.id = #{id}
</if>
<if test="employeeId != null">
and a.employee_id = #{employeeId}
</if>
<if test="merchantId != null">
and a.merchant_id = #{merchantId}
</if>
<if test="merchantIdList != null and merchantIdList.size()>0">
and a.merchant_id in
<foreach collection="merchantIdList" separator="," close=")" open="(" index="index" item="item">
#{item}
</foreach>
</if>
<if test="merchantName != null and merchantName !=''">
and a.merchant_name like CONCAT('%',#{merchantName},'%')
</if>
<if test="name != null and name !=''">
and a.name like CONCAT('%',#{name},'%')
</if>
<if test="accountName != null and accountName !=''">
and a.account_name like CONCAT('%',#{accountName},'%')
</if>
<if test="photo != null and photo !=''">
and a.photo like CONCAT('%',#{photo},'%')
</if>
<if test="wechatNum != null and wechatNum !=''">
and a.wechat_num like CONCAT('%',#{wechatNum},'%')
</if>
<if test="isOpenCard != null">
and a.is_open_card = #{isOpenCard}
</if>
<if test="loginPhone != null and loginPhone!=''">
and b.phone = #{loginPhone}
</if>
<if test="accountGroupList != null and accountGroupList.size() > 0">
and a.account_group in
<foreach collection="accountGroupList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="dutyConfKey != null and dutyConfKey !=''">
and a.duty_conf_key=#{dutyConfKey}
</if>
</where>
order by a.updated_date desc,a.id desc
</select>
<select id="listSumary" parameterType="cn.com.glsx.dj.system.dto.EmployeeDTO" resultMap="DTOResultMap">
select b.id user_id, a.name
from dj_system_employee a
left join dj_system_user b on b.employee_id=a.employee_id and b.deleted_flag='N'
<where>
a.deleted_flag = 'N'
<if test="id != null">
and a.id = #{id}
</if>
<if test="employeeId != null">
and a.employee_id = #{employeeId}
</if>
<if test="merchantId != null">
and a.merchant_id = #{merchantId}
</if>
<if test="merchantIdList != null and merchantIdList.size()>0">
and a.merchant_id in
<foreach collection="merchantIdList" separator="," close=")" open="(" index="index" item="item">
#{item}
</foreach>
</if>
<if test="merchantName != null and merchantName !=''">
and a.merchant_name like CONCAT('%',#{merchantName},'%')
</if>
<if test="name != null and name !=''">
and a.name like CONCAT('%',#{name},'%')
</if>
<if test="accountName != null and accountName !=''">
and a.account_name like CONCAT('%',#{accountName},'%')
</if>
<if test="photo != null and photo !=''">
and a.photo like CONCAT('%',#{photo},'%')
</if>
<if test="wechatNum != null and wechatNum !=''">
and a.wechat_num like CONCAT('%',#{wechatNum},'%')
</if>
<if test="isOpenCard != null">
and a.is_open_card = #{isOpenCard}
</if>
<if test="loginPhone != null and loginPhone!=''">
and b.phone = #{loginPhone}
</if>
<if test="accountGroupList != null and accountGroupList.size() > 0">
and a.account_group in
<foreach collection="accountGroupList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="dutyConfKey != null and dutyConfKey !=''">
and a.duty_conf_key=#{dutyConfKey}
</if>
</where>
order by a.updated_date desc,a.id desc
</select>
<update id="updateTotalCount" parameterType="cn.com.glsx.dj.system.dto.EmployeeDTO">
update dj_system_employee
<set>
<if test="customerNum != null">
customer_num = customer_num + #{customerNum},
</if>
<if test="customerCount != null">
customer_count = customer_count + #{customerCount},
</if>
</set>
where employee_id = #{employeeId}
</update>
</mapper>