<?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.dsh.course.mapper.DriverPunishMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.dsh.guns.modular.system.model.DriverPunish">
|
<id column="id" property="id"/>
|
<result column="driverId" property="driverId"/>
|
<result column="punishTime" property="punishTime"/>
|
<result column="punishReason" property="punishReason"/>
|
<result column="punishReault" property="punishReault"/>
|
</resultMap>
|
|
|
<select id="queryAllPunish" resultType="com.dsh.guns.modular.system.model.DriverPunish">
|
select
|
id as id,
|
driverId as driverId,
|
punishTime as punishTime,
|
punishReason as punishReason,
|
punishReault as punishReault
|
from t_driver_punish where driverId = #{driverId}
|
</select>
|
<select id="getCanSelectCarList" resultType="java.util.Map">
|
SELECT * FROM (SELECT cm.`name` as modelName,cb.`name` as brandName,ds.serverStr,ci.* from t_car as ci
|
LEFT JOIN (select * from t_car_model where state = 1) as cm on cm.id = ci.carModelId
|
LEFT JOIN (select * from t_car_brand where state = 1) as cb on cb.id = ci.carBrandId
|
LEFT JOIN (
|
SELECT
|
GROUP_CONCAT(case when type = 1 then '摩托车'
|
when type = 2 then ''
|
when type = 3 then ''
|
when type = 4 then '同城快送'
|
when type = 5 then ''
|
when type = 6 then ''
|
else '' end ) as serverStr,carId from t_car_service GROUP BY carId) as ds on ds.carId = ci.id) as o
|
<where>
|
o.state = 1
|
<if test="carIdStr != null and carIdStr != ''">
|
and not FIND_IN_SET(o.id,#{carIdStr})
|
</if>
|
<if test="carLicensePlate != null and carLicensePlate != ''">
|
and o.carLicensePlate LIKE CONCAT('%',#{carLicensePlate},'%')
|
</if>
|
<if test="brandName != null and brandName != ''">
|
and o.brandName LIKE CONCAT('%',#{brandName},'%')
|
</if>
|
<if test="modelName != null and modelName != ''">
|
and o.modelName LIKE CONCAT('%',#{modelName},'%')
|
</if>
|
<if test="color != null and color != ''">
|
and o.carColor LIKE CONCAT('%',#{color},'%')
|
</if>
|
<if test="serverStr != null and serverStr != ''">
|
and o.serverStr LIKE CONCAT('%',#{serverStr},'%')
|
</if>
|
<if test="roleType != null and roleType != '' and roleType == 2">
|
and (o.companyId = #{objectId} or FIND_IN_SET(o.franchiseeId,(#{ids})))
|
</if>
|
<if test="roleType != null and roleType != '' and roleType == 3">
|
and o.franchiseeId = #{objectId}
|
</if>
|
</where>
|
order by o.id desc
|
</select>
|
</mapper>
|