<?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>
|