罗元桥
2021-05-25 b24f9c75c79e4de248505295bfea7055e4975ff4
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
65
66
67
68
package com.panzhihua.service_community.dao;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.PageComMngCarDTO;
import com.panzhihua.common.model.vos.community.ComMngCarVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationCarVO;
import com.panzhihua.service_community.model.dos.ComMngCarDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * @description: 车辆管理
 * @author: Null
 * @date: 2021/3/16 14:28
 */
@Mapper
public interface ComMngCarDAO extends BaseMapper<ComMngCarDO> {
 
    @Select("<script> " +
            " SELECT " +
            " t.id, " +
            " t.community_id AS communityId, " +
            " t1.`name` AS communityName, " +
            " t.area_id AS areaId, " +
            " t2.area_name AS areaName, " +
            " t.user_id userId, " +
            " t.user_name AS userName, " +
            " t.address, " +
            " t.mobile, " +
            " t.plate_num AS plateNum, " +
            " t.brand, " +
            " t.color, " +
            " t.create_at AS createAt, " +
            " t3.`name` AS createBy  " +
            "FROM " +
            " com_mng_car t " +
            " LEFT JOIN com_act t1 ON t.community_id = t1.community_id " +
            " LEFT JOIN com_mng_struct_area t2 ON t2.id = t.area_id " +
            " LEFT JOIN sys_user t3 ON t.create_by = t3.user_id " +
            " WHERE 1=1" +
            "<if test='pageComMngCarDTO.name != null and pageComMngCarDTO.name != &quot;&quot;'>" +
            " and t.user_name LIKE concat( '%',#{pageComMngCarDTO.name}, '%' )  " +
            " </if> " +
            "<if test='pageComMngCarDTO.villageId != null'>" +
            " and t.area_id = #{pageComMngCarDTO.villageId} " +
            " </if> " +
            "<if test='pageComMngCarDTO.communityId != null and pageComMngCarDTO.communityId != 0'>" +
            " and t.community_id = #{pageComMngCarDTO.communityId} " +
            " </if> " +
            "<if test='pageComMngCarDTO.areaName != null'>" +
            " and t2.area_name LIKE concat( '%',#{pageComMngCarDTO.areaName}, '%' )  " +
            " </if> " +
            " order by t.create_at desc" +
            "</script>")
    IPage<ComMngCarVO> pageQueryComMngCar(Page page, @Param(value = "pageComMngCarDTO") PageComMngCarDTO pageComMngCarDTO);
 
    @Select("select cmc.id,cmc.plate_num,cmc.color,cmc.brand from com_mng_car as cmc " +
            " left join sys_user as su on su.user_id = cmc.user_id " +
            " where su.id_card = #{idCard}")
    List<ComMngPopulationCarVO> getPopulationCarListByIdCard(@Param(value = "idCard") String idCard);
 
 
}