PromotionDao.xml
8.64 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?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.diligrp.mobsite.man.dao.impl.PromotionDaoImpl">
<resultMap id="PromotionRM" type="com.diligrp.mobsite.man.domain.Promotion">
<id property="id" column="id"/>
<result property="marketId" column="market_id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="deviceType" column="device_type"/>
<result property="receiveCrowd" column="receive_crowd"/>
<result property="sendType" column="send_type"/>
<result property="sendTime" column="send_time"/>
<result property="openType" column="open_type"/>
<result property="openUrl" column="open_url"/>
<result property="sendFlag" column="send_flag"/>
<result property="creatorId" column="creator_id"/>
<result property="sendId" column="send_id"/>
<result property="yn" column="yn"/>
<result property="created" column="created"/>
<result property="modified" column="modified"/>
</resultMap>
<select id="getById" parameterType="Long" resultMap="PromotionRM">
<![CDATA[
SELECT
id
,market_id
,title
,content
,device_type
,receive_crowd
,send_type
,send_time
,open_type
,open_url
,send_flag
,creator_id
,send_id
,yn
,created
,modified
FROM T_PROMOTION
WHERE id=#{pk}
and (yn is null or yn = 1)
]]>
</select>
<insert id="save" parameterType="com.diligrp.mobsite.man.domain.Promotion">
<selectKey keyProperty="id" resultType="long" order="AFTER">
SELECT LAST_INSERT_ID();
</selectKey>
<![CDATA[
INSERT INTO T_PROMOTION(
market_id
,title
,content
,device_type
,receive_crowd
,send_type
,send_time
,open_type
,open_url
,send_flag
,creator_id
,send_id
) VALUES
]]>
<foreach collection="marketIds" item="mId" separator=",">
(
#{mId}
,#{title}
,#{content}
,#{deviceType}
,#{receiveCrowd}
,#{sendType}
,#{sendTime}
,#{openType}
,#{openUrl}
,#{sendFlag}
,#{creatorId}
,#{sendId}
)
</foreach>
</insert>
<update id="update" parameterType="com.diligrp.mobsite.man.domain.Promotion">
<![CDATA[
UPDATE T_PROMOTION set
market_id=#{marketId}
,title=#{title}
,content=#{content}
,device_type=#{deviceType}
,receive_crowd=#{receiveCrowd}
,send_type=#{sendType}
,send_time=#{sendTime}
,open_type=#{openType}
,open_url=#{openUrl}
,send_flag=#{sendFlag}
,creator_id=#{creatorId}
,send_id=#{sendId}
where id = #{id}
]]>
</update>
<select id="countByCondition" parameterType="Query" resultType="Integer">
<![CDATA[
SELECT count(1) FROM T_PROMOTION where 1=1
]]>
<if test="param != null">
<if test="param.id != null and param.id != ''">
and id = #{param.id}
</if>
<if test="param.marketId != null and param.marketId != ''">
and market_id = #{param.marketId}
</if>
<if test="param.title != null and param.title != ''">
and title like #{param.title}"%"
</if>
<if test="param.content != null and param.content != ''">
and content = #{param.content}
</if>
<if test="param.deviceType != null and param.deviceType != ''">
and device_type = #{param.deviceType}
</if>
<if test="param.receiveCrowd != null and param.receiveCrowd != ''">
and receive_crowd = #{param.receiveCrowd}
</if>
<if test="param.sendType != null and param.sendType != ''">
and send_type = #{param.sendType}
</if>
<if test="param.sendTime != null and param.sendTime != ''">
and send_time = #{param.sendTime}
</if>
<if test="param.openType != null and param.openType != ''">
and open_type = #{param.openType}
</if>
<if test="param.openUrl != null and param.openUrl != ''">
and open_url = #{param.openUrl}
</if>
<if test="param.sendFlag != null and param.sendFlag != ''">
and send_flag = #{param.sendFlag}
</if>
<if test="param.creatorId != null and param.creatorId != ''">
and creator_id = #{param.creatorId}
</if>
<if test="param.sendId != null and param.sendId != ''">
and send_id = #{param.sendId}
</if>
<![CDATA[
and (yn is null or yn = 1)
]]>
<if test="param.created != null and param.created != ''">
and created = #{param.created}
</if>
<if test="param.modified != null and param.modified != ''">
and modified = #{param.modified}
</if>
</if>
</select>
<select id="listByCondition" parameterType="Query" resultMap="PromotionRM">
<![CDATA[
SELECT
id
,market_id
,title
,content
,device_type
,receive_crowd
,send_type
,send_time
,open_type
,open_url
,send_flag
,creator_id
,send_id
,yn
,created
,modified
FROM T_PROMOTION where 1=1
]]>
<if test="param != null">
<if test="param.id != null and param.id != ''">
and id = #{param.id}
</if>
<if test="param.marketId != null and param.marketId != ''">
and market_id = #{param.marketId}
</if>
<if test="param.title != null and param.title != ''">
and title like #{param.title}"%"
</if>
<if test="param.content != null and param.content != ''">
and content = #{param.content}
</if>
<if test="param.deviceType != null and param.deviceType != ''">
and device_type = #{param.deviceType}
</if>
<if test="param.receiveCrowd != null and param.receiveCrowd != ''">
and receive_crowd = #{param.receiveCrowd}
</if>
<if test="param.sendType != null and param.sendType != ''">
and send_type = #{param.sendType}
</if>
<if test="param.sendTime != null and param.sendTime != ''">
and send_time = #{param.sendTime}
</if>
<if test="param.openType != null and param.openType != ''">
and open_type = #{param.openType}
</if>
<if test="param.openUrl != null and param.openUrl != ''">
and open_url = #{param.openUrl}
</if>
<if test="param.sendFlag != null and param.sendFlag != ''">
and send_flag = #{param.sendFlag}
</if>
<if test="param.creatorId != null and param.creatorId != ''">
and creator_id = #{param.creatorId}
</if>
<if test="param.sendId != null and param.sendId != ''">
and send_id = #{param.sendId}
</if>
<![CDATA[
and (yn is null or yn = 1)
]]>
<if test="param.created != null and param.created != ''">
and created = #{param.created}
</if>
<if test="param.modified != null and param.modified != ''">
and modified = #{param.modified}
</if>
</if>
order by send_time desc
<![CDATA[
limit #{startRow},#{pageSize}
]]>
</select>
<update id="deleteById" parameterType="Long">
<![CDATA[
update T_PROMOTION set
yn = 2
where 1 = 1
and id = #{id}
]]>
</update>
</mapper>