su.tenant_id_ = #{tenantId}
AND FIND_IN_SET(tpo.organ_id_,#{organId})
AND DATE_FORMAT(tpo.create_time_,'%Y-%m-%d') >= #{orderStartDate}
AND DATE_FORMAT(tpo.create_time_,'%Y-%m-%d') <= #{orderEndDate}
AND tpo.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
AND tpo.user_id_ = #{userId}
AND su.phone_ = #{phone}
AND tpo.payment_channel_ NOT IN (#{paymentChannel})
AND tpo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
INSERT INTO tenant_payment_order
(id_,activities_id_,user_id_,organ_id_,type_,trans_minutes_,give_minutes_,expect_amount_,actual_amount_,balance_payment_amount_,com_amount_,per_amount_,remit_fee_,trans_no_,status_,memo_,payment_channel_,payment_business_channel_,mer_nos_,order_no_,pay_time_,version_,create_time_,update_time_)
VALUES(#{id},#{activitiesId},#{userId},#{organId},#{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{transMinutes},#{giveMinutes},#{expectAmount},#{actualAmount},#{balancePaymentAmount},#{comAmount},#{perAmount},#{remitFee},#{transNo},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memo},#{paymentChannel},#{paymentBusinessChannel},#{merNos},#{orderNo},#{payTime},#{version},#{createTime},#{updateTime})
UPDATE tenant_payment_order
status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
trans_minutes_ = #{transMinutes},
give_minutes_ = #{giveMinutes},
organ_id_ = #{organId},
activities_id_ = #{activitiesId},
com_amount_ = #{comAmount},
order_no_ = #{orderNo},
id_ = #{id},
per_amount_ = #{perAmount},
expect_amount_ = #{expectAmount},
balance_payment_amount_ = #{balancePaymentAmount},
version_ = #{version},
memo_ = #{memo},
payment_channel_ = #{paymentChannel},
remit_fee_ = #{remitFee},
create_time_ = #{createTime},
user_id_ = #{userId},
payment_business_channel_ = #{paymentBusinessChannel},
update_time_ = #{updateTime},
trans_no_ = #{transNo},
actual_amount_ = #{actualAmount},
type_ = #{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
mer_nos_ = #{merNos},
pay_time_ = #{payTime},
WHERE id_ = #{id}
DELETE FROM tenant_payment_order WHERE id_ = #{id}