hjg
2023-10-08 a966b5abe5fb804464fe1cd09053a03fe94877fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 &gt; 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);
}