erp-java/seata/example/mapper/AccountMapper.java

24 lines
954 B
Java

package com.erp.example.seata.mapper;
import com.erp.example.seata.entity.Account;
import org.apache.ibatis.annotations.*;
@Mapper
public interface AccountMapper {
@Update("UPDATE account SET balance=#{balance}, frozen_amount=#{frozenAmount}, update_time=NOW() WHERE customer_id=#{customerId}")
void update(Account account);
@Select("SELECT * FROM account WHERE customer_id = #{customerId}")
@Results({
@Result(property = "id", column = "id"),
@Result(property = "customerId", column = "customer_id"),
@Result(property = "balance", column = "balance"),
@Result(property = "frozenAmount", column = "frozen_amount"),
@Result(property = "availableAmount", column = "available_amount"),
@Result(property = "currency", column = "currency"),
@Result(property = "updateTime", column = "update_time")
})
Account findByCustomerId(@Param("customerId") Long customerId);
}