| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- <?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.KwfTruckMapper">
- <select id="statisticsAll" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" parameterType="java.util.Map" >
- SELECT
- tr.`auth_status` value, count(0) total
- from kwf_truck tr
- left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
- left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
- where tr.del_flag = 0
- <if test="entId != null and entId != ''">
- and tr.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="truckNo != null and truckNo != ''">
- and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- <if test="type != null and type != ''">
- and tr.type = #{type, jdbcType=VARCHAR}
- </if>
- <if test="energyType != null and energyType != ''">
- and tr.energy_type = #{energyType, jdbcType=VARCHAR}
- </if>
- <if test="useType != null and useType != ''">
- and tr.use_type = #{useType, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and tr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <if test="keywords != null and keywords != ''">
- and (
- tr.truck_no like concat('%',#{keywords},'%')
- )
- </if>
- GROUP BY tr.`auth_status`
- </select>
- <select id="statistics" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" parameterType="java.util.Map" >
- SELECT
- tr.`auth_status` value, count(0) total
- from kwf_truck tr
- left join kwf_truck_ent tre on tre.truck_id = tr.id
- left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
- left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
- left join kwf_fleet_truck flt on flt.truck_id = tr.id and flt.del_flag = 0
- left join kwf_fleet fl on fl.id = flt.fleet_id and fl.del_flag = 0
- where tr.del_flag = 0 and tre.del_flag = 0
- <if test="entId != null and entId != ''">
- and tre.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="truckNo != null and truckNo != ''">
- and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- <if test="type != null and type != ''">
- and tr.type = #{type, jdbcType=VARCHAR}
- </if>
- <if test="energyType != null and energyType != ''">
- and tr.energy_type = #{energyType, jdbcType=VARCHAR}
- </if>
- <if test="useType != null and useType != ''">
- and tr.use_type = #{useType, 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 tr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <if test="keywords != null and keywords != ''">
- and (
- tr.truck_no like concat('%',#{keywords},'%')
- )
- </if>
- GROUP BY tr.`auth_status`
- </select>
- <select id="findPageAll" resultType="com.sckw.fleet.model.vo.KwfTruckVo" parameterType="java.util.Map" >
- SELECT
- tr.id, tr.ent_id entId, tr.truck_no truckNo, tr.type, tr.energy_type energyType, tr.use_type useType,
- tr.spec, tr.actual_weight actualWeight, tr.gross_weight grossWeight, tr.tare_weight tareWeight,
- tr.color, tr.eev, tr.trailer_no trailerNo, tr.total_complete totalComplete, tr.total_take totalTake,
- tr.total_weight totalWeight, tr.business_status businessStatus, tr.remark, tr.status, tr.auth_status authStatus,
- tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime,
- trl.owner, trl.vin, trl.reg_time regTime, trl.grant_time grantTime, trl.grant_unit grantUnit,
- trl.driving_no drivingNo, tranl.road_tran_no roadTranNo, tranl.firm_name tranFirmName,
- tranl.business_license_no businessLicenseNo
- from kwf_truck tr
- left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
- left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
- where tr.del_flag = 0
- <if test="entId != null and entId != ''">
- and tr.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="truckNo != null and truckNo != ''">
- and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- <if test="truckType != null and truckType != ''">
- and tr.type = #{type, jdbcType=VARCHAR}
- </if>
- <if test="energyType != null and energyType != ''">
- and tr.energy_type = #{energyType, jdbcType=VARCHAR}
- </if>
- <if test="useType != null and useType != ''">
- and tr.use_type = #{useType, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and tr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and status != ''">
- and tr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <choose>
- <when test="ids != null">
- and tr.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id,jdbcType=BIGINT}
- </foreach>
- </when>
- </choose>
- <if test="keywords != null and keywords != ''">
- and (
- tr.truck_no like concat('%',#{keywords},'%')
- )
- </if>
- ORDER BY tr.create_time desc
- </select>
- <select id="findPage" resultType="com.sckw.fleet.model.vo.KwfTruckVo" parameterType="java.util.Map" >
- SELECT
- tr.id, tr.ent_id entId, tr.truck_no truckNo, tr.type, tr.energy_type energyType, tr.use_type useType,
- tr.spec, tr.actual_weight actualWeight, tr.gross_weight grossWeight, tr.tare_weight tareWeight,
- tr.color, tr.eev, tr.trailer_no trailerNo, tr.total_complete totalComplete, tr.total_take totalTake,
- tr.total_weight totalWeight, tr.business_status businessStatus, tr.remark, tr.status, tr.auth_status authStatus,
- tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime,
- trl.owner, trl.vin, trl.reg_time regTime, trl.grant_time grantTime, trl.grant_unit grantUnit,
- trl.driving_no drivingNo, tranl.road_tran_no roadTranNo, tranl.firm_name tranFirmName,
- tranl.business_license_no businessLicenseNo, fl.`name` fleetName
- from kwf_truck tr
- left join kwf_truck_ent tre on tre.truck_id = tr.id
- left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
- left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
- left join kwf_fleet_truck flt on flt.truck_id = tr.id and flt.del_flag = 0
- left join kwf_fleet fl on fl.id = flt.fleet_id and fl.del_flag = 0
- where tr.del_flag = 0 and tre.del_flag = 0
- <if test="entId != null and entId != ''">
- and tre.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="truckNo != null and truckNo != ''">
- and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- <if test="truckType != null and truckType != ''">
- and tr.type = #{type, jdbcType=VARCHAR}
- </if>
- <if test="energyType != null and energyType != ''">
- and tr.energy_type = #{energyType, jdbcType=VARCHAR}
- </if>
- <if test="useType != null and useType != ''">
- and tr.use_type = #{useType, 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 tr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and status != ''">
- and tr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <choose>
- <when test="ids != null">
- and tr.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id,jdbcType=BIGINT}
- </foreach>
- </when>
- </choose>
- <if test="keywords != null and keywords != ''">
- and (
- tr.truck_no like concat('%',#{keywords},'%')
- )
- </if>
- ORDER BY tr.create_time desc
- </select>
- <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
- SELECT
- tr.id, tre.ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
- spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
- color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
- total_weight totalWeight, business_status businessStatus, tr.remark, tr.status, tr.auth_status authStatus,
- tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime
- from kwf_truck tr
- left join kwf_truck_ent tre on tre.truck_id = tr.id
- where tr.del_flag = 0 and tre.del_flag = 0
- <if test="entId != null and entId != ''">
- and tre.ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="truckNo != null and truckNo != ''">
- and tr.truck_no like concat('%',#{truckNo},'%')
- </if>
- <if test="wholeTruckNo != null and wholeTruckNo != ''">
- and tr.truck_no = #{wholeTruckNo, jdbcType=VARCHAR}
- </if>
- <if test="type != null and type != ''">
- and tr.type = #{type, jdbcType=VARCHAR}
- </if>
- <if test="energyType != null and energyType != ''">
- and tr.energy_type = #{energyType, jdbcType=VARCHAR}
- </if>
- <if test="useType != null and useType != ''">
- and tr.use_type = #{useType, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and tr.status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and status != ''">
- and tr.auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- <if test="startTime != null and startTime != '' " >
- and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null and endTime != '' " >
- and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- <choose>
- <when test="truckNos != null and truckNos != ''">
- and tr.truck_no in
- <foreach collection="truckNos" item="truckNo" open="(" close=")" separator=",">
- #{truckNo,jdbcType=VARCHAR}
- </foreach>
- </when>
- </choose>
- <if test="keywords != null and keywords != ''">
- and (
- tr.truck_no like concat('%',#{keywords},'%')
- )
- </if>
- ORDER BY tr.create_time desc
- </select>
- <select id="findTruck" resultType="com.sckw.fleet.model.KwfTruck" parameterType="java.util.Map" >
- SELECT
- id, ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
- spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
- color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
- total_weight totalWeight, business_status businessStatus, remark, status, auth_status authStatus
- from kwf_truck tr
- where del_flag = 0
- <if test="entId != null and entId != ''">
- and ent_id = #{entId, jdbcType=VARCHAR}
- </if>
- <if test="truckNo != null and truckNo != ''">
- and truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- <if test="type != null and type != ''">
- and type = #{type, jdbcType=VARCHAR}
- </if>
- <if test="energyType != null and energyType != ''">
- and energy_type = #{energyType, jdbcType=VARCHAR}
- </if>
- <if test="useType != null and useType != ''">
- and use_type = #{useType, jdbcType=VARCHAR}
- </if>
- <if test="status != null and status != ''">
- and status = #{status, jdbcType=VARCHAR}
- </if>
- <if test="authStatus != null and status != ''">
- and auth_status = #{authStatus, jdbcType=VARCHAR}
- </if>
- ORDER BY create_time desc
- </select>
- <select id="findEntTruck" resultType="com.sckw.fleet.model.KwfTruck" parameterType="com.sckw.fleet.model.KwfTruck" >
- SELECT
- tr.id, tre.ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
- spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
- color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
- total_weight totalWeight, business_status businessStatus, tr.remark, tr.status,
- tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime
- from kwf_truck tr
- left join kwf_truck_ent tre on tre.truck_id = tr.id
- where tr.del_flag = 0 and tre.del_flag = 0
- and tre.ent_id = #{entId, jdbcType=VARCHAR}
- and tr.id = #{id, jdbcType=VARCHAR}
- </select>
- <select id="capacityStatistics" resultType="java.util.Map" >
- SELECT
- ent_id entId, count(1) capacityTotal, sum(auth_status) capacityAmount
- from kwf_truck
- where del_flag = 0
- <choose>
- <when test="entIds != null and entIds.size() > 0">
- and ent_id in
- <foreach collection="entIds" item="item" open="(" close=")" separator=",">
- #{item,jdbcType=BIGINT}
- </foreach>
- </when>
- </choose>
- GROUP BY ent_id
- HAVING 1=1
- <if test="capacityAmountMin != null and capacityAmountMin != ''">
- and capacityAmount <![CDATA[ >= ]]> #{capacityAmountMin, jdbcType=INTEGER}
- </if>
- <if test="capacityAmountMax != null and capacityAmountMax != ''">
- and capacityAmount <![CDATA[ <= ]]> #{capacityAmountMax, jdbcType=INTEGER}
- </if>
- </select>
- <select id="findTruckByEnt" resultType="com.sckw.fleet.model.vo.KwfTruckMonitorVo" >
- SELECT
- kt.truck_no, kt.business_status businessStatus, kte.ent_id entId
- from kwf_truck kt
- left join kwf_truck_ent kte on kte.truck_id = kt.id
- where kt.del_flag = 0 and kte.del_flag = 0
- and kte.ent_id = #{entId, jdbcType=BIGINT}
- <if test="truckNo != null and truckNo != ''">
- and kt.truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- </select>
- <select id="findTruckByAll" resultType="com.sckw.fleet.model.vo.KwfTruckMonitorVo" >
- SELECT
- kt.truck_no, kt.business_status businessStatus, kt.ent_id entId
- from kwf_truck kt
- where kt.del_flag = 0
- <if test="truckNo != null and truckNo != ''">
- and kt.truck_no = #{truckNo, jdbcType=VARCHAR}
- </if>
- </select>
- </mapper>
|