<?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="queryCarList" resultType="map">
|
select
|
a.id as id,
|
a.carLicensePlate as name,
|
if((
|
(select count(id) from t_order_private_car where isDelete = 1 and state in (6,7,8,9,10,12) and carId = a.id) +
|
(select count(id) from t_order_taxi where isDelete = 1 and state in (6,7,8,9,10,12) and carId = a.id) +
|
(select count(id) from t_order_cross_city where isDelete = 1 and state in (6,8,9,10,12) and carId = a.id)
|
) = 0, 1, 2) as state
|
from t_car a where a.state = 1 and if(a.franchiseeId is null or a.franchiseeId = 0, a.companyId = #{companyId}, a.franchiseeId = #{companyId})
|
</select>
|
|
|
<select id="queryCarInfo" resultType="map">
|
select
|
a.id as id,
|
c.`name` as brand,
|
d.`name` as carModel,
|
a.carColor as color,
|
if((
|
(select count(id) from t_order_private_car where isDelete = 1 and state in (6,7,8,9,10,12) and carId = a.id) +
|
(select count(id) from t_order_taxi where isDelete = 1 and state in (6,7,8,9,10,12) and carId = a.id) +
|
(select count(id) from t_order_cross_city where isDelete = 1 and state in (6,8,9,10,12) and carId = a.id)
|
) = 0, 1, 2) as state
|
from t_car a
|
left join t_car_brand c on (a.carBrandId = c.id)
|
left join t_car_model d on (a.carModelId = d.id)
|
where a.id = #{id}
|
</select>
|
</mapper>
|