CutDownPriceProductMapper.xml
2.63 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
<?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.CutDownPriceProductMapper">
<resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.CutDownPriceProduct">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="activity_id" property="activityId" jdbcType="INTEGER" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="high_price" property="highPrice" jdbcType="DECIMAL" />
<result column="low_price" property="lowPrice" jdbcType="DECIMAL" />
<result column="join_num" property="joinNum" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, activity_id, product_skn, high_price, low_price, join_num, create_time, update_time
</sql>
<select id="selectCutDownPriceProduct" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cutdown_price_product
where activity_id = #{activityId,jdbcType=INTEGER}
AND product_skn = #{productSkn,jdbcType=INTEGER}
</select>
<select id="selectCutDownPriceProductList" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from cutdown_price_product
where
<foreach collection="list" item="item" index="index" separator="OR">
(activity_id=#{item.activityId,jdbcType=INTEGER} and product_skn=#{item.productSkn,jdbcType=INTEGER})
</foreach>
</select>
<update id="updateCutDownPriceProductStatus" >
update cutdown_price_product set status = #{status,jdbcType=INTEGER}
where product_skn = #{productSkn,jdbcType=INTEGER}
</update>
<insert id="updateCutDownPriceProduct">
INSERT INTO cutdown_price_product
<![CDATA[
(activity_id,
product_skn,
join_num,
high_price,
low_price,
create_time,
update_time,
status)
VALUES
]]>
<foreach item="item" collection="list" separator=",">
( #{item.activityId},
#{item.productSkn},
#{item.joinNum},
#{item.highPrice},
#{item.lowPrice},
#{item.createTime},
#{item.updateTime},
#{item.status})
</foreach>
ON DUPLICATE KEY UPDATE
product_skn = VALUES(product_skn),
join_num = VALUES(join_num),
update_time = VALUES(update_time),
high_price = VALUES(high_price),
low_price = VALUES(low_price),
status = VALUES(status)
</insert>
</mapper>