2020-11-30 20:44:38 +08:00
|
|
|
<?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">
|
2021-01-25 18:27:41 +08:00
|
|
|
update forest_bank_account set account_balance = account_balance - #{money} where bank_account = #{formBankAccount};
|
|
|
|
update forest_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
|
2020-11-30 20:44:38 +08:00
|
|
|
</update>
|
|
|
|
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
2021-02-24 09:17:21 +08:00
|
|
|
select * from forest_transaction_record where form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount} order by transaction_time desc
|
2020-11-30 20:44:38 +08:00
|
|
|
</select>
|
2021-02-20 16:55:12 +08:00
|
|
|
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
|
|
|
select ifnull((select false from forest_transaction_record where to_bank_account = #{bankAccount}
|
|
|
|
and funds = #{funds} and transaction_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d') limit 1), true)
|
|
|
|
</select>
|
2020-11-30 20:44:38 +08:00
|
|
|
</mapper>
|