hjg
2023-11-22 975c04c0181b3da82a79cb04abe6a2f1799eb363
提交 | 用户 | 时间
062075 1 package com.mandi.fendan.mapper;
A 2
3 import com.mandi.fendan.persist.BusinessVehiclePerson;
4 import org.apache.ibatis.annotations.*;
5
6 import java.util.List;
7 import java.util.Map;
8
9 public interface BusinessVehiclePersonMapper {
10     @Select("select * from BusinessVehiclePerson where businessNo=#{businessNo} and vehicleId=#{vehicleId}")
11     List<BusinessVehiclePerson> selectList(@Param("businessNo")String businessNo, @Param("vehicleId")String vehicleId);
12
13     @Select({ "<choose>" ,
14             "<when test=\"pagesize &gt; 0 \">" ,
15             "select top ${pagesize} *" ,
16             "</when>" ,
17             "<otherwise>" ,
18             "select *" ,
19             "</otherwise>" ,
20             "</choose> from ( select row_number()" ,
21             "<choose>" ,
22             "<when test=\"sort!=null and sort!='' \">" ,
23             "over (order by ${sort} )" ,
24             "</when>" ,
25             "<otherwise>" ,
26             "over (order by a.id desc )" ,
27             "</otherwise>" ,
28             "</choose>" ,
29             "as rownumber,a.*",
30             "  select * from BusinessVehiclePerson ",
31             ") as a where rownumber > #{pagesize}*#{page} order by a.rownumber asc "
32     })
33     List<BusinessVehiclePerson> selectPage(Map<String,Object> map);
34     
35     @Select("select * from BusinessVehiclePerson where id=#{id}")
36     BusinessVehiclePerson selectById(long id);
37     @Insert({
38             "insert into BusinessVehiclePerson(vehicleId,businessNo,userName,idCard,phone,province,city,area,street,createTime,updateTime)",
39             "values(#{vehicleId},#{businessNo},#{userName},#{idCard},#{phone},#{province},#{city},#{area},#{street},#{createTime},#{updateTime})"
40     })
41     @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "Id")
42     int insert(BusinessVehiclePerson businessVehiclePerson);
43
44     @Update({"<script>",
45             "update BusinessVehiclePerson <set>",
46             "<if test=\"vehicleId!=null and vehicleId!=''\"> vehicleId=#{vehicleId},</if>",
47             "<if test=\"businessNo!=null and businessNo!=''\"> businessNo=#{businessNo},</if>",
48             "<if test=\"userName!=null and userName!=''\"> userName=#{userName},</if>",
49             "<if test=\"idCard!=null and idCard!=''\"> idCard=#{idCard},</if>",
50             "<if test=\"phone!=null and phone!=''\"> phone=#{phone},</if>",
51             "<if test=\"province!=null and province!=''\"> province=#{province},</if>",
52             "<if test=\"city!=null and city!=''\"> city=#{city},</if>",
53             "<if test=\"area!=null and area!=''\"> area=#{area},</if>",
54             "<if test=\"street!=null and street!=''\"> street=#{street},</if>",
55             "<if test=\"createTime!=null and createTime!=''\"> createTime=#{createTime},</if>",
56             "<if test=\"updateTime!=null and updateTime!=''\"> updateTime=#{updateTime},</if>",
57             "</set> where id=#{id}",
58             "</script>"
59     })
60     int update(BusinessVehiclePerson businessVehiclePerson);
61
62     @Delete("delete from BusinessVehiclePerson where id=#{id}")
63     int delete(Long id);
64 }