UserMapper.xml
5.25 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
<?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.UserMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.system.model.User" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="account_name" property="accountName" jdbcType="VARCHAR" />
<result column="dj_id" property="djId"/>
<result column="employee_id" property="employeeId" jdbcType="INTEGER" />
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="user_type" property="userType" jdbcType="TINYINT" />
<result column="password" property="password"/>
<result column="phone" property="phone"/>
<result column="reg_source" property="regSource"/>
<result column="inviter_user_id" property="inviterUserId"/>
<result column="enabled_flag" property="enabledFlag"/>
<result column="uuid" property="uuid"/>
<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.UserDTO" extends="BaseResultMap">
<result column="channel_id" property="channelId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, account_name,dj_id, employee_id, merchant_id, user_type,password,phone,reg_source,
inviter_user_id,enabled_flag,uuid,created_by, created_date,updated_by, updated_date, deleted_flag
</sql>
<select id="getByMerchantId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from dj_system_user
where deleted_flag = 'N' and merchant_id = #{merchantId} and user_type != 1 limit 1
</select>
<select id="list" parameterType="cn.com.glsx.dj.system.dto.UserDTO" resultMap="DTOResultMap">
select a.id, a.account_name,a.dj_id, a.employee_id, a.merchant_id, a.user_type,a.phone,a.reg_source,
a.inviter_user_id,a.enabled_flag,a.uuid,a.created_date, b.channel_id
from dj_system_user a
left join dj_system_merchant b on b.merchant_id=a.merchant_id and b.deleted_flag = 'N'
<where>
a.deleted_flag = 'N'
<if test="id != null">
and a.id = #{id}
</if>
<if test="djId != null and djId !=''">
and a.dj_id = #{djId}
</if>
<if test="accountName != null and accountName !=''">
and a.account_name = #{accountName}
</if>
<if test="employeeId != null">
and a.employee_id = #{employeeId}
</if>
<if test="merchantId != null">
and a.merchant_id = #{merchantId}
</if>
<if test="userType != null">
and a.user_type = #{userType}
</if>
<if test="merchantIds != null">
and a.merchant_id in
<foreach collection="merchantIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="userIds != null">
and a.id in
<foreach collection="userIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="regSource != null and regSource !=''">
and a.reg_source = #{regSource}
</if>
<if test="phone != null and phone !=''">
and a.phone = #{phone}
</if>
<if test="channelId != null">
and b.channel_id = #{channelId}
</if>
<if test="enabledFlag != null and enabledFlag !=''">
and a.enabled_flag = #{enabledFlag}
</if>
<if test="uuid != null and uuid !=''">
and a.uuid = #{uuid}
</if>
</where>
order by a.id desc
</select>
<update id="unbindLoginPhone" parameterType="java.lang.Integer">
update dj_system_user set phone=null where id = #{id}
</update>
<select id="count" parameterType="cn.com.glsx.dj.system.dto.UserDTO" resultType="java.lang.Long">
select count(a.id) from dj_system_user a
<where>
a.deleted_flag = 'N'
<if test="merchantId != null">
and a.merchant_id = #{merchantId}
</if>
<if test="userType != null">
and a.user_type = #{userType}
</if>
<if test="merchantIds != null">
and a.merchant_id in
<foreach collection="merchantIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="regSource != null and regSource !=''">
and a.reg_source = #{regSource}
</if>
<if test="phone != null and phone !=''">
and a.phone = #{phone}
</if>
<if test="enabledFlag != null and enabledFlag !=''">
and a.enabled_flag = #{enabledFlag}
</if>
<if test="inviterUserId != null">
and a.inviter_user_id = #{inviterUserId}
</if>
<if test="startRegTime != null">
<![CDATA[ and a.created_date >= #{startRegTime} ]]>
</if>
<if test="endRegTime != null">
<![CDATA[ and a.created_date <= #{endRegTime} ]]>
</if>
</where>
</select>
</mapper>