`id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`,
`summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`,
`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`,
`merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`,
`earn_points`, `increased_points`, `points_update_time`,
`is_refund`, `order_status`, `refund_id`, `refund_amount`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `mall_store_id` = #{mallStoreId}
and `buyer_id` = #{buyerId}
and `notice_id` = #{noticeId}
and `time_end` >= #{startTime}
and `time_end` < #{endTime}
and `transaction_id` = #{transactionId}
and `merchant_id` = #{merchantId}
and `merchant_name` like concat('%', #{merchantName},'%')
and `c_user_id` = #{cUserId}
and `c_user_nick_name` like concat('%', #{cUserNickName},'%')
and `c_user_phone` like concat('%', #{cUserPhone},'%')
and `earn_points` = #{earnPoints}
and `is_refund` = #{isRefund}
and `order_status` = #{orderStatus}
and `refund_id` = #{refundId}
and `id` in
#{idItem}
INSERT INTO ali_business_circle_order (
`id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`,
`summary`, `mall_id`, `mall_name`, `mall_store_id`, `buyer_id`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`,
`merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund`
)
VALUES(
#{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType},
#{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime},
#{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,0
);
update ali_business_circle_order set
`earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime},
`update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}
INSERT INTO ali_business_circle_order (
`id`, `tenant_id`, `parent_tenant_id`,`notice_id`, `notice_create_time`, `notice_event_type`,
`summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`,
`merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund`, `refund_id`, `refund_amount`
)
VALUES(
#{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType},
#{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime},
#{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,1,#{refundId},#{refundAmount}
);
update ali_business_circle_order set
`order_status` = #{orderStatus},
`update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}