`id`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`credit_amount`,`credit_num`,`credit_type`,`create_date`,`receipt_url`,`operator_type`,`operator_id`,`merchant_id`,`coupon_id`,`business_id`,`spend`,`change_purpose`,`ticket_number`,`buser_id`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `c_user_id` = #{cUserId}
and `credit_amount` = #{creditAmount}
and `credit_num` = #{creditNum}
and `credit_type` = #{creditType}
and `receipt_url` like concat('%', #{receiptUrl},'%')
and `operator_type` = #{operatorType}
and `operator_id` = #{operatorId}
and `merchant_id` = #{merchantId}
and `coupon_id` = #{couponId}
and `business_id` = #{businessId}
and `spend` = #{spend}
and `change_purpose` = #{changePurpose}
and ticket_number like concat('%', #{ticketNumber},'%')
and `buser_id` = #{buserId}
and id in
#{idItem}
order by ${sortColumns}
where 1 = 1
and basic.nick_name like concat('%', #{name},'%')
and basic.phone like concat('%', #{phone},'%')
and credit.create_date >= #{startTime}
and credit.create_date < #{endTime}
and credit.`tenant_id` = #{tenantId}
and credit.`parent_tenant_id` = #{parentTenantId}
and credit.operator_type = #{operatorType}
and credit.operator_id = #{operatorId}
and credit.credit_type = #{creditType}
and credit.c_user_id = #{cUserId}
and credit.merchant_id = #{merchantId}
and merchant.name like concat('%', #{merchantName},'%')
and credit.ticket_number like concat('%', #{ticketNumber},'%')
and credit.buser_id = #{buserId}
update wx_credit_history
set c_user_id=#{newUserId}
where c_user_id = #{cUserId}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}