| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?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.cyksj.mapper.manage.coupon.CouponMapper">
- <insert id="batchSendCouponToUsers">
- insert into
- coupon_user(`user_id`,`coupon_id`,`channel`,`valid_start_time`,`valid_end_time`,`status`,`created_time`,`update_time`)
- values
- <foreach collection="userIds" item="userId" separator=",">
- (#{userId},#{couponId},#{channel},#{validStartTime},#{validEndTime},#{status},now(),now())
- </foreach>
- ON DUPLICATE KEY UPDATE coupon_id = VALUES(coupon_id)
- </insert>
- <select id="checkExCode" resultType="com.cyksj.model.dto.CouponPopularizeDto">
- select cp.id as couponId,
- cdp.id as popularizeId,
- cdp.user_id,
- cdp.distribute_id,
- cp.goods_sku_ids,
- cp.type,
- cp.use_scope,
- cp.scope,
- cdp.coupon_id as popularizeCouponId,
- cdp.is_general,
- cp.goods_type,
- cp.reduce_money,
- cp.reduce_condition,
- cp.discount,
- cp.valid_days,
- cp.valid_hours,
- cp.valid_start_time,
- cp.valid_end_time,
- cp.is_valid_time
- from `coupon` cp
- left join (select id, distribute_id,coupon_id, ex_code, user_id, is_general
- from `coupon_distribute_popularize`
- where deleted is true) cdp
- on cdp.coupon_id = cp.id
- where cp.deleted is true
- and (cp.ex_code = #{couponExCode} or cdp.ex_code = #{couponExCode}) limit 1
- </select>
- <select id="getCouponSku" resultType="com.cyksj.model.entity.GoodsDonSku">
- select sku.id, sku.goods_id, sku.spec_val
- from `coupon_sku` ck
- left join `goods_don_sku` gdk on gdk.id = ck.sku_id
- where ck.coupon_id = #{couponId}
- </select>
- </mapper>
|