You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.7 KiB

<?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.qs.serve.modules.oms.mapper.OmsPromotionGiftItemMapper">
<resultMap id="omsPromotionGiftItemMap" type="com.qs.serve.modules.oms.entity.OmsPromotionGiftItem" >
<result property="id" column="id"/>
<result property="giftId" column="gift_id"/>
<result property="goodsType" column="goods_type"/>
<result property="goodsId" column="goods_id"/>
<result property="goodsCode" column="goods_code"/>
<result property="goodsName" column="goods_name"/>
<result property="minPurchaseQty" column="min_purchase_qty"/>
<result property="meetQty" column="meet_qty"/>
<result property="giftQty" column="gift_qty"/>
<result property="goodsFlag" column="goods_flag"/>
</resultMap>
<sql id="omsPromotionGiftItemSql">
oms_promotion_gift_item.`id`,
oms_promotion_gift_item.`gift_id`,
oms_promotion_gift_item.`goods_type`,
oms_promotion_gift_item.`goods_id`,
oms_promotion_gift_item.`goods_code`,
oms_promotion_gift_item.`goods_name`,
oms_promotion_gift_item.`min_purchase_qty`,
oms_promotion_gift_item.`meet_qty`,
oms_promotion_gift_item.`gift_qty`,
oms_promotion_gift_item.`goods_flag` </sql>
<select id="listCustomerItems" resultType="com.qs.serve.modules.oms.entity.vo.OmsPromotionGiftItemVo">
select t1.*
from oms_promotion_gift_item t1
left join oms_promotion_gift t2
on t1.gift_id = t2.id
where t1. del_flag = 0
and t2.del_flag = 0
and t2.gift_status = 2
and t2.effect_start_date &lt;= now()
and t2.effect_end_date &gt;= now()
and t2.id in (
select gift_id
from oms_promotion_gift_scope
where
( region_type = 'customer' and region_id = #{customerId} )
or
( region_type = 'saleRegion' and region_id in
<foreach collection="saleRegionIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
)
or
( region_type = 'bizRegion' and region_id in
<foreach collection="bizRegionIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
)
and del_flag = 0
)
</select>
</mapper>