package com.mandi.fendan.mapper; import com.mandi.fendan.persist.BusinessVehiclePerson; import org.apache.ibatis.annotations.*; import java.util.List; import java.util.Map; public interface BusinessVehiclePersonMapper { @Select("select * from BusinessVehiclePerson where businessNo=#{businessNo} and vehicleId=#{vehicleId}") List<BusinessVehiclePerson> selectList(@Param("businessNo")String businessNo, @Param("vehicleId")String vehicleId); @Select({ "<choose>" , "<when test=\"pagesize > 0 \">" , "select top ${pagesize} *" , "</when>" , "<otherwise>" , "select *" , "</otherwise>" , "</choose> from ( select row_number()" , "<choose>" , "<when test=\"sort!=null and sort!='' \">" , "over (order by ${sort} )" , "</when>" , "<otherwise>" , "over (order by a.id desc )" , "</otherwise>" , "</choose>" , "as rownumber,a.*", " select * from BusinessVehiclePerson ", ") as a where rownumber > #{pagesize}*#{page} order by a.rownumber asc " }) List<BusinessVehiclePerson> selectPage(Map<String,Object> map); @Select("select * from BusinessVehiclePerson where id=#{id}") BusinessVehiclePerson selectById(long id); @Insert({ "insert into BusinessVehiclePerson(vehicleId,businessNo,userName,idCard,phone,province,city,area,street,createTime,updateTime)", "values(#{vehicleId},#{businessNo},#{userName},#{idCard},#{phone},#{province},#{city},#{area},#{street},#{createTime},#{updateTime})" }) @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "Id") int insert(BusinessVehiclePerson businessVehiclePerson); @Update({"<script>", "update BusinessVehiclePerson <set>", "<if test=\"vehicleId!=null and vehicleId!=''\"> vehicleId=#{vehicleId},</if>", "<if test=\"businessNo!=null and businessNo!=''\"> businessNo=#{businessNo},</if>", "<if test=\"userName!=null and userName!=''\"> userName=#{userName},</if>", "<if test=\"idCard!=null and idCard!=''\"> idCard=#{idCard},</if>", "<if test=\"phone!=null and phone!=''\"> phone=#{phone},</if>", "<if test=\"province!=null and province!=''\"> province=#{province},</if>", "<if test=\"city!=null and city!=''\"> city=#{city},</if>", "<if test=\"area!=null and area!=''\"> area=#{area},</if>", "<if test=\"street!=null and street!=''\"> street=#{street},</if>", "<if test=\"createTime!=null and createTime!=''\"> createTime=#{createTime},</if>", "<if test=\"updateTime!=null and updateTime!=''\"> updateTime=#{updateTime},</if>", "</set> where id=#{id}", "</script>" }) int update(BusinessVehiclePerson businessVehiclePerson); @Delete("delete from BusinessVehiclePerson where id=#{id}") int delete(Long id); }