CutDownPriceActivityMapper.xml
5.02 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
<?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.CutDownPriceActivityMapper">
<resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.CutDownPriceActivity">
<id column="activity_id" jdbcType="INTEGER" property="activityId" />
<result column="activity_name" property="activityName" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="begin_time" property="beginTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="jump_url" property="jumpUrl" jdbcType="VARCHAR" />
<result column="banner_url" property="banner" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
activity_id, activity_name, status, begin_time, end_time, create_time, update_time, jump_url, banner_url
</sql>
<select id="selectEffectCutPriceActivity" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cutdown_price_activity
where 1=1 and status=1
and begin_time <= UNIX_TIMESTAMP()
and end_time >= UNIX_TIMESTAMP()
order by begin_time
</select>
<select id="selectCutDownPriceActivity" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cutdown_price_activity
where activity_id = #{activityId,jdbcType=INTEGER}
</select>
<select id="selectCutDownPriceActivityList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM cutdown_price_activity
where activity_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<insert id="updateCutDownPriceActivity">
INSERT INTO cutdown_price_activity
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="params.activityId != null and params.activityId != ''">
activity_id,
</if>
<if test="params.activityName != null and params.activityName != ''">
activity_name,
</if>
<if test="params.beginTime != null and params.beginTime != ''">
begin_time,
</if>
<if test="params.endTime != null and params.endTime != ''">
end_time,
</if>
<if test="params.createTime != null and params.createTime != ''">
create_time,
</if>
<if test="params.updateTime != null and params.updateTime != ''">
update_time,
</if>
<if test="params.banner != null and params.banner != ''">
banner_url,
</if>
<if test="params.jumpUrl != null and params.jumpUrl != ''">
jump_url,
</if>
<if test="params.status != null and params.status != ''">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="params.activityId != null and params.activityId != ''">
#{params.activityId},
</if>
<if test="params.activityName != null and params.activityName != ''">
#{params.activityName,jdbcType=VARCHAR},
</if>
<if test="params.beginTime != null and params.beginTime != ''">
#{params.beginTime,jdbcType=INTEGER},
</if>
<if test="params.endTime != null and params.endTime != ''">
#{params.endTime,jdbcType=INTEGER},
</if>
<if test="params.createTime != null and params.createTime != ''">
#{params.createTime,jdbcType=INTEGER},
</if>
<if test="params.updateTime != null and params.updateTime != ''">
#{params.updateTime,jdbcType=INTEGER},
</if>
<if test="params.banner != null and params.banner != ''">
#{params.banner,jdbcType=VARCHAR},
</if>
<if test="params.jumpUrl != null and params.jumpUrl != ''">
#{params.jumpUrl,jdbcType=VARCHAR},
</if>
<if test="params.status != null and params.status != ''">
#{params.status},
</if>
</trim>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
<if test="params.activityName != null and params.activityName != ''">
activity_name = VALUES(activity_name),
</if>
<if test="params.updateTime != null and params.updateTime != ''">
update_time = VALUES(update_time),
</if>
<if test="params.beginTime != null and params.beginTime != ''">
begin_time = VALUES(begin_time),
</if>
<if test="params.endTime != null and params.endTime != ''">
end_time = VALUES(end_time),
</if>
<if test="params.status != null and params.status != ''">
status = VALUES(status),
</if>
<if test="params.banner != null and params.banner != ''">
banner_url = VALUES(banner_url),
</if>
<if test="params.jumpUrl != null and params.jumpUrl != ''">
jump_url = VALUES(jump_url),
</if>
</trim>
</insert>
</mapper>