wangzhe 3 năm trước cách đây
mục cha
commit
24f129447c

+ 5 - 1
mybusiness/src/main/java/com/business/slfh/app/dahua/controller/Dahua_Controller.java

@@ -2,6 +2,7 @@ package com.business.slfh.app.dahua.controller;
 
 import com.business.slfh.manager.cameramanager.domain.TResCamera;
 import com.business.slfh.manager.cameramanager.service.ITResCameraService;
+import com.sooka.framework.util.ShiroUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,7 +21,10 @@ public class Dahua_Controller {
     @CrossOrigin
     @RequestMapping("queryAllCameras")
     public List queryAllCameras(){
-        List ls = itResCameraService.selectTResCameraList(new TResCamera());
+        Long deptId = ShiroUtils.getSysUser().getDeptId();//本部门及其以下部门的摄像头
+        TResCamera tResCamera= new TResCamera();
+        tResCamera.setDeptIdBelow(deptId);
+        List ls = itResCameraService.selectTResCameraList(tResCamera);
         return ls;
     }
 

+ 4 - 0
mybusiness/src/main/java/com/business/slfh/manager/cameramanager/domain/TResCamera.java

@@ -77,6 +77,10 @@ public class TResCamera  extends BaseEntity implements Cloneable
      */
     private Long deptId;
     /**
+     * 所属林场部门id,查询条件当前及下属部门
+     */
+    private Long deptIdBelow;
+    /**
      * 所属林场部门名称
      */
     private String deptName;

+ 3 - 0
mybusiness/src/main/resources/mapper/grid/manager/TResCameraMapper.xml

@@ -61,6 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="hikDeviceport != null  and hikDeviceport != ''"> and hik_deviceport = #{hikDeviceport}</if>
             <if test="hikCameraId != null  and hikCameraId != ''"> and hik_camera_id = #{hikCameraId}</if>
             <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
+            <if test="deptIdBelow != null and deptIdBelow != 0">
+                AND (u.dept_id = #{deptIdBelow} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptIdBelow},ancestors) ))
+            </if>
             <if test="orgDeptId != null  and orgDeptId != ''"> and org_dept_id = #{orgDeptId}</if>
             <if test="createUserId != null  and createUserId != ''"> and create_user_id = #{createUserId}</if>
             <if test="radius != null  and radius != ''"> and radius = #{radius}</if>