From a6f30412ade38bc49585fd64e3f0746161db3ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Fri, 25 Mar 2022 15:22:01 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E9=80=82=E9=85=8D=20=E9=87=87=E7=94=A8=20get=20set=20=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/domain/entity/SysRole.java | 21 +++++++++++++++++++ .../service/impl/SysDeptServiceImpl.java | 2 +- .../service/impl/SysMenuServiceImpl.java | 2 +- ruoyi-ui/src/views/system/role/index.vue | 16 +++++++------- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 8d9166097..7e65339f4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -137,4 +137,25 @@ public class SysRole extends BaseEntity { return UserConstants.ADMIN_ID.equals(this.roleId); } + public Boolean getMenuCheckStrictly() { + if (menuCheckStrictly == null) { + return null; + } + return menuCheckStrictly == 1; + } + + public void setMenuCheckStrictly(Boolean menuCheckStrictly) { + this.menuCheckStrictly = menuCheckStrictly ? 1 : 0; + } + + public Boolean getDeptCheckStrictly() { + if (deptCheckStrictly == null) { + return null; + } + return deptCheckStrictly == 1; + } + + public void setDeptCheckStrictly(Boolean deptCheckStrictly) { + this.deptCheckStrictly = deptCheckStrictly ? 1 : 0; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 0b6fc7064..32e06d3d4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -85,7 +85,7 @@ public class SysDeptServiceImpl implements ISysDeptService { @Override public List selectDeptListByRoleId(Long roleId) { SysRole role = roleMapper.selectById(roleId); - return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly() == 1); + return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly()); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 87723134c..2f9d0020a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -123,7 +123,7 @@ public class SysMenuServiceImpl implements ISysMenuService { @Override public List selectMenuListByRoleId(Long roleId) { SysRole role = roleMapper.selectById(roleId); - return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly() == 1); + return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly()); } /** diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index a1202451f..b08cf3474 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -187,14 +187,14 @@ 展开/折叠 全选/全不选 - 父子联动 + 父子联动 @@ -231,7 +231,7 @@ 展开/折叠 全选/全不选 - 父子联动 + 父子联动 @@ -440,8 +440,8 @@ export default { status: "0", menuIds: [], deptIds: [], - menuCheckStrictly: 1, - deptCheckStrictly: 1, + menuCheckStrictly: true, + deptCheckStrictly: true, remark: undefined }; this.resetForm("form"); @@ -501,9 +501,9 @@ export default { // 树权限(父子联动) handleCheckedTreeConnect(value, type) { if (type == 'menu') { - this.form.menuCheckStrictly = value ? 1: 0; + this.form.menuCheckStrictly = value ? true: false; } else if (type == 'dept') { - this.form.deptCheckStrictly = value ? 1: 0; + this.form.deptCheckStrictly = value ? true: false; } }, /** 新增按钮操作 */