zhangnaisong
2024-05-27 a3d274cc185968709ff240cd77a11a31df045183
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -56,13 +56,13 @@
    private SysDeptMapper sysDeptMapper;
    @Resource
    private RedisCache redisCache;
    @Autowired
    @Resource
    private ISysDeptService deptService;
    @Resource
    private ArdChannelMapper ardChannelMapper;
    @Resource
    private IVtduService vtduService;
    @Autowired
    @Resource
    protected Validator validator;
    @PostConstruct
@@ -565,10 +565,25 @@
    @Override
    public List<Map<String, Object>> getCamerasByDeptId(Long deptId,String userId) {
        List<Map<String, Object>> result = ardCamerasMapper.getCamerasByDeptId(deptId,userId);
        List<Long> deptIdList = new ArrayList();
        deptIdList.add(deptId);
        deptIdList = getOwnAndChildrenDeptIdList(deptIdList,new ArrayList());//递归查询下属部门主键
        //List<Map<String, Object>> result = ardCamerasMapper.getCamerasByDeptId(deptId,userId);
        List<Map<String, Object>> result = ardCamerasMapper.getCamerasByDeptId(deptIdList,userId);
        return result;
    }
    public List<Long> getOwnAndChildrenDeptIdList(List<Long> deptIdList,List<Long> deptIdListr){
        deptIdListr.addAll(deptIdList);
        List<Long> result = sysDeptMapper.getChildrenDeptIdList(deptIdList);
        if(result.size() != 0){
            deptIdListr.addAll(result);
            result = getOwnAndChildrenDeptIdList(result,deptIdListr);
        }
        deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList());
        return deptIdListr;
    }
    @Override
    public Boolean getCameraOperationByCameraId(String id, String userId) {
        Boolean result = ardCamerasMapper.getCameraOperationByCameraId(id,userId);