Browse Source

“部门厂站树”

yangjunfeng 1 year ago
parent
commit
bfc9ca989d

+ 0 - 3
snws-admin/snws-base-api/src/main/java/com/tofly/api/DepartmentClient.java

@@ -20,9 +20,6 @@ public interface DepartmentClient {
     @GetMapping("/department/listAll")
     ResultRespone<List<Department>> departmentListAll();
 
-    @GetMapping("/department/getTreeList")
-    ResultRespone<List<Department>> getSystemPage();
-
     @GetMapping("/user/getUserByDepts")
     ResultRespone<List<Map<String, Object>>> getUserByDepts(@RequestParam(value = "depts") String depts);
 

+ 2 - 1
snws-admin/snws-base-api/src/main/java/com/tofly/pojo/Department.java

@@ -16,6 +16,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 部门表
@@ -104,5 +105,5 @@ public class Department extends Model<Department> {
 
     @ApiModelProperty(hidden = true)
     @TableField(exist = false)
-    private List<Stationsiteinfo> stationsiteinfos;
+    private List<Map<String, Object>> stationsiteinfos;
 }

+ 2 - 1
snws-admin/snws-base-service/src/main/java/com/tofly/base/entity/Department.java

@@ -17,6 +17,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 部门表
@@ -109,5 +110,5 @@ public class Department extends Model<Department> {
 
     @ApiModelProperty(hidden = true)
     @TableField(exist = false)
-    private List<Stationsiteinfo> stationsiteinfos;
+    private List<Map<String, Object>> stationsiteinfos;
 }

+ 2 - 0
snws-admin/snws-base-service/src/main/java/com/tofly/base/mapper/DepartmentMapper.java

@@ -23,6 +23,8 @@ public interface DepartmentMapper extends BaseMapper<Department> {
     List<Department> subList(@Param("id") Long id, @Param("returnSelf") String returnSelf);
     
     Department queryById(Long departmentId);
+
+    List<Map<String, Object>> getSewageDistinctName(Long deptId);
 }
 
 

+ 1 - 0
snws-admin/snws-base-service/src/main/java/com/tofly/base/service/impl/DepartmentServiceImpl.java

@@ -120,6 +120,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
                     deptVo.setDeptVos(getDeptList(departments));
                 }
                 deptVosList.add(deptVo);
+                deptVo.setStationsiteinfos(this.baseMapper.getSewageDistinctName(deptVoId));
             }
         }
         return deptVosList;

+ 13 - 0
snws-admin/snws-base-service/src/main/resources/mapper/DepartmentMapper.xml

@@ -95,4 +95,17 @@
                (SELECT m.username from tf_smpn_user_x m where m.id = n.CREATE_USER) userName
         FROM n n
     </select>
+
+    <select id="getSewageDistinctName" resultType="map">
+        select  a.id,
+                a.name,
+                a.no
+        from tf_ywpn_monitor_stationsiteinfo_w a
+        left join tf_dept_sewage b on a.id = b.sewage_station_id
+        where a.del_flag = '0'
+        <if test="deptId != null">
+            AND b.dept_id = #{deptId}
+        </if>
+    </select>
+
 </mapper>

+ 0 - 16
snws-monitor/snws-monitor-boot/src/main/java/com/tofly/monitor/screenDisplay/controller/CustomDisplayController.java

@@ -294,22 +294,6 @@ public class CustomDisplayController {
         }
     }
 
-    /**
-     *
-     * @param
-     * @description 查询厂站设备指标树
-     */
-    @GetMapping("/viewStationAboutTree")
-    @ApiOperation(value = "查询厂站设备指标树")
-    public ResultRespone<List<Department>> viewStationAboutTree(){
-        try {
-            return ResultRespone.success(customDisplayService.viewStationAboutTree());
-        }catch (Exception e){
-            e.printStackTrace();
-            return ResultRespone.failed(e.getMessage());
-        }
-    }
-
     /**
      *
      * @param

+ 0 - 2
snws-monitor/snws-monitor-boot/src/main/java/com/tofly/monitor/screenDisplay/service/CustomDisplayService.java

@@ -45,8 +45,6 @@ public interface CustomDisplayService {
 
     List<StationIndexVo> viewIndexValHisReal(WisdomDisplayDto wisdomDisplayDto);
 
-    List<Department> viewStationAboutTree();
-
     void synStatisticsScada(String type, String startTime, String endTime);
 
 }

+ 0 - 13
snws-monitor/snws-monitor-boot/src/main/java/com/tofly/monitor/screenDisplay/service/impl/CustomDisplayServiceImpl.java

@@ -792,19 +792,6 @@ public class CustomDisplayServiceImpl implements CustomDisplayService {
         return res;
     }
 
-    @Override
-    public List<Department> viewStationAboutTree() {
-        List<Department> departmentList = departmentClient.getSystemPage().getResult();
-        departmentList.forEach(info -> {
-            List<TfDeptSewage> deptSewageList = deptSewageService.list(new QueryWrapper<TfDeptSewage>().lambda().eq(TfDeptSewage::getDeptId, info.getId()));
-            if (CollUtil.isNotEmpty(deptSewageList)) {
-                List<Long> sewageIds = deptSewageList.stream().map(TfDeptSewage::getSewageStationId).collect(Collectors.toList());
-                info.setStationsiteinfos(stationsiteinfoService.list(new QueryWrapper<Stationsiteinfo>().lambda().in(Stationsiteinfo::getId, sewageIds)));
-            }
-        });
-        return departmentList;
-    }
-
     @Override
     public void synStatisticsScada(String type, String startTime, String endTime) {
         switch (type) {

+ 3 - 0
snws-monitor/snws-monitor-boot/src/main/resources/mapper/StationsiteinfoMapper.xml

@@ -83,6 +83,9 @@
                 #{item}
             </foreach>
         </if>
+        <if test="id != null">
+            AND id = #{id}
+        </if>
     </select>
 
     <select id="getStationNum" resultType="int">