update 修改角色适配 采用 get set 转换数据类型

2.X
疯狂的狮子Li 3 years ago
parent f644709a99
commit 73eb9cc7d7

@ -137,4 +137,33 @@ public class SysRole extends BaseEntity {
return UserConstants.ADMIN_ID.equals(this.roleId); return UserConstants.ADMIN_ID.equals(this.roleId);
} }
public Boolean getMenuCheckStrictly() {
if (menuCheckStrictly == null) {
return null;
}
return menuCheckStrictly == 1;
}
public void setMenuCheckStrictly(Boolean menuCheckStrictly) {
if (menuCheckStrictly == null) {
this.menuCheckStrictly = null;
return;
}
this.menuCheckStrictly = menuCheckStrictly ? 1 : 0;
}
public Boolean getDeptCheckStrictly() {
if (deptCheckStrictly == null) {
return null;
}
return deptCheckStrictly == 1;
}
public void setDeptCheckStrictly(Boolean deptCheckStrictly) {
if (deptCheckStrictly == null) {
this.deptCheckStrictly = null;
return;
}
this.deptCheckStrictly = deptCheckStrictly ? 1 : 0;
}
} }

@ -84,7 +84,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override @Override
public List<Long> selectDeptListByRoleId(Long roleId) { public List<Long> selectDeptListByRoleId(Long roleId) {
SysRole role = roleMapper.selectById(roleId); SysRole role = roleMapper.selectById(roleId);
return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly() == 1); return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
} }
/** /**

@ -123,7 +123,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
@Override @Override
public List<Long> selectMenuListByRoleId(Long roleId) { public List<Long> selectMenuListByRoleId(Long roleId) {
SysRole role = roleMapper.selectById(roleId); SysRole role = roleMapper.selectById(roleId);
return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly() == 1); return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
} }
/** /**

@ -187,14 +187,14 @@
<el-form-item label="菜单权限"> <el-form-item label="菜单权限">
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">/</el-checkbox> <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="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">/</el-checkbox>
<el-checkbox v-model="form.menuCheckStrictly == 1" @change="handleCheckedTreeConnect($event, 'menu')"></el-checkbox> <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')"></el-checkbox>
<el-tree <el-tree
class="tree-border" class="tree-border"
:data="menuOptions" :data="menuOptions"
show-checkbox show-checkbox
ref="menu" ref="menu"
node-key="id" node-key="id"
:check-strictly="!form.menuCheckStrictly == 1" :check-strictly="!form.menuCheckStrictly"
empty-text="加载中,请稍候" empty-text="加载中,请稍候"
:props="defaultProps" :props="defaultProps"
></el-tree> ></el-tree>
@ -231,7 +231,7 @@
<el-form-item label="数据权限" v-show="form.dataScope == 2"> <el-form-item label="数据权限" v-show="form.dataScope == 2">
<el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">/</el-checkbox> <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="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">/</el-checkbox>
<el-checkbox v-model="form.deptCheckStrictly == 1" @change="handleCheckedTreeConnect($event, 'dept')"></el-checkbox> <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')"></el-checkbox>
<el-tree <el-tree
class="tree-border" class="tree-border"
:data="deptOptions" :data="deptOptions"
@ -239,7 +239,7 @@
default-expand-all default-expand-all
ref="dept" ref="dept"
node-key="id" node-key="id"
:check-strictly="!form.deptCheckStrictly == 1" :check-strictly="!form.deptCheckStrictly"
empty-text="加载中,请稍候" empty-text="加载中,请稍候"
:props="defaultProps" :props="defaultProps"
></el-tree> ></el-tree>
@ -440,8 +440,8 @@ export default {
status: "0", status: "0",
menuIds: [], menuIds: [],
deptIds: [], deptIds: [],
menuCheckStrictly: 1, menuCheckStrictly: true,
deptCheckStrictly: 1, deptCheckStrictly: true,
remark: undefined remark: undefined
}; };
this.resetForm("form"); this.resetForm("form");
@ -501,9 +501,9 @@ export default {
// //
handleCheckedTreeConnect(value, type) { handleCheckedTreeConnect(value, type) {
if (type == 'menu') { if (type == 'menu') {
this.form.menuCheckStrictly = value ? 1: 0; this.form.menuCheckStrictly = value ? true: false;
} else if (type == 'dept') { } else if (type == 'dept') {
this.form.deptCheckStrictly = value ? 1: 0; this.form.deptCheckStrictly = value ? true: false;
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */

Loading…
Cancel
Save