交易分账 重构

This commit is contained in:
2023-08-28 10:12:35 +08:00
parent eb3a1b9e00
commit f7803b5ef2
3 changed files with 75 additions and 22 deletions

View File

@@ -12,6 +12,7 @@
<result column="pay_amt" jdbcType="DECIMAL" property="payAmt" />
<result column="refund_amt" jdbcType="DECIMAL" property="refundAmt" />
<result column="spend_amt" jdbcType="DECIMAL" property="spendAmt" />
<result column="freeze_amt" jdbcType="DECIMAL" property="freezeAmt" />
<result column="balance_amt" jdbcType="DECIMAL" property="balanceAmt" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -22,7 +23,8 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, member_id, scenario_type, payment_id, payment_order_no, pay_amt, refund_amt,
spend_amt, balance_amt, create_by, create_time, update_by, update_time, del_flag
spend_amt, freeze_amt, balance_amt, create_by, create_time, update_by, update_time,
del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
@@ -56,6 +58,9 @@
<if test="spendAmt != null">
spend_amt,
</if>
<if test="freezeAmt != null">
freeze_amt,
</if>
<if test="balanceAmt != null">
balance_amt,
</if>
@@ -97,6 +102,9 @@
<if test="spendAmt != null">
#{spendAmt,jdbcType=DECIMAL},
</if>
<if test="freezeAmt != null">
#{freezeAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
#{balanceAmt,jdbcType=DECIMAL},
</if>
@@ -142,6 +150,9 @@
<if test="spendAmt != null">
spend_amt = #{spendAmt,jdbcType=DECIMAL},
</if>
<if test="freezeAmt != null">
freeze_amt = #{freezeAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
balance_amt = #{balanceAmt,jdbcType=DECIMAL},
</if>
@@ -202,6 +213,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.spendAmt,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="freeze_amt = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.freezeAmt,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="balance_amt = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.balanceAmt,jdbcType=DECIMAL}
@@ -242,14 +258,15 @@
<!--@mbg.generated-->
insert into member_adapay_record
(member_id, scenario_type, payment_id, payment_order_no, pay_amt, refund_amt, spend_amt,
balance_amt, create_by, create_time, update_by, update_time, del_flag)
freeze_amt, balance_amt, create_by, create_time, update_by, update_time, del_flag
)
values
<foreach collection="list" item="item" separator=",">
(#{item.memberId,jdbcType=VARCHAR}, #{item.scenarioType,jdbcType=VARCHAR}, #{item.paymentId,jdbcType=VARCHAR},
#{item.paymentOrderNo,jdbcType=VARCHAR}, #{item.payAmt,jdbcType=DECIMAL}, #{item.refundAmt,jdbcType=DECIMAL},
#{item.spendAmt,jdbcType=DECIMAL}, #{item.balanceAmt,jdbcType=DECIMAL}, #{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.delFlag,jdbcType=VARCHAR})
#{item.spendAmt,jdbcType=DECIMAL}, #{item.freezeAmt,jdbcType=DECIMAL}, #{item.balanceAmt,jdbcType=DECIMAL},
#{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR},
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberAdapayRecord" useGeneratedKeys="true">
@@ -266,6 +283,7 @@
pay_amt,
refund_amt,
spend_amt,
freeze_amt,
balance_amt,
create_by,
create_time,
@@ -285,6 +303,7 @@
#{payAmt,jdbcType=DECIMAL},
#{refundAmt,jdbcType=DECIMAL},
#{spendAmt,jdbcType=DECIMAL},
#{freezeAmt,jdbcType=DECIMAL},
#{balanceAmt,jdbcType=DECIMAL},
#{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
@@ -304,6 +323,7 @@
pay_amt = #{payAmt,jdbcType=DECIMAL},
refund_amt = #{refundAmt,jdbcType=DECIMAL},
spend_amt = #{spendAmt,jdbcType=DECIMAL},
freeze_amt = #{freezeAmt,jdbcType=DECIMAL},
balance_amt = #{balanceAmt,jdbcType=DECIMAL},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
@@ -340,6 +360,9 @@
<if test="spendAmt != null">
spend_amt,
</if>
<if test="freezeAmt != null">
freeze_amt,
</if>
<if test="balanceAmt != null">
balance_amt,
</if>
@@ -385,6 +408,9 @@
<if test="spendAmt != null">
#{spendAmt,jdbcType=DECIMAL},
</if>
<if test="freezeAmt != null">
#{freezeAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
#{balanceAmt,jdbcType=DECIMAL},
</if>
@@ -430,6 +456,9 @@
<if test="spendAmt != null">
spend_amt = #{spendAmt,jdbcType=DECIMAL},
</if>
<if test="freezeAmt != null">
freeze_amt = #{freezeAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
balance_amt = #{balanceAmt,jdbcType=DECIMAL},
</if>
@@ -477,7 +506,7 @@
from member_adapay_record
where del_flag = '0'
and scenario_type = 'balance'
and balance_amt > '0.00'
and balance_amt &gt; '0.00'
and member_id = #{memberId,jdbcType=VARCHAR}
</select>
</mapper>