`id`, `tenant_id`, `parent_tenant_id`, `source_app_id`, `shop_name`, `shop_number`,
`user_phone`, `user_number`, `time_end`, `amount`, `transaction_id`, `summary`,
`create_time`, `update_time`, `merchant_id`, `c_user_id`,
`earn_points`, `increased_points`, `points_update_time`,
`is_refund`, `refund_summary`, `refund_time`, `refund_amount`, `refund_id`,
`is_refund_points`, `refund_points_time`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `source_app_id` = #{sourceAppId}
and `shop_name` like concat('%', #{shopName},'%')
and `shop_number` = #{shopNumber}
and `user_phone` = #{userPhone}
and `user_number` = #{userNumber}
and `time_end` >= #{startTime}
and `time_end` < #{endTime}
and `transaction_id` = #{transactionId}
and `merchant_id` = #{merchantId}
and `c_user_id` = #{cUserId}
and `earn_points` = #{earnPoints}
and `is_refund` = #{isRefund}
and `refund_id` = #{refundId}
and `is_refund_points` = #{isRefundPoints}
and `id` in
#{idItem}
order by ${sortColumns}
INSERT INTO wx_business_circle_order (
`id`, `tenant_id`, `parent_tenant_id`, `source_app_id`,`shop_name`, `shop_number`,
`user_phone`, `user_number`, `time_end`, `amount`, `transaction_id`, `summary`,
`create_time`, `update_time`, `merchant_id`, `c_user_id`, `earn_points`, `is_refund`
)
VALUES(
#{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{shopName},#{shopNumber},
#{userPhone},#{userNumber},#{timeEnd},#{amount},#{transactionId},#{summary},
#{createTime},#{updateTime}, #{merchantId},#{cUserId},0,0
);
update wx_business_circle_order set
`earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime},
`is_refund_points` = 0, `update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}
update wx_business_circle_order set
`is_refund` = 1, `refund_summary` = #{refundSummary},
`refund_time` = #{refundTime}, `refund_amount` = #{refundAmount}, `refund_id` = #{refundId},
`update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}
update wx_business_circle_order set
`is_refund_points` = 1, `refund_points_time` = #{refundPointsTime}, `update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}