zhanghua
2022-11-16 0d02ee0aeeaa7c4df579a57b6f75e59c69a1ed26
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.mapper.carManage.CarEnforcecarMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.entity.carManage.CarEnforcecar">
        <id column="id" property="id"/>
        <result column="car_number" property="carNumber"/>
        <result column="owner_name" property="ownerName"/>
        <result column="vehicle_user" property="vehicleUser"/>
        <result column="contact" property="contact"/>
        <result column="trajectory" property="trajectory"/>
        <result column="depart_id" property="departId"/>
    </resultMap>
 
    <resultMap id="VoMap" type="com.ycl.dto.carManage.CarEnforcecarVo">
        <result column="depart_name" property="departName" jdbcType="VARCHAR"/>
        <result column="p_depart_name" property="pDepartName" jdbcType="VARCHAR"/>
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id
        , car_number, owner_name, vehicle_user, contact, trajectory, group
    </sql>
    <select id="searchEnforceCar" resultType="com.ycl.dto.carManage.CarEnforcecarVo">
        SELECT ce.*,IF(p.depart_name is null ,'',d.depart_name) depart_name,IFNULL(p.depart_name,d.depart_name)
        p_depart_name
        FROM ums_car_enforcecar ce
        LEFT JOIN ums_depart d on ce.depart_id = d.id
        LEFT JOIN ums_depart p on d.parent_id = p.id
        <where>
            <if test="carNum!=null">
                ce.car_number like CONCAT('%',#{carNum},'%')
            </if>
        </where>
        order by ce.id desc
        LIMIT #{offset}, #{size}
    </select>
 
</mapper>