forest/src/main/java/mapper/TransactionRecordMapper.xml
2020-11-30 20:44:38 +08:00

21 lines
1.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.rymcu.forest.mapper.TransactionRecordMapper">
<resultMap id="DTOResultMap" type="com.rymcu.forest.dto.TransactionRecordDTO">
<result column="id" property="idTransactionRecord"></result>
<result column="transaction_no" property="transactionNo"></result>
<result column="funds" property="funds"></result>
<result column="form_bank_account" property="formBankAccount"></result>
<result column="to_bank_account" property="toBankAccount"></result>
<result column="money" property="money"></result>
<result column="transaction_type" property="transactionType"></result>
<result column="transaction_time" property="transactionTime"></result>
</resultMap>
<update id="transfer">
update vertical_bank_account set account_balance = account_balance - #{money} where bank_account = #{formBankAccount};
update vertical_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
</update>
<select id="selectTransactionRecords" resultMap="DTOResultMap">
select * from vertical_transaction_record where form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount}
</select>
</mapper>