distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code where 1=1 and c.status = #{couponStatus} and cc.status = #{status} and cc.status = 0 and cc.`id` = #{id} and cc.`tenant_id` = #{tenantId} and cc.`parent_tenant_id` = #{parentTenantId} 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.`show_begin_time` <= #{showBeginTime} 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 c.`credit_price` <= #{userCredit} and c.`source_type` = #{sourceType} and cm.`merchant_id` = #{merchantId} 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} and `parent_tenant_id` = #{parentTenantId} update wx_coupon_channel set end_time = #{endTime} where coupon_id=#{couponId} and `tenant_id` = #{tenantId} and `parent_tenant_id` = #{parentTenantId} , c.remain_inventory,c.inventory,c.cover_img,c.sub_title,c.sale_price,c.detail, c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.use_limit_rule,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund,c.conditions, c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,c.valid_days,c.credit_price,c.content_type,c.source_type cc.id,cc.coupon_id,cc.target_ad,cc.begin_time,cc.end_time, c.tenant_id,c.parent_tenant_id,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.sale_price,c.use_price, c.use_limit_rule,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date, c.valid_days,c.detail,c.price,c.tail_price,c.orig_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,c.conditions,c.content_type, cc.qr_code cc.id,cc.coupon_id,c.remain_inventory,c.status update wx_coupon_channel SET status = 1, update_date = now() where status = 0 and tenant_id = #{tenantId} 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.tenant_id = #{tenantId} 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.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.status = 1 update wx_coupon_channel SET status = 1, update_date = now() where status = 0 and tenant_id = #{tenantId} and target_ad = 2 and end_time < now() update wx_coupon_channel set status = 1 where sub_target_id = #{id} update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and target_ad = 5 and type = 100