Forráskód Böngészése

车辆 绑定线路,激活码

xiao547607 4 éve
szülő
commit
f10597eebf

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/VehicleInfo.java

@@ -63,6 +63,8 @@ public class VehicleInfo {
     private Boolean online;
     @ApiModelProperty(value = "最后所在位置")
     private String latestAddress;
+    @ApiModelProperty(value = "运行线路名称")
+    private String routeName;
 
     private String companyName;
 }

+ 1 - 2
common/src/main/resources/mapper/bus/RouteInfo.xml

@@ -86,8 +86,7 @@
 	where id_=#{id}
 	</update>
 	<select id="get" parameterType="string" resultMap="RouteInfoMap">
-		select 
-id_,name_,create_by,create_time,update_by,update_time,del_flag,map_path,company_id,goods_id,start_time,end_time		from bus_route_info where id_=#{0}
+		select * from bus_route_info where id_=#{0}
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from bus_route_info where id_=#{0}

+ 12 - 6
common/src/main/resources/mapper/bus/VehicleInfo.xml

@@ -25,6 +25,7 @@
 			<result property="acc" column="acc_" />
 			<result property="online" column="online_" />
 			<result property="latestAddress" column="latest_address" />
+			<result property="routeName" column="route_name" />
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.VehicleInfo">
 	<!--
@@ -141,21 +142,26 @@
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="VehicleInfoMap">
 		<![CDATA[
-			select * from bus_vehicle_info
+			SELECT
+				a.*,
+				b.name_ AS route_name
+			FROM
+				bus_vehicle_info a
+				LEFT JOIN bus_route_info b ON a.route_id = b.id_
 		]]>
 		<where>
-			del_flag=false
+			a.del_flag=false
 			<if test="searchParams.licensePlateNumber != null">
-				and license_plate_number like #{searchParams.licensePlateNumber}
+				and a.license_plate_number like #{searchParams.licensePlateNumber}
 			</if>
 			<if test="searchParams.companyId != null">
-				and company_id = #{searchParams.companyId}
+				and a.company_id = #{searchParams.companyId}
 			</if>
 			<if test="searchParams.gpsDeviceNo != null">
-				and gps_device_no like #{searchParams.gpsDeviceNo}
+				and a.gps_device_no like #{searchParams.gpsDeviceNo}
 			</if>
 			<if test="searchParams.deviceNo != null">
-				and device_no like #{searchParams.deviceNo}
+				and a.device_no like #{searchParams.deviceNo}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 39 - 0
web/src/main/java/com/jpsoft/bus/modules/bus/controller/RouteInfoController.java

@@ -17,7 +17,9 @@ import com.jpsoft.bus.modules.bus.service.RouteInfoService;
 import com.jpsoft.bus.modules.common.utils.OSSUtil;
 import com.jpsoft.bus.modules.common.utils.POIUtils;
 import com.jpsoft.bus.modules.common.utils.PojoUtils;
+import com.jpsoft.bus.modules.sys.entity.User;
 import com.jpsoft.bus.modules.sys.service.DataDictionaryService;
+import com.jpsoft.bus.modules.sys.service.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -63,6 +65,9 @@ public class RouteInfoController {
     @Autowired
     private DataDictionaryService dataDictionaryService;
 
+    @Autowired
+    private UserService userService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<RouteInfoDTO> create(){
@@ -554,4 +559,38 @@ public class RouteInfoController {
 
         return msgResult;
     }
+
+    @ApiOperation(value="路线")
+    @RequestMapping(value = "list",method = RequestMethod.POST)
+    public MessageResult<List<RouteInfo>> list(String companyId,@RequestAttribute String subject){
+
+        MessageResult<List<RouteInfo>> msgResult = new MessageResult<>();
+        User user = userService.get(subject);
+
+        CompanyInfo companyInfo = companyInfoService.get(companyId);
+
+        String queryCompanyId = "";
+        if(companyInfo != null){
+            if("1".equals(companyInfo.getType())){
+                //公司
+                queryCompanyId = companyId;
+            }else if("2".equals(companyInfo.getType())){
+                //车队 查上级
+                queryCompanyId = companyInfo.getParentId();
+            }
+        }
+
+        Map<String,Object> searchParams = new HashMap<>();
+        searchParams.put("companyId",queryCompanyId);
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        Page<RouteInfo> page = routeInfoService.pageSearch(searchParams,0,1000,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(page.getResult());
+
+        return msgResult;
+    }
 }

+ 2 - 1
web/src/main/java/com/jpsoft/bus/modules/bus/controller/VehicleInfoController.java

@@ -231,7 +231,8 @@ public class VehicleInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("b.name_","asc"));
+        sortList.add(new Sort("a.create_time","desc"));
 
         if (StringUtils.isNotEmpty(licensePlateNumber)) {
             searchParams.put("licensePlateNumber","%" + licensePlateNumber + "%");