`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`,
`verify_type`,`verify_remark`,`pay_vendor`,`send_merchant_id`,`send_merchant_user_id`,`compose_order_type`,`compose_order_id`,`coupon_number`,
`freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `coupon_id` = #{couponId}
and `coupon_type` = #{couponType}
and `c_user_id` = #{cUserId}
and `owner_id` = #{ownerId}
and `b_user_id` = #{bUserId}
and `order_id` = #{orderId}
and `expired_time` = #{expiredTime}
and `coupon_order_status` = #{couponOrderStatus}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `coupon_price` = #{couponPrice}
and `auto_refund` = #{autoRefund}
and `pay_vendor` = #{payVendor}
and `send_merchant_id` = #{sendMerchantId}
and `send_merchant_user_id` = #{sendMerchantUserId}
and `compose_order_type` = #{composeOrderType}
and `compose_order_id` = #{composeOrderId}
and `shipping_type` = #{shippingType}
and `shipping_status` = #{shippingStatus}
and id in
#{idItem}
order by ${sortColumns}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = #{bUserId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
where id=#{id} and `b_user_id` is null
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = #{bUserId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
where id=#{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `b_user_id` is null
and `b_user_id` = #{bUserId}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = #{bUserId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
where 1=1
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and id=#{id}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = null,
`update_date` = #{updateDate},
`verify_type` = null
where id=#{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
c.title,c.sale_price,c.use_price,c.price,
co.send_merchant_id,c.unit,c.auto_refund,c.business,c.subsidy_type,c.source_type,ms.subsidy subsidy_num,
(CASE WHEN couc.mc = 1 THEN m1.name ELSE '[多商户通用]' END) AS merchant_name,
(CASE WHEN couc.mc = 1 THEN m1.id ELSE 0 END) AS merchant_id,
cu.phone,m2.name AS verify_merchant_name,cal.channel_type
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark, co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,ms.subsidy subsidy_num,
bu.name, bu.phone as bphone,
cu.phone,
m.name as merchant_name,m.id as merchant_id
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
bu.name,
cu.phone
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
cu.phone
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.valid_type,c.valid_start_date,c.valid_end_date,c.auto_refund
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor,
c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,
json_extract(car.vendor_params,'$.id') as coupon_free_id,car.vendor_params
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,
c.cover_img,c.title,c.sub_title,c.detail,c.unit,c.remark,
a.amount,a.remaining_amount,a.support_transfer
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.cover_img,c.title,c.sub_title,c.sale_price,c.price,c.unit,c.detail,c.remark,
a.amount,a.remaining_amount,a.support_transfer
update wx_coupon_order set coupon_order_status = 4,update_date = now(), expired_time= #{expireTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5)