|
|
@@ -1,297 +0,0 @@
|
|
|
-<?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.aoyang.tms.mapper.TruckMapper">
|
|
|
-
|
|
|
- <!-- 通用查询映射结果 -->
|
|
|
- <resultMap id="BaseResultMap" type="com.aoyang.tms.entity.Truck">
|
|
|
- <id column="truck_id" property="truckId"/>
|
|
|
- <result column="trade_type" property="tradeType"/>
|
|
|
- <result column="org_id" property="orgId"/>
|
|
|
- <result column="org_name" property="orgName"/>
|
|
|
- <result column="truck_name" property="truckName"/>
|
|
|
- <result column="car_number" property="carNumber"/>
|
|
|
- <result column="purchase_date" property="purchaseDate"/>
|
|
|
- <result column="color" property="color"/>
|
|
|
- <result column="dead_weight" property="deadWeight"/>
|
|
|
- <result column="capacity" property="capacity"/>
|
|
|
- <result column="manufacturer" property="manufacturer"/>
|
|
|
- <result column="status" property="status"/>
|
|
|
- <result column="creater" property="creater"/>
|
|
|
- <result column="create_date" property="createDate"/>
|
|
|
- <result column="updater" property="updater"/>
|
|
|
- <result column="update_date" property="updateDate"/>
|
|
|
- <result column="frame_number" property="frameNumber"/>
|
|
|
- <result column="trailer_number" property="trailerNumber"/>
|
|
|
- <result column="auto_account" property="autoAccount"/>
|
|
|
- <result column="linked" property="linked"/>
|
|
|
- <result column="level" property="level"/>
|
|
|
- <result column="type_name" property="typeName"/>
|
|
|
- <result column="owner" property="owner"/>
|
|
|
- <result column="address" property="address"/>
|
|
|
- <result column="use_nature" property="useNature"/>
|
|
|
- <result column="vehicle_id_code" property="vehicleIdCode"/>
|
|
|
- <result column="register_date" property="registerDate"/>
|
|
|
- <result column="issue_date" property="issueDate"/>
|
|
|
- <result column="file_no" property="fileNo"/>
|
|
|
- <result column="energy_type" property="energyType"/>
|
|
|
- <result column="face_url" property="faceUrl"/>
|
|
|
- <result column="back_url" property="backUrl"/>
|
|
|
- <result column="auth_status" property="authStatus"/>
|
|
|
- <result column="auth_date" property="auth_date"/>
|
|
|
- <result column="com_status" property="comStatus"/>
|
|
|
- <result column="com_contract_status" property="comContractStatus"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <!-- 通用查询映射结果 -->
|
|
|
- <resultMap id="AllResultMap" type="com.aoyang.tms.entity.vo.TruckVO">
|
|
|
- <id column="truck_id" property="truckId"/>
|
|
|
- <result column="trade_type" property="tradeType"/>
|
|
|
- <result column="org_id" property="orgId"/>
|
|
|
- <result column="org_name" property="orgName"/>
|
|
|
- <result column="truck_name" property="truckName"/>
|
|
|
- <result column="car_number" property="carNumber"/>
|
|
|
- <result column="purchase_date" property="purchaseDate"/>
|
|
|
- <result column="color" property="color"/>
|
|
|
- <result column="dead_weight" property="deadWeight"/>
|
|
|
- <result column="capacity" property="capacity"/>
|
|
|
- <result column="manufacturer" property="manufacturer"/>
|
|
|
- <result column="status" property="status"/>
|
|
|
- <result column="creater" property="creater"/>
|
|
|
- <result column="create_date" property="createDate"/>
|
|
|
- <result column="updater" property="updater"/>
|
|
|
- <result column="update_date" property="updateDate"/>
|
|
|
- <result column="frame_number" property="frameNumber"/>
|
|
|
- <result column="trailer_number" property="trailerNumber"/>
|
|
|
- <result column="auto_account" property="autoAccount"/>
|
|
|
- <result column="linked" property="linked"/>
|
|
|
- <collection property="driverList" ofType="java.util.Map" column="truckId">
|
|
|
- <id column="driver_id" property="driverId"/>
|
|
|
- <result column="driver_name" property="driverName"/>
|
|
|
- <result column="driver_no" property="driverNo"/>
|
|
|
- <result column="driver_date" property="driverDate"/>
|
|
|
- <result column="mobile" property="mobile"/>
|
|
|
- </collection>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
-
|
|
|
- <!-- 通用查询映射结果 -->
|
|
|
- <resultMap id="AllTruckResultMap" type="com.aoyang.tms.entity.vo.TruckVO">
|
|
|
- <id column="truck_id" property="truckId"/>
|
|
|
- <result column="trade_type" property="tradeType"/>
|
|
|
- <result column="org_id" property="orgId"/>
|
|
|
- <result column="org_name" property="orgName"/>
|
|
|
- <result column="truck_name" property="truckName"/>
|
|
|
- <result column="car_number" property="carNumber"/>
|
|
|
- <result column="purchase_date" property="purchaseDate"/>
|
|
|
- <result column="color" property="color"/>
|
|
|
- <result column="dead_weight" property="deadWeight"/>
|
|
|
- <result column="capacity" property="capacity"/>
|
|
|
- <result column="manufacturer" property="manufacturer"/>
|
|
|
- <result column="status" property="status"/>
|
|
|
- <result column="creater" property="creater"/>
|
|
|
- <result column="create_date" property="createDate"/>
|
|
|
- <result column="updater" property="updater"/>
|
|
|
- <result column="update_date" property="updateDate"/>
|
|
|
- <result column="frame_number" property="frameNumber"/>
|
|
|
- <result column="trailer_number" property="trailerNumber"/>
|
|
|
- <result column="auto_account" property="autoAccount"/>
|
|
|
- <result column="linked" property="linked"/>
|
|
|
- <collection property="driverList" ofType="com.aoyang.tms.entity.feignEntity.User"
|
|
|
- javaType="ArrayList" column="truck_id" select="driverList">
|
|
|
- </collection>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <resultMap id="driverResult" type="com.aoyang.tms.entity.feignEntity.User">
|
|
|
- <id column="driver_id" property="userId"/>
|
|
|
- <result column="driver_name" property="userName"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
-
|
|
|
- <resultMap id="carNumResult" type="com.aoyang.tms.entity.Truck">
|
|
|
- <id column="truck_id" property="truckId"/>
|
|
|
- <result column="car_number" property="carNumber"/>
|
|
|
- <result column="trade_type" property="tradeType"/>
|
|
|
- </resultMap>
|
|
|
- <!-- 通用查询结果列 -->
|
|
|
- <sql id="Base_Column_List">
|
|
|
- truck_id,
|
|
|
- trade_type, org_id, org_name, truck_name, car_number, purchase_date, color, dead_weight, capacity, manufacturer, status, creater, create_date, updater, update_date,frame_number,trailer_number,creater_name,updater_name,auto_account,linked,type_name,owner,address,use_nature,vehicle_id_code,register_date,issue_date,file_no,energy_type,face_url,back_url,auth_status,auth_date,level,com_status,com_contract_url
|
|
|
- </sql>
|
|
|
- <sql id="Truck_Column_List">
|
|
|
- b.truck_id ,b.trade_type,
|
|
|
- b.org_id,b.org_name,b.truck_name,b.car_number,b.purchase_date,b.color,b.dead_weight,b.capacity,b.manufacturer,b.status,b.creater,b.create_date,b.updater,b.update_date,b.frame_number,b.trailer_number,b.creater_name,b.updater_name,b.auto_account,b.linked
|
|
|
-
|
|
|
- </sql>
|
|
|
-
|
|
|
- <sql id="Truck_Column_List2">
|
|
|
- b.truck_id,b.trade_type,
|
|
|
- b.org_id,b.org_name,b.truck_name,b.car_number,b.purchase_date,b.color,b.dead_weight,b.capacity,b.manufacturer,b.status,b.creater,b.create_date,b.updater,b.update_date,b.frame_number,
|
|
|
- b.trailer_number,b.creater_name,b.updater_name,b.auto_account,b.linked,b.status,b.level,b.com_status,b.com_contract_status
|
|
|
-
|
|
|
- </sql>
|
|
|
-
|
|
|
- <sql id="carNumber_Column_List">
|
|
|
- b.truck_id
|
|
|
- ,b.car_number,b.linked,b.auto_account,b.frame_number,b.trade_type
|
|
|
-
|
|
|
- </sql>
|
|
|
- <sql id="driver_Column_List">
|
|
|
- a.driver_id
|
|
|
- , a.driver_name, a.driver_no, a.driver_date, a.mobile
|
|
|
- </sql>
|
|
|
- <!--根据司机id,查询司机所挂的车牌号-->
|
|
|
- <select id="getCarNumber" parameterType="java.lang.Long" resultMap="carNumResult">
|
|
|
- select
|
|
|
- <include refid="carNumber_Column_List"/>
|
|
|
- from truck_driver a,truck b where a.truck_id=b.truck_id and a.driver_id=#{driverId}
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <!--卡车信息,包含旗下的司机信息-->
|
|
|
- <select id="truckDetail" parameterType="java.lang.Long" resultMap="AllResultMap">
|
|
|
- select<include refid="driver_Column_List"/>,
|
|
|
- <include refid="Truck_Column_List"/>
|
|
|
- from truck b left join truck_driver c on b.truck_id=c.truck_id
|
|
|
- left join driver a on c.driver_id=a.driver_id
|
|
|
- where b.status=0 and b.truck_id=#{truckId}
|
|
|
-
|
|
|
- </select>
|
|
|
-
|
|
|
- <!--绑定管理,根据物流公司id,查询该企业所有的卡车,并支持通过 车牌号+司机姓名 模糊查询 -->
|
|
|
- <select id="bindingManager" resultMap="AllTruckResultMap">
|
|
|
- select
|
|
|
- truck_id,trade_type,truck_name,car_number,org_id,frame_number,dead_weight,capacity,purchase_date,trailer_number,color,manufacturer,status,auto_account,linked,create_date
|
|
|
- from(
|
|
|
- select
|
|
|
- truck_id,trade_type,truck_name,car_number,org_id,frame_number,dead_weight,capacity,purchase_date,trailer_number,color,manufacturer,status,auto_account,linked,create_date
|
|
|
- from truck where 1=1
|
|
|
- <if test="bindingManager.orgId != null">
|
|
|
- and org_id = #{bindingManager.orgId}
|
|
|
- </if>
|
|
|
- <if test="bindingManager.linked != null">
|
|
|
- and linked = #{bindingManager.linked}
|
|
|
- </if>
|
|
|
- <if test='bindingManager.keyWord != null and bindingManager.keyWord !="" '>
|
|
|
- and car_number like concat('%',#{bindingManager.keyWord},'%')
|
|
|
- </if>
|
|
|
- union
|
|
|
- select
|
|
|
- a.truck_id,a.trade_type,a.truck_name,a.car_number,a.org_id,a.frame_number,a.dead_weight,a.capacity,a.purchase_date,a.trailer_number,a.color,a.manufacturer,a.status,a.auto_account,a.linked,a.create_date
|
|
|
- from truck a,truck_driver b
|
|
|
- where a.truck_id=b.truck_id
|
|
|
- <if test="bindingManager.orgId != null">
|
|
|
- and b.org_id=#{bindingManager.orgId}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="bindingManager.linked != null">
|
|
|
- and a.linked = #{bindingManager.linked}
|
|
|
- </if>
|
|
|
- <if test='bindingManager.keyWord != null and bindingManager.keyWord !="" '>
|
|
|
- and b.driver_name like concat('%',#{bindingManager.keyWord},'%')
|
|
|
- </if>
|
|
|
- )m order by create_date desc,m.truck_id desc
|
|
|
-
|
|
|
- </select>
|
|
|
-
|
|
|
- <!--根据卡车,查询绑定的司机列表-->
|
|
|
- <select id="driverList" parameterType="java.lang.Long" resultMap="driverResult">
|
|
|
- select driver_id, driver_name
|
|
|
- from truck_driver
|
|
|
- where truck_id = #{truckId}
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <update id="bashEditTruckStart" parameterType="com.aoyang.tms.entity.Truck">
|
|
|
- update truck
|
|
|
- set status=case when status > 0 then status - 1 else 0 end,
|
|
|
- updater=#{truck.updater},
|
|
|
- updater_name=#{truck.updaterName}
|
|
|
- where org_id = #{truck.orgId}
|
|
|
- </update>
|
|
|
-
|
|
|
- <update id="bashEditTruckStop" parameterType="com.aoyang.tms.entity.Truck">
|
|
|
- update truck
|
|
|
- set status=status + 1,
|
|
|
- updater=#{truck.updater},
|
|
|
- updater_name=#{truck.updaterName}
|
|
|
- where org_id = #{truck.orgId}
|
|
|
- </update>
|
|
|
-
|
|
|
- <!-- 通用查询映射结果 -->
|
|
|
- <resultMap id="truckListForWebMap" type="com.aoyang.tms.entity.vo.TruckVO">
|
|
|
- <id column="truck_id" property="truckId"/>
|
|
|
- <result column="trade_type" property="tradeType"/>
|
|
|
- <result column="org_id" property="orgId"/>
|
|
|
- <result column="org_name" property="orgName"/>
|
|
|
- <result column="truck_name" property="truckName"/>
|
|
|
- <result column="car_number" property="carNumber"/>
|
|
|
- <result column="purchase_date" property="purchaseDate"/>
|
|
|
- <result column="color" property="color"/>
|
|
|
- <result column="dead_weight" property="deadWeight"/>
|
|
|
- <result column="capacity" property="capacity"/>
|
|
|
- <result column="manufacturer" property="manufacturer"/>
|
|
|
- <result column="status" property="status"/>
|
|
|
- <result column="creater" property="creater"/>
|
|
|
- <result column="create_date" property="createDate"/>
|
|
|
- <result column="updater" property="updater"/>
|
|
|
- <result column="update_date" property="updateDate"/>
|
|
|
- <result column="frame_number" property="frameNumber"/>
|
|
|
- <result column="trailer_number" property="trailerNumber"/>
|
|
|
- <result column="auto_account" property="autoAccount"/>
|
|
|
- <result column="linked" property="linked"/>
|
|
|
- <result column="level" property="level"/>
|
|
|
- <result column="com_status" property="comStatus"/>
|
|
|
- <result column="com_contract_status" property="comContractStatus"/>
|
|
|
- <collection property="driversList" select="driverList" column="truck_id">
|
|
|
-
|
|
|
- </collection>
|
|
|
- </resultMap>
|
|
|
- <!--根据关键字(车牌号+司机姓名)进行查询卡车列表,及卡车下的司机列表-->
|
|
|
- <select id="truckListForWeb" resultMap="truckListForWebMap">
|
|
|
- select
|
|
|
- <include refid="Truck_Column_List2"/>
|
|
|
- from truck b where 1=1
|
|
|
- <if test="truck!=null and truck.orgId != null">
|
|
|
- and b.org_id=#{truck.orgId}
|
|
|
- </if>
|
|
|
- <if test="truck.keyword != null and truck.keyword !=''">
|
|
|
- and (b.car_number like concat('%',#{truck.keyword},'%')
|
|
|
- or truck_id in(select truck_id from truck_driver where driver_name like concat('%',#{truck.keyword},'%')))
|
|
|
- </if>
|
|
|
- <if test="truck.status !=null">
|
|
|
- and b.status=#{truck.status}
|
|
|
- </if>
|
|
|
- <if test="truck.tradeType !=null">
|
|
|
- and b.trade_type=#{truck.tradeType}
|
|
|
- </if>
|
|
|
- <if test="truck.linked != null">
|
|
|
- and b.linked = #{truck.linked}
|
|
|
- </if>
|
|
|
- order by b.update_date desc
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <select id="truckListForWeb_old" resultMap="truckListForWebMap">
|
|
|
- select
|
|
|
- <include refid="Truck_Column_List2"/>
|
|
|
- from truck b
|
|
|
- left join truck_driver a on a.truck_id=b.truck_id
|
|
|
- where 1=1
|
|
|
- <if test="truck.orgId != null">
|
|
|
- and b.org_id=#{truck.orgId}
|
|
|
- </if>
|
|
|
- <if test="truck.keyword != null and truck.keyword !=''">
|
|
|
- and (b.car_number like concat('%',#{truck.keyword},'%') or a.driver_name like
|
|
|
- concat('%',#{truck.keyword},'%'))
|
|
|
- </if>
|
|
|
- <if test="truck.status !=null">
|
|
|
- and b.status=#{truck.status}
|
|
|
- </if>
|
|
|
- <if test="truck.linked != null">
|
|
|
- and b.linked = #{truck.linked}
|
|
|
- </if>
|
|
|
- order by b.create_date desc
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
-</mapper>
|