IMPromotionMapper.xml
3.9 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
<?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.dao.IMPromotionDao">
<!-- 促销规则 -->
<select id="getValidPromotionRule" resultMap="listPromotionRule">
SELECT
id,is_limit,limit_num,type
FROM
promotion_rule
WHERE
start_date <= #{currentDate} and end_date >= #{currentDate} and is_delete = 0 and status = 1
</select>
<!-- 促销规则 -->
<select id="getValidPromotionRuleByTypeAndCurrentDate" resultMap="listPromotionRule">
SELECT
id,is_limit,limit_num,type
FROM
promotion_rule
WHERE
start_date <= #{currentDate} and end_date >= #{currentDate} and is_delete = 0 and status = 1 and type = #{type}
</select>
<!-- 促销规则 -->
<select id="getValidPromotionRuleByTypeAndCurrentDateAndSupplierId" resultMap="listPromotionRule">
SELECT
id,is_limit,limit_num,type,supplier_id,platform_type
FROM
promotion_rule
WHERE
start_date <= #{currentDate} and end_date >= #{currentDate} and is_delete = 0 and status = 1 and type = #{type} and supplier_id=#{supplierId}
</select>
<resultMap type="com.sibu.orderHelper.integral.reponse.PromotionRuleResponse" id="listPromotionRule">
<result column="id" property="id" />
<result column="is_limit" property="isLimit" />
<result column="limit_num" property="limitNum" />
<result column="type" property="type" />
<result column="supplier_id" property="supplierId" />
<result column="platform_type" property="platformType" />
</resultMap>
<!-- 订单满送 -->
<select id="getMoneyPromotionById" resultMap="listMoneyPromotion">
select id,buy_money,gift_product_id,gift_num,gift_total,status from promotion_money_gift where promotion_id = ${promotionId} and buy_money <= ${orderTotal} and is_delete = 0 order by buy_money desc limit 1
</select>
<!-- 订单满送 -->
<select id="getTheMostMoneyPromotionById" resultMap="listMoneyPromotion">
select id,buy_money,gift_product_id,gift_num,gift_total,status from promotion_money_gift where promotion_id = ${promotionId} and buy_money <= ${orderTotal} and is_delete = 0 order by buy_money desc limit 1
</select>
<resultMap type="com.sibu.orderHelper.integral.reponse.PromotionMoneyResponse" id="listMoneyPromotion">
<result column="id" property="id" />
<result column="buy_money" property="buyMoney" />
<result column="gift_product_id" property="giftProductId" />
<result column="gift_num" property="giftNum" />
<result column="gift_total" property="giftTotal" />
<result column="status" property="status" />
</resultMap>
<!--商品买一送一 -->
<select id="getProductPromotionById" resultMap="listProductPromotion">
select id,buy_product_id,buy_limit_num,gift_product_id,gift_num,gift_total,status from promotion_product_gift where promotion_id = ${promotionId} and is_delete = 0
</select>
<!--商品买一送一 -->
<select id="getProductPromotionById2" resultMap="listProductPromotion">
select id,buy_product_id,buy_limit_num,gift_product_id,gift_num,gift_total,status from promotion_product_gift where promotion_id = ${promotionId} and is_delete = 0
</select>
<resultMap type="com.sibu.orderHelper.integral.reponse.PromotionProductResponse" id="listProductPromotion">
<result column="id" property="id" />
<result column="buy_product_id" property="buyProductId" />
<result column="buy_limit_num" property="buyLimitNum" />
<result column="gift_product_id" property="giftProductId" />
<result column="gift_num" property="giftNum" />
<result column="gift_total" property="giftTotal" />
<result column="status" property="status" />
</resultMap>
</mapper>