cc.`id`,cc.`tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`
where 1 = 1
and cc.`id` = #{id}
and cc.`tenant_id` = #{tenantId}
and cc.`coupon_id` = #{couponId}
and cc.`type` = #{type}
and cc.`title` like concat('%', #{title},'%')
and cc.`target_ad` = #{targetAd}
and cc.`business` = #{business}
and cc.`sub_business` = #{subBusiness}
and cc.`create_date` between #{startdate} and #{enddate}
and cc.`status` = #{status}
and cc.`create_date` = #{createDate}
and cc.`update_date` = #{updateDate}
and cc.`sub_target_id` = #{subTargetId}
and c.`support_transfer` = #{supportTransfer}
and cc.id in
#{idItem}
and cc.coupon_id in
#{couponIdsItem}
order by ${sortColumns}
update wx_coupon_channel
set status=#{status}, update_date=#{updateDate}
where coupon_id=#{couponId}
and tenant_id = #{tenantId}
,
c.remain_inventory,c.inventory,c.cover_img,c.title,c.sub_title,c.sale_price,
c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund,
c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.credit_price
cc.id,cc.coupon_id,cc.target_ad,cc.begin_time,cc.end_time,
c.tenant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,
c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,
c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,
c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price
update wx_coupon_channel SET status = 1, update_date = now()
where status = 0 and end_time < now()
update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now()
where cc.status = 0 and cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date < now()
update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now()
where cc.status = 0 and cc.coupon_id = c.id and c.status = 1
update wx_coupon_channel SET status = 1, update_date = now()
where status = 0 and target_ad = 2 and end_time < now()
delete from wx_coupon_channel where sub_target_id = #{id}