UserMapper.xml
6.59 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
<?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.bjivt.job.robot.entity.User">
<resultMap id="BaseResultMap" type="com.bjivt.job.robot.entity.User">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="msisdn" jdbcType="VARCHAR" property="msisdn" />
<result column="captcha" jdbcType="VARCHAR" property="captcha" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="signature" jdbcType="VARCHAR" property="signature" />
<result column="exp" jdbcType="INTEGER" property="exp" />
<result column="sex" jdbcType="VARCHAR" property="sex" />
<result column="age" jdbcType="INTEGER" property="age" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="chat_auth" jdbcType="SMALLINT" property="chatAuth" />
<result column="is_star" jdbcType="SMALLINT" property="isStar" />
<result column="active" jdbcType="CHAR" property="active" />
<result column="is_robot" jdbcType="INTEGER" property="isRobot" />
<result column="is_robot_use" jdbcType="INTEGER" property="isRobotUse" />
</resultMap>
<sql id="Base_Column_List">
id, name, msisdn, captcha, avatar, signature, exp, sex,
age, create_time, chat_auth, is_star, active,is_robot,is_robot_use
</sql>
<select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tbl_user_list
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteById" parameterType="java.lang.Integer">
delete from tbl_user_list
where id = #{id,jdbcType=INTEGER}
</delete>
<update id="updateByIdSelective" parameterType="com.bjivt.job.robot.entity.User">
update tbl_user_list
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="msisdn != null">
msisdn = #{msisdn,jdbcType=VARCHAR},
</if>
<if test="captcha != null">
captcha = #{captcha,jdbcType=VARCHAR},
</if>
<if test="avatar != null">
avatar = #{avatar,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="signature != null">
signature = #{signature,jdbcType=VARCHAR},
</if>
<if test="liveCount != null">
live_count = #{liveCount,jdbcType=INTEGER},
</if>
<if test="likeCount != null">
like_count = #{likeCount,jdbcType=INTEGER},
</if>
<if test="exp != null">
exp = #{exp,jdbcType=INTEGER},
</if>
<if test="fansCount != null">
fans_count = #{fansCount,jdbcType=INTEGER},
</if>
<if test="followerCount != null">
follower_count = #{followerCount,jdbcType=INTEGER},
</if>
<if test="chineseCoin != null">
chinese_coin = #{chineseCoin,jdbcType=INTEGER},
</if>
<if test="meCoinTotal != null">
me_coin_total = #{meCoinTotal,jdbcType=INTEGER},
</if>
<if test="meCoinBalance != null">
me_coin_balance = #{meCoinBalance,jdbcType=INTEGER},
</if>
<if test="sentGiftCount != null">
sent_gift_count = #{sentGiftCount,jdbcType=INTEGER},
</if>
<if test="sentGiftMoneyCount != null">
sent_gift_money_count = #{sentGiftMoneyCount,jdbcType=INTEGER},
</if>
<if test="sentRedEnvelopCount != null">
sent_red_envelop_count = #{sentRedEnvelopCount,jdbcType=INTEGER},
</if>
<if test="sentRedEnvelopMoneyCount != null">
sent_red_envelop_money_count = #{sentRedEnvelopMoneyCount,jdbcType=INTEGER},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=VARCHAR},
</if>
<if test="age != null">
age = #{age,jdbcType=INTEGER},
</if>
<if test="hometown != null">
hometown = #{hometown,jdbcType=VARCHAR},
</if>
<if test="profession != null">
profession = #{profession,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="thirdPartyType != null">
third_party_type = #{thirdPartyType,jdbcType=VARCHAR},
</if>
<if test="thirdPartyAccount != null">
third_party_account = #{thirdPartyAccount,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastLoginTime != null">
last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if test="lastLoginIp != null">
last_login_ip = #{lastLoginIp,jdbcType=VARCHAR},
</if>
<if test="chatAuth != null">
chat_auth = #{chatAuth,jdbcType=SMALLINT},
</if>
<if test="isStar != null">
is_star = #{isStar,jdbcType=SMALLINT},
</if>
<if test="lastLoginLocation != null">
last_login_location = #{lastLoginLocation,jdbcType=VARCHAR},
</if>
<if test="active != null">
active = #{active,jdbcType=CHAR},
</if>
<if test="active != null">
is_robot = #{isRobot,jdbcType=INTEGER},
</if>
<if test="active != null">
is_robot_use = #{isRobotUse,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateById" parameterType="com.bjivt.job.robot.entity.User">
update tbl_user_list
set is_robot_use = #{isRobotUse,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<!-- 更新所有使用的机器人信息 -->
<update id="updateAllRobot" parameterType="com.bjivt.job.robot.entity.User">
update tbl_user_list
set is_robot_use = 0
where is_robot_use = 1 and is_robot=1
</update>
<select id="getCountBy" resultType="java.lang.Integer" parameterType="com.bjivt.job.robot.entity.User">
SELECT
count(id)
FROM
tbl_user_list tl
<trim prefix="where" prefixOverrides="and|or">
<if test="name != null and name != ''" >
and tl.is_robot_use =0
</if>
<if test="id != null and id != ''" >
and tl.is_robot=1
</if>
</trim>
</select>
<!-- 是属于机器人的,未被使用的 -->
<select id="findListByMap" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
<include refid="Base_Column_List"/>
FROM tbl_user_list tl
where tl.is_robot=1
order by create_time limit #{start,jdbcType=INTEGER}, #{end,jdbcType=INTEGER}
</select>
</mapper>