`id`,`tenant_id`,`parent_tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`pos_order_id`,
`deduction_amount`,`payment`,`real_payment`, `card_remain_amount`,
`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`,
`create_date`, `update_date`, `pay_status`, `pay_from`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `card_id` = #{cardId}
and `owner_id` = #{ownerId}
and `merchant_id` = #{merchantId}
and `order_id` = #{orderId}
and `pos_order_id` = #{posOrderId}
and `deduction_amount` = #{deductionAmount}
and `payment` = #{payment}
and `real_payment` = #{realPayment}
and `card_remain_amount` = #{cardRemainAmount}
and `card_before_amount` = #{cardBeforeAmount}
and `card_remain_real_amount` = #{cardRemainRealAmount}
and `card_before_real_amount` = #{cardBeforeRealAmount}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `pay_status` = #{payStatus}
and `pay_from` = #{payFrom}
and `create_date` between #{startdate} and #{enddate}
and id in
#{idItem}
order by ${sortColumns}
delete from wx_card_spend
where `tenant_id` = #{tenantId} and `id` = #{id} and `pay_status` = #{payStatus}
cs.`id`,cs.`tenant_id`,cs.`parent_tenant_id`,cs.`card_id`,cs.`owner_id`,cs.`merchant_id`,cs.`order_id`,cs.`deduction_amount`,cs.`payment`,cs.`real_payment`,
cs.`card_remain_amount`,cs.`card_before_amount`,cs.`card_remain_real_amount`,cs.`card_before_real_amount`,
cs.`create_date`,cs.`update_date`, cs.`pay_status`,
m.`name`, c.`title`,
ms.`subsidy`,ms.`real_subsidy`,ms.`status`,
ou.`nick_name` as onick_name, ou.`phone` as ou_phone
where 1 = 1
and cs.`id` = #{id}
and cs.`tenant_id` = #{tenantId}
and cs.`parent_tenant_id` = #{parentTenantId}
and cs.`card_id` = #{cardId}
and cs.`owner_id` = #{ownerId}
and cs.`merchant_id` = #{merchantId}
and cs.`order_id` = #{orderId}
and cs.`deduction_amount` = #{deductionAmount}
and cs.`payment` = #{payment}
and cs.`real_payment` = #{realPayment}
and cs.`card_remain_amount` = #{cardRemainAmount}
and cs.`card_before_amount` = #{cardBeforeAmount}
and cs.`card_remain_real_amount` = #{cardRemainRealAmount}
and cs.`card_before_real_amount` = #{cardBeforeRealAmount}
and cs.`pay_status` = #{payStatus}
and ms.`status` = #{status}
and ( ms.source is null or ms.source in
#{sourceItem}
)
and ( ms.card_spend_list_show is null or ms.card_spend_list_show = #{cardSpendListShow} )
and ou.`phone` = #{ouPhone}
and cs.`create_date` between #{startdate} and #{enddate}
and cs.`pay_status` in
#{sItem}
and cs.id in
#{idItem}