|
@@ -189,10 +189,30 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectCouponSendItem" resultType="java.util.Map">
|
|
<select id="selectCouponSendItem" resultType="java.util.Map">
|
|
|
- select *,
|
|
|
|
|
- COUNT (*)
|
|
|
|
|
|
|
+ select
|
|
|
|
|
+ tmcs.send_id as "sendId",
|
|
|
|
|
+ tmcs.cp_id as "cpId",
|
|
|
|
|
+ tmcs.coupon_id as "couponId",
|
|
|
|
|
+ tmcs.send_date as "sendDate",
|
|
|
|
|
+ tmcs.end_date as "endDate",
|
|
|
|
|
+ tmcs.user_num as "userNum",
|
|
|
|
|
+ tmcs.send_staff as "sendStaff",
|
|
|
|
|
+ tmcs.send_user as "sendUser",
|
|
|
|
|
+ ( select COUNT (1) from dkic_a.t_mst_coupon_receive tmcr
|
|
|
|
|
+ where tmcr.send_id = tmcs.send_id
|
|
|
|
|
+ ) as "userHelpNum",
|
|
|
|
|
+ now() as "nowTime"
|
|
|
from dkic_a.t_mst_coupon_send tmcs
|
|
from dkic_a.t_mst_coupon_send tmcs
|
|
|
- where tmcs.send_user = #{sendUser}
|
|
|
|
|
|
|
+ left join dkic_a.t_mst_coupon tmc
|
|
|
|
|
+ on tmc.coupon_id = tmcs.coupon_id
|
|
|
|
|
+ where tmcs.send_user = #{sendUser}::uuid
|
|
|
|
|
+ and ( select COUNT (1) from dkic_a.t_mst_coupon_receive tmcr
|
|
|
|
|
+ where tmcr.send_id = tmcs.send_id
|
|
|
|
|
+ ) < tmc.user_num
|
|
|
|
|
+ and tmcs.cp_id = #{cpId}
|
|
|
|
|
+ and tmcs.end_date > now()
|
|
|
|
|
+ ORDER BY tmcs.send_date desc
|
|
|
|
|
+ limit 1
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|