|
@@ -1,123 +1,123 @@
|
|
|
<?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">
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<!-- namespace必须指向DAO接口 -->
|
|
|
<mapper namespace="com.jpsoft.bus.modules.bus.dao.ShiftInfoDAO">
|
|
|
- <resultMap id="ShiftInfoMap" type="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
|
|
|
- <id property="id" column="id_" />
|
|
|
- <result property="driverId" column="driver_id" />
|
|
|
- <result property="vehicleId" column="vehicle_id" />
|
|
|
- <result property="routeId" column="route_id" />
|
|
|
- <result property="startStationId" column="start_station_id" />
|
|
|
- <result property="currentStationId" column="current_station_id" />
|
|
|
- <result property="currentStationStatus" column="current_station_status"/>
|
|
|
- <result property="status" column="status_" />
|
|
|
- <result property="endStationId" column="end_station_id" />
|
|
|
- <result property="createBy" column="create_by" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateBy" column="update_by" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="delFlag" column="del_flag" />
|
|
|
- <result property="finishTime" column="finish_time" />
|
|
|
- <result property="driverName" column="driver_name" />
|
|
|
- <result property="vehicleNumber" column="vehicle_number" />
|
|
|
- <result property="routeName" column="route_name" />
|
|
|
- <result property="startStationName" column="start_station_name" />
|
|
|
- <result property="currentStationName" column="current_station_name" />
|
|
|
- <result property="endStationName" column="end_station_name" />
|
|
|
- </resultMap>
|
|
|
- <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
|
|
|
- <!--
|
|
|
- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
|
- select sys_guid() from dual
|
|
|
- </selectKey>
|
|
|
- -->
|
|
|
- <![CDATA[
|
|
|
+ <resultMap id="ShiftInfoMap" type="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
|
|
|
+ <id property="id" column="id_"/>
|
|
|
+ <result property="driverId" column="driver_id"/>
|
|
|
+ <result property="vehicleId" column="vehicle_id"/>
|
|
|
+ <result property="routeId" column="route_id"/>
|
|
|
+ <result property="startStationId" column="start_station_id"/>
|
|
|
+ <result property="currentStationId" column="current_station_id"/>
|
|
|
+ <result property="currentStationStatus" column="current_station_status"/>
|
|
|
+ <result property="status" column="status_"/>
|
|
|
+ <result property="endStationId" column="end_station_id"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="delFlag" column="del_flag"/>
|
|
|
+ <result property="finishTime" column="finish_time"/>
|
|
|
+ <result property="driverName" column="driver_name"/>
|
|
|
+ <result property="vehicleNumber" column="vehicle_number"/>
|
|
|
+ <result property="routeName" column="route_name"/>
|
|
|
+ <result property="startStationName" column="start_station_name"/>
|
|
|
+ <result property="currentStationName" column="current_station_name"/>
|
|
|
+ <result property="endStationName" column="end_station_name"/>
|
|
|
+ </resultMap>
|
|
|
+ <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
|
|
|
+ <!--
|
|
|
+ <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
|
+ select sys_guid() from dual
|
|
|
+ </selectKey>
|
|
|
+ -->
|
|
|
+ <![CDATA[
|
|
|
insert into bus_shift_info
|
|
|
(id_,driver_id,vehicle_id,route_id,start_station_id,current_station_id,current_station_status,status_,end_station_id,create_by,create_time,update_by,update_time,del_flag,finish_time
|
|
|
)
|
|
|
values
|
|
|
(
|
|
|
-#{id,jdbcType=VARCHAR}
|
|
|
-,#{driverId,jdbcType= NUMERIC }
|
|
|
-,#{vehicleId,jdbcType=VARCHAR}
|
|
|
-,#{routeId,jdbcType=VARCHAR}
|
|
|
-,#{startStationId,jdbcType=VARCHAR}
|
|
|
-,#{currentStationId,jdbcType=VARCHAR}
|
|
|
-,#{currentStationStatus,jdbcType=VARCHAR}
|
|
|
-,#{status,jdbcType=VARCHAR}
|
|
|
-,#{endStationId,jdbcType=VARCHAR}
|
|
|
-,#{createBy,jdbcType=VARCHAR}
|
|
|
-,#{createTime,jdbcType= TIMESTAMP }
|
|
|
-,#{updateBy,jdbcType=VARCHAR}
|
|
|
-,#{updateTime,jdbcType= TIMESTAMP }
|
|
|
-,#{delFlag,jdbcType= NUMERIC }
|
|
|
-,#{finishTime,jdbcType= TIMESTAMP }
|
|
|
+ #{id,jdbcType=VARCHAR}
|
|
|
+ ,#{driverId,jdbcType= NUMERIC }
|
|
|
+ ,#{vehicleId,jdbcType=VARCHAR}
|
|
|
+ ,#{routeId,jdbcType=VARCHAR}
|
|
|
+ ,#{startStationId,jdbcType=VARCHAR}
|
|
|
+ ,#{currentStationId,jdbcType=VARCHAR}
|
|
|
+ ,#{currentStationStatus,jdbcType=VARCHAR}
|
|
|
+ ,#{status,jdbcType=VARCHAR}
|
|
|
+ ,#{endStationId,jdbcType=VARCHAR}
|
|
|
+ ,#{createBy,jdbcType=VARCHAR}
|
|
|
+ ,#{createTime,jdbcType= TIMESTAMP }
|
|
|
+ ,#{updateBy,jdbcType=VARCHAR}
|
|
|
+ ,#{updateTime,jdbcType= TIMESTAMP }
|
|
|
+ ,#{delFlag,jdbcType= NUMERIC }
|
|
|
+ ,#{finishTime,jdbcType= TIMESTAMP }
|
|
|
)
|
|
|
]]>
|
|
|
- </insert>
|
|
|
- <delete id="delete" parameterType="string">
|
|
|
- delete from bus_shift_info where id_=#{id,jdbcType=VARCHAR}
|
|
|
- </delete>
|
|
|
- <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
|
|
|
- update bus_shift_info
|
|
|
- <set>
|
|
|
- <if test="driverId!=null">
|
|
|
- driver_id=#{driverId,jdbcType= NUMERIC },
|
|
|
- </if>
|
|
|
- <if test="vehicleId!=null">
|
|
|
- vehicle_id=#{vehicleId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="routeId!=null">
|
|
|
- route_id=#{routeId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="startStationId!=null">
|
|
|
- start_station_id=#{startStationId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="currentStationId!=null">
|
|
|
- current_station_id=#{currentStationId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="currentStationStatus!=null">
|
|
|
- current_station_status=#{currentStationStatus,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="status!=null">
|
|
|
- status_=#{status,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="endStationId!=null">
|
|
|
- end_station_id=#{endStationId,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="createBy!=null">
|
|
|
- create_by=#{createBy,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="createTime!=null">
|
|
|
- create_time=#{createTime,jdbcType= TIMESTAMP },
|
|
|
- </if>
|
|
|
- <if test="updateBy!=null">
|
|
|
- update_by=#{updateBy,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="updateTime!=null">
|
|
|
- update_time=#{updateTime,jdbcType= TIMESTAMP },
|
|
|
- </if>
|
|
|
- <if test="delFlag!=null">
|
|
|
- del_flag=#{delFlag,jdbcType= NUMERIC },
|
|
|
- </if>
|
|
|
- <if test="finishTime!=null">
|
|
|
- finish_time=#{finishTime,jdbcType= TIMESTAMP },
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id_=#{id}
|
|
|
- </update>
|
|
|
- <select id="get" parameterType="string" resultMap="ShiftInfoMap">
|
|
|
- select * from bus_shift_info where id_=#{0}
|
|
|
- </select>
|
|
|
- <select id="exist" parameterType="string" resultType="int">
|
|
|
- select count(*) from bus_shift_info where id_=#{0}
|
|
|
- </select>
|
|
|
- <select id="list" resultMap="ShiftInfoMap">
|
|
|
- select * from bus_shift_info
|
|
|
- </select>
|
|
|
- <select id="search" parameterType="hashmap" resultMap="ShiftInfoMap">
|
|
|
- <![CDATA[
|
|
|
+ </insert>
|
|
|
+ <delete id="delete" parameterType="string">
|
|
|
+ delete from bus_shift_info where id_=#{id,jdbcType=VARCHAR}
|
|
|
+ </delete>
|
|
|
+ <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.ShiftInfo">
|
|
|
+ update bus_shift_info
|
|
|
+ <set>
|
|
|
+ <if test="driverId!=null">
|
|
|
+ driver_id=#{driverId,jdbcType= NUMERIC },
|
|
|
+ </if>
|
|
|
+ <if test="vehicleId!=null">
|
|
|
+ vehicle_id=#{vehicleId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="routeId!=null">
|
|
|
+ route_id=#{routeId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="startStationId!=null">
|
|
|
+ start_station_id=#{startStationId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="currentStationId!=null">
|
|
|
+ current_station_id=#{currentStationId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="currentStationStatus!=null">
|
|
|
+ current_station_status=#{currentStationStatus,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status!=null">
|
|
|
+ status_=#{status,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="endStationId!=null">
|
|
|
+ end_station_id=#{endStationId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createBy!=null">
|
|
|
+ create_by=#{createBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime!=null">
|
|
|
+ create_time=#{createTime,jdbcType= TIMESTAMP },
|
|
|
+ </if>
|
|
|
+ <if test="updateBy!=null">
|
|
|
+ update_by=#{updateBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime!=null">
|
|
|
+ update_time=#{updateTime,jdbcType= TIMESTAMP },
|
|
|
+ </if>
|
|
|
+ <if test="delFlag!=null">
|
|
|
+ del_flag=#{delFlag,jdbcType= NUMERIC },
|
|
|
+ </if>
|
|
|
+ <if test="finishTime!=null">
|
|
|
+ finish_time=#{finishTime,jdbcType= TIMESTAMP },
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_=#{id}
|
|
|
+ </update>
|
|
|
+ <select id="get" parameterType="string" resultMap="ShiftInfoMap">
|
|
|
+ select * from bus_shift_info where id_=#{0}
|
|
|
+ </select>
|
|
|
+ <select id="exist" parameterType="string" resultType="int">
|
|
|
+ select count(*) from bus_shift_info where id_=#{0}
|
|
|
+ </select>
|
|
|
+ <select id="list" resultMap="ShiftInfoMap">
|
|
|
+ select * from bus_shift_info
|
|
|
+ </select>
|
|
|
+ <select id="search" parameterType="hashmap" resultMap="ShiftInfoMap">
|
|
|
+ <![CDATA[
|
|
|
SELECT
|
|
|
a.*,
|
|
|
b.name_ AS driver_name,
|
|
@@ -135,87 +135,89 @@
|
|
|
LEFT JOIN bus_station_info f ON a.current_station_id = f.id_
|
|
|
LEFT JOIN bus_station_info g ON a.end_station_id = g.id_
|
|
|
]]>
|
|
|
- <where>
|
|
|
- a.del_flag = 0
|
|
|
- <if test="searchParams.id != null">
|
|
|
- and a.ID_ like #{searchParams.id}
|
|
|
- </if>
|
|
|
- <if test="searchParams.vehicleId != null">
|
|
|
- and a.vehicle_id = #{searchParams.vehicleId}
|
|
|
- </if>
|
|
|
- <if test="searchParams.vehicleNumber != null">
|
|
|
- and c.license_plate_number like #{searchParams.vehicleNumber}
|
|
|
- </if>
|
|
|
- <if test="searchParams.vehicleInfoList!= null">
|
|
|
- <foreach item="item" collection="searchParams.vehicleInfoList" open="and a.vehicle_id in (" separator="," close=")">
|
|
|
- #{item.id}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="searchParams.shiftInfoList!= null">
|
|
|
- <foreach item="item" collection="searchParams.shiftInfoList" open="and a.id_ in (" separator="," close=")">
|
|
|
- #{item.id}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="searchParams.driverId">
|
|
|
- and a.driver_id = #{searchParams.driverId}
|
|
|
- </if>
|
|
|
- <if test="searchParams.startTime != null">
|
|
|
- <![CDATA[
|
|
|
+ <where>
|
|
|
+ a.del_flag = 0
|
|
|
+ <if test="searchParams.status != null">
|
|
|
+ and a.status_ = #{searchParams.status}
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.vehicleId != null">
|
|
|
+ and a.vehicle_id = #{searchParams.vehicleId}
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.vehicleNumber != null">
|
|
|
+ and c.license_plate_number like #{searchParams.vehicleNumber}
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.vehicleInfoList!= null">
|
|
|
+ <foreach item="item" collection="searchParams.vehicleInfoList" open="and a.vehicle_id in ("
|
|
|
+ separator="," close=")">
|
|
|
+ #{item.id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.shiftInfoList!= null">
|
|
|
+ <foreach item="item" collection="searchParams.shiftInfoList" open="and a.id_ in (" separator=","
|
|
|
+ close=")">
|
|
|
+ #{item.id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.driverId">
|
|
|
+ and a.driver_id = #{searchParams.driverId}
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.startTime != null">
|
|
|
+ <![CDATA[
|
|
|
and a.create_time >= #{searchParams.startTime}
|
|
|
]]>
|
|
|
- </if>
|
|
|
- <if test="searchParams.endTime != null">
|
|
|
- <![CDATA[
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.endTime != null">
|
|
|
+ <![CDATA[
|
|
|
and a.create_time <= #{searchParams.endTime}
|
|
|
]]>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- <foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
|
- ${sort.name} ${sort.order}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
- <select id="findByDriverIdAndStatus" resultMap="ShiftInfoMap">
|
|
|
- <![CDATA[
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
|
+ ${sort.name} ${sort.order}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+ <select id="findByDriverIdAndStatus" resultMap="ShiftInfoMap">
|
|
|
+ <![CDATA[
|
|
|
select * from bus_shift_info
|
|
|
where del_flag = 0
|
|
|
and driver_id = #{driverId}
|
|
|
and status_ = #{status}
|
|
|
]]>
|
|
|
- </select>
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findByVehicleIdAndStatus" resultMap="ShiftInfoMap">
|
|
|
- <![CDATA[
|
|
|
+ <select id="findByVehicleIdAndStatus" resultMap="ShiftInfoMap">
|
|
|
+ <![CDATA[
|
|
|
select * from bus_shift_info
|
|
|
where del_flag = 0
|
|
|
and vehicle_id = #{vehicleId}
|
|
|
and status_ = #{status}
|
|
|
]]>
|
|
|
- </select>
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findByRouteIdAndStatus" resultMap="ShiftInfoMap">
|
|
|
- <![CDATA[
|
|
|
+ <select id="findByRouteIdAndStatus" resultMap="ShiftInfoMap">
|
|
|
+ <![CDATA[
|
|
|
select * from bus_shift_info
|
|
|
where del_flag = 0
|
|
|
and route_id = #{routeId}
|
|
|
and status_ = #{status}
|
|
|
]]>
|
|
|
- </select>
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findByRouteIdAndStatusAndStartStationId" resultMap="ShiftInfoMap">
|
|
|
- <![CDATA[
|
|
|
+ <select id="findByRouteIdAndStatusAndStartStationId" resultMap="ShiftInfoMap">
|
|
|
+ <![CDATA[
|
|
|
select * from bus_shift_info
|
|
|
where del_flag = 0
|
|
|
and route_id = #{routeId}
|
|
|
and status_ = #{status}
|
|
|
and start_station_id = #{startStationId}
|
|
|
]]>
|
|
|
- </select>
|
|
|
- <select id="findVehicleByDriverId" resultType="java.lang.String">
|
|
|
- <![CDATA[
|
|
|
+ </select>
|
|
|
+ <select id="findVehicleByDriverId" resultType="java.lang.String">
|
|
|
+ <![CDATA[
|
|
|
select vehicle_id from bus_shift_info
|
|
|
where del_flag = 0
|
|
|
and driver_id = #{driverId}
|
|
|
GROUP BY vehicle_id
|
|
|
]]>
|
|
|
- </select>
|
|
|
+ </select>
|
|
|
</mapper>
|