xuhy
2025-01-09 c16f3bf0b16707214c3ad8acadbe5b77d35d4ccf
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
69
70
71
<?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.stylefeng.guns.modular.system.dao.CarMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Car">
        <id column="id" property="id"/>
        <result column="isPlatCar" property="isPlatCar"/>
        <result column="companyId" property="companyId"/>
        <result column="franchiseeId" property="franchiseeId"/>
        <result column="carColor" property="carColor"/>
        <result column="carModelId" property="carModelId"/>
        <result column="carBrandId" property="carBrandId"/>
        <result column="carLicensePlate" property="carLicensePlate"/>
        <result column="carPhoto" property="carPhoto"/>
        <result column="drivingLicenseNumber" property="drivingLicenseNumber"/>
        <result column="drivingLicensePhoto" property="drivingLicensePhoto"/>
        <result column="annualInspectionTime" property="annualInspectionTime"/>
        <result column="insurancePhoto" property="insurancePhoto" />
        <result column="commercialInsuranceTime" property="commercialInsuranceTime"/>
        <result column="insertTime" property="insertTime"/>
        <result column="state" property="state"/>
        <result column="addType" property="addType"/>
        <result column="addObjectId" property="addObjectId"/>
    </resultMap>
 
 
 
    <select id="queryIdleData" resultType="map">
        select
        a.id as id,
        CONCAT(a.carLicensePlate, '-',c.`name`, b.`name`, ' ', a.carColor) as name
        from t_car a
        left join t_car_model b on (a.carModelId = b.id)
        left join t_car_brand c on (b.brandId = c.id)
        where a.state = 1
        <choose>
            <when test="companyId != 1">
                and  a.companyId = #{companyId} or a.franchiseeId = #{companyId}
            </when>
            <otherwise>
                and a.isPlatCar = 1
            </otherwise>
 
        </choose>
    </select>
 
 
    <select id="query" resultType="com.stylefeng.guns.modular.system.model.Car">
        select
        id as id,
        isPlatCar as isPlatCar,
        companyId as companyId,
        franchiseeId as franchiseeId,
        carColor as carColor,
        carModelId as carModelId,
        carBrandId as carBrandId,
        carLicensePlate as carLicensePlate,
        carPhoto as carPhoto,
        drivingLicenseNumber as drivingLicenseNumber,
        drivingLicensePhoto as drivingLicensePhoto,
        annualInspectionTime as annualInspectionTime,
        insurancePhoto as insurancePhoto,
        commercialInsuranceTime as commercialInsuranceTime,
        insertTime as insertTime,
        state as state,
        addType as addType,
        addObjectId as addObjectId
        from t_car where state = 1 and carLicensePlate = #{licensePlate}
    </select>
</mapper>