Browse Source

Merge remote-tracking branch 'origin/master'

zhengqiang 4 years ago
parent
commit
7fc2babd29

+ 161 - 159
common/src/main/resources/mapper/bus/ShiftInfo.xml

@@ -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>

+ 15 - 2
web/src/main/java/com/jpsoft/bus/modules/bus/controller/ShiftInfoController.java

@@ -9,9 +9,11 @@ import com.jpsoft.bus.modules.common.utils.PojoUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -202,6 +204,9 @@ public class ShiftInfoController {
     public MessageResult<Map> pageList(
             @RequestParam(value="id",defaultValue="") String id,
             @RequestParam(value="vehicleNumber",defaultValue="") String vehicleNumber,
+            @RequestParam(value="status",defaultValue="") String status,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -216,14 +221,22 @@ public class ShiftInfoController {
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("a.create_time","desc"));
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(status)) {
+            searchParams.put("status", status);
         }
 
         if (StringUtils.isNotEmpty(vehicleNumber)) {
             searchParams.put("vehicleNumber","%" + vehicleNumber + "%");
         }
 
+        if (startTime!=null){
+            searchParams.put("startTime", startTime);
+        }
+
+        if(endTime!=null){
+            searchParams.put("endTime", new DateTime(endTime).plusDays(1).toDate());
+        }
+
         Page<ShiftInfo> page = shiftInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
         msgResult.setResult(true);

+ 6 - 6
web/src/main/resources/application-dev.yml

@@ -7,9 +7,9 @@ spring:
   datasource:
 
     #开发环境
-    url: jdbc:log4jdbc:mysql://192.168.33.20:3306/smart-bus?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-    username: root
-    password: jpsoft2016
+#    url: jdbc:log4jdbc:mysql://192.168.33.20:3306/smart-bus?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#    username: root
+#    password: jpsoft2016
 
     #测试环境
 #     url: jdbc:log4jdbc:mysql://47.92.161.104:3336/smart-bus?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
@@ -17,9 +17,9 @@ spring:
 #     password: jpsoft8121234
 
     #正式环境
-#    url: jdbc:log4jdbc:mysql://121.37.187.149:8100/smart-bus?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-#    username: root
-#    password: jpsoft8121234
+    url: jdbc:log4jdbc:mysql://121.37.187.149:8100/smart-bus?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    username: root
+    password: jpsoft8121234
 
   devtools:
     add-properties: false