UserProfileMapper.xml
5.83 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
<?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.yoho.unions.dal.IUserProfileDAO">
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UserProfile">
<id column="uid" property="uid" jdbcType="INTEGER" />
<result column="email" property="email" jdbcType="VARCHAR" />
<result column="mobile" property="mobile" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="user_source" property="userSource" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="user_channel" property="userChannel" jdbcType="SMALLINT" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="sso_password" property="ssoPassword" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
uid, email, mobile, password, user_source, create_time, user_channel,
status, sso_password
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from user_profile
where uid = #{uid,jdbcType=INTEGER}
</select>
<select id="selectProfileByEmail" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from user_profile
where email=#{email} and status=1 limit 1
</select>
<select id="selectProfileByMobile" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from user_profile
where mobile=#{mobile} and status=1 limit 1
</select>
<select id="selectProfileByMobileForForeign" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_profile
where mobile=#{mobile1} or mobile=#{mobile2} and status=1 limit 1
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="uid" parameterType="com.yoho.unions.dal.model.UserProfile">
insert into user_profile (email, mobile,
password, user_source, create_time,
user_channel, status)
values
(#{email,jdbcType=VARCHAR},
#{mobile,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{userSource,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER},
#{userChannel,jdbcType=SMALLINT},
#{status,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="uid" parameterType="com.yoho.unions.dal.model.UserProfile">
insert into user_profile
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="email != null">
email,
</if>
<if test="mobile != null">
mobile,
</if>
<if test="password != null">
password,
</if>
<if test="userSource != null">
user_source,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="userChannel != null">
user_channel,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="mobile != null">
#{mobile,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="userSource != null">
#{userSource,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="userChannel != null">
#{userChannel,jdbcType=SMALLINT},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UserProfile">
update user_profile
<set>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="mobile != null">
mobile = #{mobile,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="userSource != null">
user_source = #{userSource,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="userChannel != null">
user_channel = #{userChannel,jdbcType=SMALLINT},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="ssoPassword != null">
sso_password = #{ssoPassword,jdbcType=VARCHAR},
</if>
</set>
where uid = #{uid,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UserProfile">
update user_profile
set email = #{email,jdbcType=VARCHAR},
mobile = #{mobile,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
user_source =
#{userSource,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER},
user_channel = #{userChannel,jdbcType=SMALLINT},
status = #{status,jdbcType=TINYINT}
where uid = #{uid,jdbcType=INTEGER}
</update>
<select id="selectProfileByUIds" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from user_profile where uid in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectCountByUidOrMobileOrEmail" resultType="java.lang.Integer">
SELECT COUNT(1) from
user_profile
where 1=1
<if test="list!=null and list.size !=0">
AND uid in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="mobile !=null">
and mobile = #{mobile}
</if>
<if test="email !=null">
and email = #{email}
</if>
<if test = "startTime !=null and startTime != 0">
and create_time <#{startTime}
</if>
<if test="endTime !=null and endTime !=0">
and create_time >#{endTime}
</if>
</select>
</mapper>