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() { {