Browse Source

设备计划查询接口优化

linzhiwei 2 years ago
parent
commit
66ba984ea8

+ 9 - 0
snws-gps/snws-gps-boot/src/main/java/com/tofly/gpsboot/mapper/plan/PlanFactoryMapper.java

@@ -22,6 +22,15 @@ public interface PlanFactoryMapper extends BaseMapper<PlanFactory> {
      */
     Page<PlanFactory> getPlanDeviceList(Page page, @Param("dto") PlanDeviceDTO dto);
 
+    /**
+     * 查询设备相关列表
+     *
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<PlanFactory> getDeviceList(Page page, @Param("dto") PlanDeviceDTO dto);
+
     /**
      * 获取设备维护巡检统计信息
      * @param page

+ 4 - 1
snws-gps/snws-gps-boot/src/main/java/com/tofly/gpsboot/service/paln/task/impl/PlanFactoryServiceImpl.java

@@ -228,7 +228,10 @@ public class PlanFactoryServiceImpl extends ServiceImpl<PlanFactoryMapper, PlanF
 
     @Override
     public Page<PlanFactory> getPlanDeviceList(Page page, PlanDeviceDTO dto) {
-        return baseMapper.getPlanDeviceList(page,dto);
+        if(null!=dto.getPlanId()){
+            return baseMapper.getPlanDeviceList(page,dto);
+        }
+        return baseMapper.getDeviceList(page,dto);
     }
 
     @Override

+ 48 - 0
snws-gps/snws-gps-boot/src/main/resources/mapper/plan/PlanFactoryMapper.xml

@@ -82,6 +82,54 @@
     </select>
 
     <select id="getPlanDeviceList" resultMap="planFactoryMap">
+        SELECT
+        t1.belong_station_id,
+        t1.belong_Pump_Id,
+        t1.category,
+        t1.id as device_Id,
+        t1.type as device_Type,
+        t1.latitude,
+        t1.longitude,
+        t1.location address,
+        t2.name belongStationName,
+        t3.name belongPumpName,
+        t1.id as id,
+        t4.is_Over,
+        t4.OVER_DATE,
+        t4.OVER_USER,
+        t4.id as plan_Id
+        FROM tf_ywpn_monitor_device_w t1
+        LEFT JOIN tf_ywpn_monitor_stationsiteinfo_w t2
+        on t1.belong_station_id = t2.id
+        LEFT JOIN tf_monitor_pump_station_w t3
+        on t1.belong_Pump_Id = t3.id
+        RIGHT JOIN tf_ywpn_plan_factory t4
+        on t1.id = t4.device_Id
+        where 1=1
+        <if test="dto.category != null ">
+            and t1.category =#{dto.category}
+        </if>
+        <if test="dto.belongStationId != null ">
+            and t1.belong_station_id =#{dto.belongStationId}
+        </if>
+        <if test="dto.belongPumpId != null ">
+            and t1.belong_Pump_Id =#{dto.belongPumpId}
+        </if>
+        <if test="dto.isOver != null ">
+            and t4.is_Over =#{dto.isOver}
+        </if>
+        <if test="dto.planId != null ">
+            and t4.PLAN_ID =#{dto.planId}
+        </if>
+        <if test="dto.belongStationName != null and dto.belongStationName != '' ">
+            and t2.name like CONCAT ('%',#{dto.belongStationName,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="dto.belongPumpName != null and dto.belongPumpName != '' ">
+            and t3.name like CONCAT ('%',#{dto.belongPumpName,jdbcType=VARCHAR},'%')
+        </if>
+    </select>
+
+    <select id="getDeviceList" resultMap="planFactoryMap">
         SELECT
         t1.belong_station_id,
         t1.belong_Pump_Id,