PromotionMoneyGiftMapper.xml
4.8 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
<?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.sibu.orderHelper.integral.web.dao.IMPromotionMoneyGiftDao">
<resultMap id="rs_PromotionMoneyGiftBean" type="com.sibu.orderHelper.integral.model.PromotionMoneyGift">
<result property="id" column="id" javaType="java.lang.Long" jdbcType="VARCHAR"/>
<result property="buyMoney" column="buy_money" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="giftNum" column="gift_num" javaType="java.lang.Integer" jdbcType="VARCHAR"/>
<result property="giftTotal" column="gift_total" javaType="java.lang.Long" jdbcType="VARCHAR"/>
<result property="surplusNum" column="surplus_num" javaType="java.lang.Long" jdbcType="VARCHAR"/>
<result property="isDelete" column="is_delete" javaType="java.lang.Integer" jdbcType="VARCHAR"/>
<result property="status" column="status" javaType="java.lang.Integer" jdbcType="VARCHAR"/>
<result property="giftProductId" column="gift_product_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="createDate" column="create_date" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
<result property="promotionId" column="promotion_id" javaType="java.lang.Long" jdbcType="VARCHAR"/>
</resultMap>
<select id="count" resultType="java.lang.Integer" >
SELECT COUNT(id) FROM promotion_money_gift
<trim prefix="where" prefixOverrides="and | or">
<if test="null != id">
AND id = #{id}
</if>
</trim>
</select>
<select id="list" resultMap="rs_PromotionMoneyGiftBean" >
SELECT * FROM promotion_money_gift where
id = #{id}
ORDER BY create_date desc
</select>
<select id="listMoneyGift" resultMap="listMoneyGiftResponse" parameterType="java.lang.Integer">
select pmg.id,pmg.buy_money,pmg.gift_num,pmg.gift_total,pmg.status,pmg.gift_product_id,pmg.create_date,ip.name gift_product_name from promotion_money_gift pmg left join im_product ip on pmg.gift_product_id = ip.im_product_id where pmg.promotion_id = ${promotionId}
</select>
<resultMap type="com.sibu.orderHelper.integral.reponse.PromotionMoneyGiftResponse" id="listMoneyGiftResponse">
<result property="id" column="id" />
<result property="buyMoney" column="buy_money" />
<result property="giftNum" column="gift_num" />
<result property="giftTotal" column="gift_total" />
<result property="status" column="status" />
<result property="giftProductId" column="gift_product_id" />
<result property="createDate" column="create_date" />
<result property="giftProductName" column="gift_product_name" />
</resultMap>
<select id="get" resultMap="rs_PromotionMoneyGiftBean" parameterType="java.lang.String">
SELECT * FROM promotion_money_gift
where id = #{id}
</select>
<insert id="save" parameterType="com.sibu.orderHelper.integral.request.PromotionMoneyGiftRequest">
INSERT INTO promotion_money_gift (
buy_money,gift_num,gift_total,status,gift_product_id,promotion_id,supplier_id,supplier_name,platform_type
) VALUES (
#{buyMoney},#{giftNum},#{giftTotal},#{status},#{giftProductId},#{promotionId},#{supplierId},#{supplierName},#{platformType}
)
<!-- <selectKey resultType="java.lang.String" keyProperty="id">
<![CDATA[SELECT last_insert_id() AS id ]]>
</selectKey> -->
</insert>
<update id="update" parameterType="java.util.Map">
UPDATE promotion_money_gift
<trim prefix="SET" suffixOverrides=",">
<if test="null != buyMoney">
buy_money=#{buyMoney},
</if>
<if test="null != giftNum">
gift_num=#{giftNum},
</if>
<if test="null != giftTotal">
gift_total=#{giftTotal},
</if>
<if test="null != surplusNum">
surplus_num=#{surplusNum},
</if>
<if test="null != isDelete">
is_delete=#{isDelete},
</if>
<if test="null != status">
status=#{status},
</if>
<if test="null != giftProductId">
gift_product_id=#{giftProductId},
</if>
<if test="null != createDate">
create_date=#{createDate},
</if>
<if test="null != promotionId">
promotion_id=#{promotionId},
</if>
</trim>
WHERE id = #{id}
</update>
<delete id="delete" parameterType="java.lang.Long">
DELETE FROM promotion_money_gift WHERE id = #{id}
</delete>
<delete id="batchDelete" parameterType="java.util.List">
DELETE FROM promotion_money_gift WHERE id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="listSupplierMoneyGift" resultMap="listMoneyGiftResponse" parameterType="java.util.Map">
select pmg.id,pmg.buy_money,pmg.gift_num,pmg.gift_total,pmg.status,pmg.gift_product_id,pmg.create_date,ip.name gift_product_name from promotion_money_gift pmg left join im_product ip on pmg.gift_product_id = ip.im_product_id where pmg.promotion_id = ${promotionId}
and pmg.supplier_id = #{supplierId}
</select>
</mapper>