`id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`,
`summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`,
`appid`, `openid`, `time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `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_points_notify`,
`is_refund`, `order_status`, `refund_id`, `refund_amount`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `notice_id` = #{noticeId}
and `wx_mchid` = #{wxMchid}
and `wx_merchant_name` like concat('%', #{wxMerchantName},'%')
and `wx_shop_name` like concat('%', #{wxShopName},'%')
and `wx_shop_number` = #{wxShopNumber}
and `appid` = #{appid}
and `openid` = #{openid}
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_points_notify` = #{isPointsNotify}
and `is_refund` = #{isRefund}
and `order_status` = #{orderStatus}
and `refund_id` = #{refundId}
and `id` in
#{idItem}
INSERT INTO wx_business_circle_order (
`id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`,
`summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`,
`appid`, `openid`, `time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`,
`merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_points_notify`, `is_refund`
)
VALUES(
#{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType},
#{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber},
#{appid},#{openid},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime},
#{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,0,0
);
update wx_business_circle_order set
`earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime},
`update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}
update wx_business_circle_order set
`is_points_notify` = 1, `update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}
INSERT INTO wx_business_circle_order (
`id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`,
`summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`,
`appid`, `openid`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `commit_tag`, `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},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber},
#{appid},#{openid},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime},
#{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,1,#{refundId},#{refundAmount}
);
update wx_business_circle_order set
`order_status` = #{orderStatus},
`update_time` = #{updateTime}
where `id` = #{id} and `tenant_id` = #{tenantId}