From 49ac1803293cab5fea44d2f075e151bbc501284b Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 16 三月 2022 12:59:04 +0800 Subject: [PATCH] update 优化 SysRole 部分字段类型 防止数据库类型映射异常 --- script/sql/postgres/postgres_ry_vue_4.X.sql | 4 ++-- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 2 +- ruoyi-ui/src/views/system/role/index.vue | 16 ++++++++-------- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 2 +- ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java | 4 ++-- 5 files changed, 14 insertions(+), 14 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 662989e..3c2ff4f 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 @@ -77,13 +77,13 @@ * 鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級 */ @ApiModelProperty(value = "鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級") - private boolean menuCheckStrictly; + private Integer menuCheckStrictly; /** * 閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀� 锛� */ @ApiModelProperty(value = "閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀� 锛�") - private boolean deptCheckStrictly; + private Integer deptCheckStrictly; /** * 瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛� 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 6b6fddd..0b6fc70 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 @@ @Override public List<Long> selectDeptListByRoleId(Long roleId) { SysRole role = roleMapper.selectById(roleId); - return baseMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); + return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly() == 1); } /** 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 5b6213e..8772313 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 @@ @Override public List<Long> selectMenuListByRoleId(Long roleId) { SysRole role = roleMapper.selectById(roleId); - return baseMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); + return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly() == 1); } /** diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index b08cf34..a120245 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -187,14 +187,14 @@ <el-form-item label="鑿滃崟鏉冮檺"> <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">灞曞紑/鎶樺彔</el-checkbox> <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">鍏ㄩ��/鍏ㄤ笉閫�</el-checkbox> - <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">鐖跺瓙鑱斿姩</el-checkbox> + <el-checkbox v-model="form.menuCheckStrictly == 1" @change="handleCheckedTreeConnect($event, 'menu')">鐖跺瓙鑱斿姩</el-checkbox> <el-tree class="tree-border" :data="menuOptions" show-checkbox ref="menu" node-key="id" - :check-strictly="!form.menuCheckStrictly" + :check-strictly="!form.menuCheckStrictly == 1" empty-text="鍔犺浇涓紝璇风◢鍊�" :props="defaultProps" ></el-tree> @@ -231,7 +231,7 @@ <el-form-item label="鏁版嵁鏉冮檺" v-show="form.dataScope == 2"> <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">灞曞紑/鎶樺彔</el-checkbox> <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">鍏ㄩ��/鍏ㄤ笉閫�</el-checkbox> - <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">鐖跺瓙鑱斿姩</el-checkbox> + <el-checkbox v-model="form.deptCheckStrictly == 1" @change="handleCheckedTreeConnect($event, 'dept')">鐖跺瓙鑱斿姩</el-checkbox> <el-tree class="tree-border" :data="deptOptions" @@ -239,7 +239,7 @@ default-expand-all ref="dept" node-key="id" - :check-strictly="!form.deptCheckStrictly" + :check-strictly="!form.deptCheckStrictly == 1" empty-text="鍔犺浇涓紝璇风◢鍊�" :props="defaultProps" ></el-tree> @@ -440,8 +440,8 @@ status: "0", menuIds: [], deptIds: [], - menuCheckStrictly: true, - deptCheckStrictly: true, + menuCheckStrictly: 1, + deptCheckStrictly: 1, remark: undefined }; this.resetForm("form"); @@ -501,9 +501,9 @@ // 鏍戞潈闄愶紙鐖跺瓙鑱斿姩锛� handleCheckedTreeConnect(value, type) { if (type == 'menu') { - this.form.menuCheckStrictly = value ? true: false; + this.form.menuCheckStrictly = value ? 1: 0; } else if (type == 'dept') { - this.form.deptCheckStrictly = value ? true: false; + this.form.deptCheckStrictly = value ? 1: 0; } }, /** 鏂板鎸夐挳鎿嶄綔 */ diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql index 2a1132c..7a1a60d 100644 --- a/script/sql/postgres/postgres_ry_vue_4.X.sql +++ b/script/sql/postgres/postgres_ry_vue_4.X.sql @@ -157,8 +157,8 @@ role_key varchar(100) not null, role_sort int4 not null, data_scope char default '1'::bpchar, - menu_check_strictly smallint default 1, - dept_check_strictly smallint default 1, + menu_check_strictly int2 default 1, + dept_check_strictly int2 default 1, status char not null, del_flag char default '0'::bpchar, create_by varchar(64) default ''::varchar, -- Gitblit v1.9.3