ActPrizeProductUserMapper.xml
7.06 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.activity.dal.ActPrizeProductUserMapper">
<resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.ActPrizeProductUser">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="act_id" jdbcType="INTEGER" property="actId" />
<result column="act_prize_id" jdbcType="INTEGER" property="actPrizeId" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="user_thumb" jdbcType="VARCHAR" property="userThumb" />
<result column="union_id" jdbcType="VARCHAR" property="unionId" />
<result column="prize_code" jdbcType="VARCHAR" property="prizeCode" />
<result column="is_share_take" jdbcType="TINYINT" property="isShareTake" />
<result column="share_uid" jdbcType="INTEGER" property="shareUid" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, act_id, act_prize_id, uid, user_name, user_thumb, union_id, prize_code, is_share_take,
share_uid, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from act_prize_product_user
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from act_prize_product_user
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser">
insert into act_prize_product_user (id, act_id, act_prize_id,
uid, user_name, user_thumb,
union_id, prize_code, is_share_take,
share_uid, create_time)
values (#{id,jdbcType=INTEGER}, #{actId,jdbcType=INTEGER}, #{actPrizeId,jdbcType=INTEGER},
#{uid,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userThumb,jdbcType=VARCHAR},
#{unionId,jdbcType=VARCHAR}, #{prizeCode,jdbcType=VARCHAR}, #{isShareTake,jdbcType=TINYINT},
#{shareUid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser">
insert into act_prize_product_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="actId != null">
act_id,
</if>
<if test="actPrizeId != null">
act_prize_id,
</if>
<if test="uid != null">
uid,
</if>
<if test="userName != null">
user_name,
</if>
<if test="userThumb != null">
user_thumb,
</if>
<if test="unionId != null">
union_id,
</if>
<if test="prizeCode != null">
prize_code,
</if>
<if test="isShareTake != null">
is_share_take,
</if>
<if test="shareUid != null">
share_uid,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="actId != null">
#{actId,jdbcType=INTEGER},
</if>
<if test="actPrizeId != null">
#{actPrizeId,jdbcType=INTEGER},
</if>
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
<if test="userThumb != null">
#{userThumb,jdbcType=VARCHAR},
</if>
<if test="unionId != null">
#{unionId,jdbcType=VARCHAR},
</if>
<if test="prizeCode != null">
#{prizeCode,jdbcType=VARCHAR},
</if>
<if test="isShareTake != null">
#{isShareTake,jdbcType=TINYINT},
</if>
<if test="shareUid != null">
#{shareUid,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser">
update act_prize_product_user
<set>
<if test="actId != null">
act_id = #{actId,jdbcType=INTEGER},
</if>
<if test="actPrizeId != null">
act_prize_id = #{actPrizeId,jdbcType=INTEGER},
</if>
<if test="uid != null">
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="userThumb != null">
user_thumb = #{userThumb,jdbcType=VARCHAR},
</if>
<if test="unionId != null">
union_id = #{unionId,jdbcType=VARCHAR},
</if>
<if test="prizeCode != null">
prize_code = #{prizeCode,jdbcType=VARCHAR},
</if>
<if test="isShareTake != null">
is_share_take = #{isShareTake,jdbcType=TINYINT},
</if>
<if test="shareUid != null">
share_uid = #{shareUid,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser">
update act_prize_product_user
set act_id = #{actId,jdbcType=INTEGER},
act_prize_id = #{actPrizeId,jdbcType=INTEGER},
uid = #{uid,jdbcType=INTEGER},
user_name = #{userName,jdbcType=VARCHAR},
user_thumb = #{userThumb,jdbcType=VARCHAR},
union_id = #{unionId,jdbcType=VARCHAR},
prize_code = #{prizeCode,jdbcType=VARCHAR},
is_share_take = #{isShareTake,jdbcType=TINYINT},
share_uid = #{shareUid,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectRecentUsers" resultMap="BaseResultMap">
select uid, user_name, user_thumb, create_time from act_prize_product_user
where act_prize_id = #{actPrizeId} and is_share_take=0 order by create_time desc limit 10
</select>
<select id="getActUserCodeCount" resultType="java.lang.Integer">
SELECT count(1) from act_prize_product_user where 1=1
<if test="record.actPrizeId != null">
and act_prize_id = #{actPrizeId}
</if>
<if test="record.actPrizeId != null">
and uid = #{uid}
</if>
</select>
<insert id="insertSelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser">
insert into act_prize_product_user (act_prize_id, uid, user_name, user_thumb, union_id, prize_code, is_share_take, share_uid)
select #{record.actPrizeId} as act_prize_id, #{record.uid} as uid, #{record.userName}, #{record.userThumb}, #{record.unionId}, #{record.prizeCode} as prize_code,
#{record.isShareTake} as is_share_take, #{record.shareUid} as share_uid from act_prize_product_user where uid = #{record.uid} and is_share_take=0 limit 1;
</insert>
</mapper>