`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`b_merchant_id`,`b_tenant_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`,
`verify_type`,`verify_remark`,`pay_vendor`,`pay_version`,`send_merchant_id`,`send_merchant_user_id`,`compose_order_type`,`compose_order_id`,`parent_coupon_order_id`,`coupon_number`,
`freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`,`subsidy`,`ext_param`
where `tenant_id` = #{tenantId}
and `id` = #{id}
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 `b_merchant_id` = #{bMerchantId}
and `b_tenant_id` = #{bTenantId}
and `a_user_id` = #{aUserId}
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 `pay_version` = #{payVersion}
and `send_merchant_id` = #{sendMerchantId}
and `send_merchant_user_id` = #{sendMerchantUserId}
and `compose_order_type` = #{composeOrderType}
and `compose_order_id` = #{composeOrderId}
and `parent_coupon_order_id` = #{parentCouponOrderId}
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},
`b_merchant_id` = #{bMerchantId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
,`shipping_status` = #{shippingStatus}
,`b_tenant_id` = #{bTenantId}
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},
`b_merchant_id` = #{bMerchantId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
,`shipping_status` = #{shippingStatus}
,`b_tenant_id` = #{bTenantId}
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},
`b_merchant_id` = #{bMerchantId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
,`shipping_status` = #{shippingStatus}
,`b_tenant_id` = #{bTenantId}
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,
`b_merchant_id` = null,
`update_date` = #{updateDate},
`verify_type` = null,
`b_tenant_id` = null
where id=#{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_coupon_order
set `subsidy` = #{subsidy}
where id=#{id}
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)