| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <?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.sckw.fleet.dao.KwfDriverMapper">
- <select id="statisticsAll" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" parameterType="java.util.Map" >
- SELECT
- dr.`auth_status` value, count(0) total
- from kwf_driver dr
- left join kwf_driver_card drc on drc.driver_id = dr.id and drc.del_flag = 0
- left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
- left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
- where dr.del_flag = 0
- <if test="entId != null and entId != ''">
- and dr.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and dr.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="idcard != null and idcard != ''">
- and dr.idcard = #{idcard, jdbcType=VARCHAR}
- </if>
- <if test="phone != null and phone != ''">
- and dr.phone = #{phone, jdbcType=VARCHAR}
- </if>
- <if test="licenseType != null and licenseType != ''">
- and drl.type = #{licenseType, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <if test="keywords != null and keywords != ''">
- and (
- dr.name like concat('%',#{keywords},'%')
- or dr.phone like concat('%',#{keywords},'%')
- )
- </if>
- GROUP BY dr.`auth_status`
- </select>
- <select id="statistics" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" parameterType="java.util.Map" >
- SELECT
- dr.`auth_status` value, count(0) total
- from kwf_driver dr
- left join kwf_driver_ent dre on dre.driver_id = dr.id
- left join kwf_driver_card drc on drc.driver_id = dr.id and drc.del_flag = 0
- left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
- left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
- left join kwf_fleet_driver flr on flr.driver_id = dr.id and flr.del_flag = 0
- left join kwf_fleet fl on fl.id = flr.fleet_id and fl.del_flag = 0
- where dr.del_flag = 0 and dre.del_flag = 0
- <if test="entId != null and entId != ''">
- and dre.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and dr.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="idcard != null and idcard != ''">
- and dr.idcard = #{idcard, jdbcType=VARCHAR}
- </if>
- <if test="phone != null and phone != ''">
- and dr.phone = #{phone, jdbcType=VARCHAR}
- </if>
- <if test="licenseType != null and licenseType != ''">
- and drl.type = #{licenseType, jdbcType=VARCHAR}
- </if>
- <if test="fleetId != null and fleetId != ''">
- and fl.id = #{fleetId, jdbcType=VARCHAR}
- </if>
- <if test="fleetName != null and fleetName != ''">
- and fl.name like concat('%',#{fleetName},'%')
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <if test="noReport != null and noReport != ''">
- and dr.id not in (
- select driver_id from kwf_truck_report where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR}
- )
- </if>
- <if test="keywords != null and keywords != ''">
- and (
- dr.name like concat('%',#{keywords},'%')
- or dr.phone like concat('%',#{keywords},'%')
- )
- </if>
- GROUP BY dr.`auth_status`
- </select>
- <select id="findPageAll" resultType="com.sckw.fleet.model.vo.KwfDriverVo" parameterType="java.util.Map" >
- SELECT
- dr.id, dr.name, dr.phone, dr.idcard, dr.status, dr.auth_status authStatus, drc.expire_time idcardExpireTime,
- drc.address, drl.driver_no driverNo, drl.type licenseType, drl.expire_time licenseExpireTime,
- drl.grant_unit licenseGrantUnit,drq.quali_no qualiNo, dr.ent_id entId, dr.create_by createBy,
- dr.create_time createTime,dr.update_time updateTime, dr.remark
- from kwf_driver dr
- left join kwf_driver_card drc on drc.driver_id = dr.id and drc.del_flag = 0
- left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
- left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
- where dr.del_flag = 0
- <if test="entId != null and entId != ''">
- and dr.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and dr.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="idcard != null and idcard != ''">
- and dr.idcard = #{idcard, jdbcType=VARCHAR}
- </if>
- <if test="phone != null and phone != ''">
- and dr.phone = #{phone, jdbcType=VARCHAR}
- </if>
- <if test="licenseType != null and licenseType != ''">
- and drl.type = #{licenseType, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and dr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and authStatus != '' and authStatus != 0">
- and dr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <choose>
- <when test="ids != null and ids != '' and ids.size() > 0">
- and dr.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id,jdbcType=BIGINT}
- </foreach>
- </when>
- </choose>
- <if test="keywords != null and keywords != ''">
- and (
- dr.name like concat('%',#{keywords},'%')
- or dr.phone like concat('%',#{keywords},'%')
- )
- </if>
- ORDER BY dr.create_time desc
- </select>
- <select id="findPage" resultType="com.sckw.fleet.model.vo.KwfDriverVo" parameterType="java.util.Map" >
- SELECT
- dr.id, dr.name, dr.phone, dr.idcard, dr.status, dr.auth_status authStatus, drc.expire_time idcardExpireTime,
- drc.address, drl.driver_no driverNo, drl.type licenseType, drl.expire_time licenseExpireTime,
- drl.grant_unit licenseGrantUnit,drq.quali_no qualiNo, dr.ent_id entId, dr.create_by createBy,
- dr.create_time createTime,dr.update_time updateTime, dr.remark, fl.id fleetId, fl.name fleetName
- from kwf_driver dr
- left join kwf_driver_ent dre on dre.driver_id = dr.id
- left join kwf_driver_card drc on drc.driver_id = dr.id and drc.del_flag = 0
- left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
- left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
- left join kwf_fleet_driver flr on flr.driver_id = dr.id and flr.del_flag = 0
- left join kwf_fleet fl on fl.id = flr.fleet_id and fl.del_flag = 0
- where dr.del_flag = 0 and dre.del_flag = 0
- <if test="entId != null and entId != ''">
- and dre.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and dr.name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="idcard != null and idcard != ''">
- and dr.idcard = #{idcard, jdbcType=VARCHAR}
- </if>
- <if test="phone != null and phone != ''">
- and dr.phone = #{phone, jdbcType=VARCHAR}
- </if>
- <if test="licenseType != null and licenseType != ''">
- and drl.type = #{licenseType, jdbcType=VARCHAR}
- </if>
- <if test="fleetId != null and fleetId != ''">
- and fl.id = #{fleetId, jdbcType=VARCHAR}
- </if>
- <if test="fleetName != null and fleetName != ''">
- and fl.name like concat('%',#{fleetName},'%')
- </if>
- <if test="status != null and status != ''">
- and dr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and authStatus != '' and authStatus != 0">
- and dr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <if test="noReport != null and noReport != ''">
- and dr.id not in (
- select driver_id from kwf_truck_report where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR}
- )
- </if>
- <choose>
- <when test="ids != null and ids != '' and ids.size() > 0">
- and dr.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id,jdbcType=BIGINT}
- </foreach>
- </when>
- </choose>
- <if test="keywords != null and keywords != ''">
- and (
- dr.name like concat('%',#{keywords},'%')
- or dr.phone like concat('%',#{keywords},'%')
- )
- </if>
- ORDER BY dr.create_time desc
- </select>
- <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
- SELECT
- dr.id, name, phone, salt, password, idcard, total_complete totalComplete,
- total_take totalTake, total_weight totalWeight, dre.ent_id entId
- from kwf_driver dr
- left join kwf_driver_ent dre on dre.driver_id = dr.id
- where dr.del_flag = 0 and dre.del_flag = 0
- <if test="entId != null and entId != ''">
- and dre.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and dr.name like concat('%',#{name},'%')
- </if>
- <if test="wholeName != null and wholeName != ''">
- and dr.name = #{wholeName, jdbcType=VARCHAR}
- </if>
- <if test="idcard != null and idcard != ''">
- and dr.idcard = #{idcard, jdbcType=VARCHAR}
- </if>
- <if test="phone != null and phone != ''">
- and dr.phone = #{phone, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and dr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and authStatus != '' and authStatus != 0">
- and dr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- <if test="noReport != null and noReport != ''">
- and dr.id not in (
- select driver_id from kwf_truck_report where del_flag = 0 and ent_id = #{entId, jdbcType=VARCHAR}
- )
- </if>
- <choose>
- <when test="ids != null and ids != '' and ids.size() > 0">
- and dr.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id,jdbcType=BIGINT}
- </foreach>
- </when>
- </choose>
- <if test="keywords != null and keywords != ''">
- and (
- dr.name like concat('%',#{keyWords},'%')
- or dr.idcard like concat('%',#{keywords},'%')
- or dr.phone like concat('%',#{keywords},'%')
- )
- </if>
- ORDER BY dr.create_time desc
- </select>
- <select id="findDriver" resultType="com.sckw.fleet.model.KwfDriver" parameterType="java.util.Map" >
- SELECT
- id, ent_id entId, name, phone, salt, password, idcard, total_complete totalComplete,
- total_take totalTake, total_weight totalWeight, business_status businessStatus, remark, status
- from kwf_driver dr
- where dr.del_flag = 0
- <if test="entId != null and entId != ''">
- and ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="name != null and name != ''">
- and name = #{name, jdbcType=VARCHAR}
- </if>
- <if test="idcard != null and idcard != ''">
- and idcard = #{idcard, jdbcType=VARCHAR}
- </if>
- <if test="phone != null and phone != ''">
- and phone = #{phone, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and authStatus != '' and authStatus != 0">
- and dr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- ORDER BY create_time desc
- </select>
- <select id="findEntDriver" resultType="com.sckw.fleet.model.KwfDriver" parameterType="com.sckw.fleet.model.KwfDriver" >
- SELECT
- dr.id, name, phone, salt, password, idcard, total_complete totalComplete,
- total_take totalTake, total_weight totalWeight, dre.ent_id entId
- from kwf_driver dr
- left join kwf_driver_ent dre on dre.driver_id = dr.id
- where dr.del_flag = 0 and dre.del_flag = 0
- and dre.ent_id = #{entId, jdbcType=VARCHAR}
- and dr.id = #{id, jdbcType=VARCHAR}
- </select>
- <select id="driverStatistics" resultType="java.util.Map" >
- select
- tabA.abnormalTotal, tabB.idleTotal, tabC.inTaskTotal, (tabB.idleTotal + tabC.inTaskTotal) allTotal
- from
- (SELECT
- count(1) abnormalTotal, '' indexNum
- from kwf_driver tr
- left join kwf_driver_ent tre on tre.driver_id = tr.id
- where tr.del_flag = 0 and tre.del_flag = 0 and tr.auth_status = 3 and tre.ent_id = #{entId, jdbcType=BIGINT}
- ) tabA
- left join
- (SELECT
- count(1) idleTotal, '' indexNum
- from kwf_driver tr
- left join kwf_driver_ent tre on tre.driver_id = tr.id
- where tr.del_flag = 0 and tre.del_flag = 0 and tr.business_status = 0 and tre.ent_id = #{entId, jdbcType=BIGINT}
- ) tabB on tabB.indexNum = tabA.indexNum
- left join
- (SELECT
- count(1) inTaskTotal, '' indexNum
- from kwf_driver tr
- left join kwf_driver_ent tre on tre.driver_id = tr.id
- where tr.del_flag = 0 and tre.del_flag = 0 and tr.business_status = 1 and tre.ent_id = #{entId, jdbcType=BIGINT}
- ) tabC on tabC.indexNum = tabA.indexNum
- </select>
- </mapper>
|