From e8446928deab7ff5d9b03dcd1f8859d0504c46fa Mon Sep 17 00:00:00 2001 From: Wen JY Date: Tue, 4 Jul 2023 16:41:22 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E8=A7=92=E8=89=B2=E6=9D=83?= =?UTF-8?q?=E9=99=90=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/BaseMonitorunitInfoController.java | 4 ++-- .../controller/iot/DeviceMonitorController.java | 4 ++-- .../ruoyi/web/controller/iot/IndexController.java | 14 +++++++------- .../controller/iot/SensorSummaryController.java | 2 +- .../controller/iot/WisdomScenarioContorller.java | 8 ++++---- .../templates/section/transformer-detail.html | 2 +- .../com/ruoyi/system/service/ISysRoleService.java | 7 +++++++ .../service/impl/BaseSensorInfoServiceImpl.java | 2 +- .../system/service/impl/SysRoleServiceImpl.java | 15 +++++++++++++++ 9 files changed, 40 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java index 5a9958d..d47bb7b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java @@ -70,7 +70,7 @@ public class BaseMonitorunitInfoController extends BaseController { List baseMonitorunitInfoDtos = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(ShiroUtils.getLoginName().equals("admin")){ List baseMonitorunitInfoDtos1 = @@ -304,7 +304,7 @@ public class BaseMonitorunitInfoController extends BaseController { List baseMonitorunitInfoDtos = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(ShiroUtils.getLoginName().equals("admin")){ List baseMonitorunitInfoDtos1 = diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/DeviceMonitorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/DeviceMonitorController.java index b1dc0b2..22de437 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/DeviceMonitorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/DeviceMonitorController.java @@ -66,7 +66,7 @@ public class DeviceMonitorController { List baseMonitorunitInfoDtos = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(ShiroUtils.getLoginName().equals("admin")){ List baseMonitorunitInfoDtos1 = @@ -131,7 +131,7 @@ public class DeviceMonitorController { List baseMonitorunitInfos = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(ShiroUtils.getLoginName().equals("admin")){ List baseMonitorunitInfoDtos1 = 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 2278d4a..a589db0 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 @@ -69,7 +69,7 @@ public class IndexController { SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(!ShiroUtils.getLoginName().equals("admin")){ for (SysRole sysRole : sysRoles) { // @@ -159,7 +159,7 @@ public class IndexController { List baseMonitorunitInfoDtoList = new ArrayList(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(!ShiroUtils.getLoginName().equals("admin")){ for (SysRole sysRole : sysRoles) { @@ -237,7 +237,7 @@ public class IndexController { SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); List baseSensorInfoDtos = new ArrayList<>(); if(!ShiroUtils.getLoginName().equals("admin")){ @@ -324,7 +324,7 @@ public class IndexController { SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); baseSensorTypeList.forEach( @@ -405,7 +405,7 @@ public class IndexController { SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(!ShiroUtils.getLoginName().equals("admin")){ for (SysRole sysRole : sysRoles) { @@ -465,7 +465,7 @@ public class IndexController { List recordAlarms = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); for (SysRole sysRole : sysRoles) { RecordAlarm recordAlarm = new RecordAlarm(); recordAlarm.setRoleId(sysRole.getRoleId()); @@ -550,7 +550,7 @@ public class IndexController { List recordAlarmDtos1 = recordAlarmService.selectAlarmTrendList(""); recordAlarmDtos.addAll(recordAlarmDtos1); }else{ - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); for (SysRole sysRole : sysRoles) { RecordAlarm recordAlarm = new RecordAlarm(); recordAlarm.setRoleId(sysRole.getRoleId()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/SensorSummaryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/SensorSummaryController.java index e36f80a..80f0acb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/SensorSummaryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/SensorSummaryController.java @@ -77,7 +77,7 @@ public class SensorSummaryController extends BaseController { SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(ShiroUtils.getLoginName().equals("admin")){ List baseSensorInfoDto = diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/WisdomScenarioContorller.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/WisdomScenarioContorller.java index bd4c8f9..6296279 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/WisdomScenarioContorller.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/WisdomScenarioContorller.java @@ -63,7 +63,7 @@ public class WisdomScenarioContorller extends BaseController { SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(!ShiroUtils.getLoginName().equals("admin")){ for (SysRole sysRole : sysRoles) { @@ -136,7 +136,7 @@ public class WisdomScenarioContorller extends BaseController { List baseMonitorunitInfoDtos = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(!ShiroUtils.getLoginName().equals("admin")){ for (SysRole sysRole : sysRoles) { @@ -184,7 +184,7 @@ public class WisdomScenarioContorller extends BaseController { List baseAlarmModuleDtos = new ArrayList(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(!ShiroUtils.getLoginName().equals("admin")){ for (SysRole sysRole : sysRoles) { @@ -248,7 +248,7 @@ public class WisdomScenarioContorller extends BaseController { List recordAlarmDtos = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); for (SysRole sysRole : sysRoles) { RecordAlarm recordAlarm = new RecordAlarm(); recordAlarm.setRoleId(sysRole.getRoleId()); diff --git a/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html b/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html index de2a422..e5d1fa3 100644 --- a/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html +++ b/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html @@ -638,7 +638,7 @@ html += '

' + x.paramTitle + ':' + x.paramValue + '

'; }); } - html += '

所属变电站:' + res[0].substationName + '

'; + /*html += '

所属变电站:' + res[0].substationName + '

';*/ $("#sensor-text").append(html); }, error: () => { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index d2fc3a7..eda7258 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -36,6 +36,13 @@ public interface ISysRoleService */ public List selectRolesByUserId(Long userId); + /** + * 根据用户ID获取所具备的角色信息 + * @param userId + * @return + */ + public List GetRoleInfoByUserId(Long userId); + /** * 查询所有角色 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java index 4ad04d3..b4f7b9f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseSensorInfoServiceImpl.java @@ -61,7 +61,7 @@ public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService List list = new ArrayList<>(); SysUser sysUser = ShiroUtils.getSysUser(); - List sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId()); + List sysRoles = iSysRoleService.GetRoleInfoByUserId(sysUser.getUserId()); if(ShiroUtils.getLoginName().equals("admin")){ List baseSensorInfoDtos = baseSensorInfoMapper.selectBaseSensorInfoList(baseSensorInfo); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 595acd1..c9c22b4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -108,6 +108,21 @@ public class SysRoleServiceImpl implements ISysRoleService return roles; } + /** + * 根据用户ID获取所具备的角色信息 + * @param userId + * @return + */ + public List GetRoleInfoByUserId(Long userId) + { + List userRoles = roleMapper.selectRolesByUserId(userId); + List roles = selectRoleAll(); + if (userRoles.size() == 0){ + return roles; + } + return userRoles; + } + /** * 查询所有角色 *