From 3474a2ce0a88379fcdf89f23d0fb7530817947f5 Mon Sep 17 00:00:00 2001 From: wenjy Date: Sun, 15 May 2022 14:43:43 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E9=A6=96=E9=A1=B5=E4=BC=A0?= =?UTF-8?q?=E6=84=9F=E5=99=A8=E6=95=B0=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/iot/IndexController.java | 64 +++++++++++++------ 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java index 287cef8..30189d7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java @@ -218,11 +218,16 @@ public class IndexController { List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); List baseSensorInfoDtos = new ArrayList<>(); - for (SysRole sysRole : sysRoles) { - BaseSensorInfo baseSensorInfo = new BaseSensorInfo(); - baseSensorInfo.setEnableFlag(0L); - baseSensorInfo.setRoleId(sysRole.getRoleId()); - List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + if(!ShiroUtils.getLoginName().equals("admin")){ + for (SysRole sysRole : sysRoles) { + BaseSensorInfo baseSensorInfo = new BaseSensorInfo(); + baseSensorInfo.setEnableFlag(0L); + baseSensorInfo.setRoleId(sysRole.getRoleId()); + List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + baseSensorInfoDtos.addAll(baseSensorInfoDtos1); + } + }else { + List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(null,0L)); baseSensorInfoDtos.addAll(baseSensorInfoDtos1); } @@ -303,13 +308,18 @@ public class IndexController { baseSensorTypeList.forEach( x -> { List baseSensorInfoDtos = new ArrayList<>(); - for (SysRole sysRole : sysRoles) { - // - BaseSensorInfo baseSensorInfo = new BaseSensorInfo(); - baseSensorInfo.setEnableFlag(0L); - baseSensorInfo.setRoleId(sysRole.getRoleId()); - baseSensorInfo.setSensorType(x.getSensortypeId()); - List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + if(!ShiroUtils.getLoginName().equals("admin")){ + for (SysRole sysRole : sysRoles) { + // + BaseSensorInfo baseSensorInfo = new BaseSensorInfo(); + baseSensorInfo.setEnableFlag(0L); + baseSensorInfo.setRoleId(sysRole.getRoleId()); + baseSensorInfo.setSensorType(x.getSensortypeId()); + List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + baseSensorInfoDtos.addAll(baseSensorInfoDtos1); + } + }else{ + List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(x.getSensortypeId(),0L)); baseSensorInfoDtos.addAll(baseSensorInfoDtos1); } @@ -371,20 +381,32 @@ public class IndexController { SysUser sysUser = ShiroUtils.getSysUser(); List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); - for (SysRole sysRole : sysRoles) { - // - BaseSensorInfo baseSensorInfo = new BaseSensorInfo(); - baseSensorInfo.setEnableFlag(0L); - baseSensorInfo.setRoleId(sysRole.getRoleId()); - List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + + if(!ShiroUtils.getLoginName().equals("admin")){ + for (SysRole sysRole : sysRoles) { + // + BaseSensorInfo baseSensorInfo = new BaseSensorInfo(); + baseSensorInfo.setEnableFlag(0L); + baseSensorInfo.setRoleId(sysRole.getRoleId()); + List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + baseSensorInfoDtos.addAll(baseSensorInfoDtos1); + + BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo(); + baseMonitorunitInfo.setRoleId(sysRole.getRoleId()); + List baseMonitorunitInfoDtos = + baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); + baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos); + } + }else{ + + List baseSensorInfoDtos1 = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(null,0L)); baseSensorInfoDtos.addAll(baseSensorInfoDtos1); - BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo(); - baseMonitorunitInfo.setRoleId(sysRole.getRoleId()); List baseMonitorunitInfoDtos = - baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); + baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo()); baseMonitorunitInfoDtoList.addAll(baseMonitorunitInfoDtos); } + List result = new ArrayList() { {