package com.example.demo.mapper; import com.example.demo.domain.entity.Rate; import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface RateMapper { @Insert({ "insert into rate", "(start_time,end_time,currency,exchange_rate,create_time,update_time,admin_id,flag)", "values", "(#{startTime},#{endTime},#{currency},#{exchangeRate},now(),#{updateTime},#{adminId},1)" }) // 获取自增主键 @Options(useGeneratedKeys = true,keyColumn = "rate_id",keyProperty = "rateId") int insert(Rate rate); //软删除 @Update({ "update rate set flag = 0 where rate_id=#{rateId}" }) int deleteById(Integer rateId); @Update({ "" }) int update(Rate rate); @Select({ "select * from rate where rate_id=#{rateId}" }) Rate selectById(Integer rateId); @Select({ "" }) List select(Rate rate); }