Commit 478fae0d28938739a0b27c21f25178fd197dee6a
1 parent
0ecf27f8
菜单&数据权限新增(展开/折叠 全选/全不选 父子联动)
Showing
12 changed files
with
150 additions
and
39 deletions
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
| ... | ... | @@ -37,6 +37,12 @@ public class SysRole extends BaseEntity |
| 37 | 37 | @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") |
| 38 | 38 | private String dataScope; |
| 39 | 39 | |
| 40 | + /** 菜单树选择项是否关联显示(0:父子互相关联显示 1:父子不互相关联显示) */ | |
| 41 | + private boolean menuCheckStrictly; | |
| 42 | + | |
| 43 | + /** 部门树选择项是否关联显示(0:父子互相关联显示 1:父子不互相关联显示) */ | |
| 44 | + private boolean deptCheckStrictly; | |
| 45 | + | |
| 40 | 46 | /** 角色状态(0正常 1停用) */ |
| 41 | 47 | @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") |
| 42 | 48 | private String status; |
| ... | ... | @@ -128,6 +134,26 @@ public class SysRole extends BaseEntity |
| 128 | 134 | this.dataScope = dataScope; |
| 129 | 135 | } |
| 130 | 136 | |
| 137 | + public boolean isMenuCheckStrictly() | |
| 138 | + { | |
| 139 | + return menuCheckStrictly; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public void setMenuCheckStrictly(boolean menuCheckStrictly) | |
| 143 | + { | |
| 144 | + this.menuCheckStrictly = menuCheckStrictly; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public boolean isDeptCheckStrictly() | |
| 148 | + { | |
| 149 | + return deptCheckStrictly; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setDeptCheckStrictly(boolean deptCheckStrictly) | |
| 153 | + { | |
| 154 | + this.deptCheckStrictly = deptCheckStrictly; | |
| 155 | + } | |
| 156 | + | |
| 131 | 157 | public String getStatus() |
| 132 | 158 | { |
| 133 | 159 | return status; | ... | ... |
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
| ... | ... | @@ -23,9 +23,10 @@ public interface SysDeptMapper |
| 23 | 23 | * 根据角色ID查询部门树信息 |
| 24 | 24 | * |
| 25 | 25 | * @param roleId 角色ID |
| 26 | + * @param deptCheckStrictly 部门树选择项是否关联显示 | |
| 26 | 27 | * @return 选中部门列表 |
| 27 | 28 | */ |
| 28 | - public List<Integer> selectDeptListByRoleId(Long roleId); | |
| 29 | + public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); | |
| 29 | 30 | |
| 30 | 31 | /** |
| 31 | 32 | * 根据部门ID查询信息 | ... | ... |
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
| ... | ... | @@ -59,11 +59,12 @@ public interface SysMenuMapper |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * 根据角色ID查询菜单树信息 |
| 62 | - * | |
| 62 | + * | |
| 63 | 63 | * @param roleId 角色ID |
| 64 | + * @param menuCheckStrictly 菜单树选择项是否关联显示 | |
| 64 | 65 | * @return 选中菜单列表 |
| 65 | 66 | */ |
| 66 | - public List<Integer> selectMenuListByRoleId(Long roleId); | |
| 67 | + public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); | |
| 67 | 68 | |
| 68 | 69 | /** |
| 69 | 70 | * 根据菜单ID查询信息 | ... | ... |
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
| ... | ... | @@ -10,9 +10,11 @@ import com.ruoyi.common.annotation.DataScope; |
| 10 | 10 | import com.ruoyi.common.constant.UserConstants; |
| 11 | 11 | import com.ruoyi.common.core.domain.TreeSelect; |
| 12 | 12 | import com.ruoyi.common.core.domain.entity.SysDept; |
| 13 | +import com.ruoyi.common.core.domain.entity.SysRole; | |
| 13 | 14 | import com.ruoyi.common.exception.CustomException; |
| 14 | 15 | import com.ruoyi.common.utils.StringUtils; |
| 15 | 16 | import com.ruoyi.system.mapper.SysDeptMapper; |
| 17 | +import com.ruoyi.system.mapper.SysRoleMapper; | |
| 16 | 18 | import com.ruoyi.system.service.ISysDeptService; |
| 17 | 19 | |
| 18 | 20 | /** |
| ... | ... | @@ -26,6 +28,9 @@ public class SysDeptServiceImpl implements ISysDeptService |
| 26 | 28 | @Autowired |
| 27 | 29 | private SysDeptMapper deptMapper; |
| 28 | 30 | |
| 31 | + @Autowired | |
| 32 | + private SysRoleMapper roleMapper; | |
| 33 | + | |
| 29 | 34 | /** |
| 30 | 35 | * 查询部门管理数据 |
| 31 | 36 | * |
| ... | ... | @@ -93,7 +98,8 @@ public class SysDeptServiceImpl implements ISysDeptService |
| 93 | 98 | @Override |
| 94 | 99 | public List<Integer> selectDeptListByRoleId(Long roleId) |
| 95 | 100 | { |
| 96 | - return deptMapper.selectDeptListByRoleId(roleId); | |
| 101 | + SysRole role = roleMapper.selectRoleById(roleId); | |
| 102 | + return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); | |
| 97 | 103 | } |
| 98 | 104 | |
| 99 | 105 | /** | ... | ... |
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
| ... | ... | @@ -13,12 +13,14 @@ import org.springframework.stereotype.Service; |
| 13 | 13 | import com.ruoyi.common.constant.UserConstants; |
| 14 | 14 | import com.ruoyi.common.core.domain.TreeSelect; |
| 15 | 15 | import com.ruoyi.common.core.domain.entity.SysMenu; |
| 16 | +import com.ruoyi.common.core.domain.entity.SysRole; | |
| 16 | 17 | import com.ruoyi.common.core.domain.entity.SysUser; |
| 17 | 18 | import com.ruoyi.common.utils.SecurityUtils; |
| 18 | 19 | import com.ruoyi.common.utils.StringUtils; |
| 19 | 20 | import com.ruoyi.system.domain.vo.MetaVo; |
| 20 | 21 | import com.ruoyi.system.domain.vo.RouterVo; |
| 21 | 22 | import com.ruoyi.system.mapper.SysMenuMapper; |
| 23 | +import com.ruoyi.system.mapper.SysRoleMapper; | |
| 22 | 24 | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| 23 | 25 | import com.ruoyi.system.service.ISysMenuService; |
| 24 | 26 | |
| ... | ... | @@ -36,6 +38,9 @@ public class SysMenuServiceImpl implements ISysMenuService |
| 36 | 38 | private SysMenuMapper menuMapper; |
| 37 | 39 | |
| 38 | 40 | @Autowired |
| 41 | + private SysRoleMapper roleMapper; | |
| 42 | + | |
| 43 | + @Autowired | |
| 39 | 44 | private SysRoleMenuMapper roleMenuMapper; |
| 40 | 45 | |
| 41 | 46 | /** |
| ... | ... | @@ -124,7 +129,8 @@ public class SysMenuServiceImpl implements ISysMenuService |
| 124 | 129 | @Override |
| 125 | 130 | public List<Integer> selectMenuListByRoleId(Long roleId) |
| 126 | 131 | { |
| 127 | - return menuMapper.selectMenuListByRoleId(roleId); | |
| 132 | + SysRole role = roleMapper.selectRoleById(roleId); | |
| 133 | + return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); | |
| 128 | 134 | } |
| 129 | 135 | |
| 130 | 136 | /** | ... | ... |
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
| ... | ... | @@ -44,12 +44,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 44 | 44 | order by d.parent_id, d.order_num |
| 45 | 45 | </select> |
| 46 | 46 | |
| 47 | - <select id="selectDeptListByRoleId" parameterType="Long" resultType="Integer"> | |
| 48 | - select d.dept_id, d.parent_id | |
| 47 | + <select id="selectDeptListByRoleId" resultType="Integer"> | |
| 48 | + select d.dept_id | |
| 49 | 49 | from sys_dept d |
| 50 | 50 | left join sys_role_dept rd on d.dept_id = rd.dept_id |
| 51 | 51 | where rd.role_id = #{roleId} |
| 52 | - and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) | |
| 52 | + <if test="deptCheckStrictly"> | |
| 53 | + and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) | |
| 54 | + </if> | |
| 53 | 55 | order by d.parent_id, d.order_num |
| 54 | 56 | </select> |
| 55 | 57 | ... | ... |
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
| ... | ... | @@ -82,12 +82,14 @@ |
| 82 | 82 | order by m.parent_id, m.order_num |
| 83 | 83 | </select> |
| 84 | 84 | |
| 85 | - <select id="selectMenuListByRoleId" parameterType="Long" resultType="Integer"> | |
| 86 | - select m.menu_id, m.parent_id | |
| 85 | + <select id="selectMenuListByRoleId" resultType="Integer"> | |
| 86 | + select m.menu_id | |
| 87 | 87 | from sys_menu m |
| 88 | 88 | left join sys_role_menu rm on m.menu_id = rm.menu_id |
| 89 | 89 | where rm.role_id = #{roleId} |
| 90 | - and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId}) | |
| 90 | + <if test="menuCheckStrictly"> | |
| 91 | + and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId}) | |
| 92 | + </if> | |
| 91 | 93 | order by m.parent_id, m.order_num |
| 92 | 94 | </select> |
| 93 | 95 | ... | ... |
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
| ... | ... | @@ -5,22 +5,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 5 | 5 | <mapper namespace="com.ruoyi.system.mapper.SysRoleMapper"> |
| 6 | 6 | |
| 7 | 7 | <resultMap type="SysRole" id="SysRoleResult"> |
| 8 | - <id property="roleId" column="role_id" /> | |
| 9 | - <result property="roleName" column="role_name" /> | |
| 10 | - <result property="roleKey" column="role_key" /> | |
| 11 | - <result property="roleSort" column="role_sort" /> | |
| 12 | - <result property="dataScope" column="data_scope" /> | |
| 13 | - <result property="status" column="status" /> | |
| 14 | - <result property="delFlag" column="del_flag" /> | |
| 15 | - <result property="createBy" column="create_by" /> | |
| 16 | - <result property="createTime" column="create_time" /> | |
| 17 | - <result property="updateBy" column="update_by" /> | |
| 18 | - <result property="updateTime" column="update_time" /> | |
| 19 | - <result property="remark" column="remark" /> | |
| 8 | + <id property="roleId" column="role_id" /> | |
| 9 | + <result property="roleName" column="role_name" /> | |
| 10 | + <result property="roleKey" column="role_key" /> | |
| 11 | + <result property="roleSort" column="role_sort" /> | |
| 12 | + <result property="dataScope" column="data_scope" /> | |
| 13 | + <result property="menuCheckStrictly" column="menu_check_strictly" /> | |
| 14 | + <result property="deptCheckStrictly" column="dept_check_strictly" /> | |
| 15 | + <result property="status" column="status" /> | |
| 16 | + <result property="delFlag" column="del_flag" /> | |
| 17 | + <result property="createBy" column="create_by" /> | |
| 18 | + <result property="createTime" column="create_time" /> | |
| 19 | + <result property="updateBy" column="update_by" /> | |
| 20 | + <result property="updateTime" column="update_time" /> | |
| 21 | + <result property="remark" column="remark" /> | |
| 20 | 22 | </resultMap> |
| 21 | 23 | |
| 22 | 24 | <sql id="selectRoleVo"> |
| 23 | - select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, | |
| 25 | + select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, | |
| 24 | 26 | r.status, r.del_flag, r.create_time, r.remark |
| 25 | 27 | from sys_role r |
| 26 | 28 | left join sys_user_role ur on ur.role_id = r.role_id |
| ... | ... | @@ -95,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 95 | 97 | <if test="roleKey != null and roleKey != ''">role_key,</if> |
| 96 | 98 | <if test="roleSort != null and roleSort != ''">role_sort,</if> |
| 97 | 99 | <if test="dataScope != null and dataScope != ''">data_scope,</if> |
| 100 | + <if test="menuCheckStrictly != null and menuCheckStrictly != ''">menu_check_strictly,</if> | |
| 101 | + <if test="deptCheckStrictly != null and deptCheckStrictly != ''">dept_check_strictly,</if> | |
| 98 | 102 | <if test="status != null and status != ''">status,</if> |
| 99 | 103 | <if test="remark != null and remark != ''">remark,</if> |
| 100 | 104 | <if test="createBy != null and createBy != ''">create_by,</if> |
| ... | ... | @@ -105,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 105 | 109 | <if test="roleKey != null and roleKey != ''">#{roleKey},</if> |
| 106 | 110 | <if test="roleSort != null and roleSort != ''">#{roleSort},</if> |
| 107 | 111 | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> |
| 112 | + <if test="menuCheckStrictly != null">#{menu_check_strictly},</if> | |
| 113 | + <if test="deptCheckStrictly != null">#{dept_check_strictly},</if> | |
| 108 | 114 | <if test="status != null and status != ''">#{status},</if> |
| 109 | 115 | <if test="remark != null and remark != ''">#{remark},</if> |
| 110 | 116 | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| ... | ... | @@ -119,6 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 119 | 125 | <if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if> |
| 120 | 126 | <if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if> |
| 121 | 127 | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> |
| 128 | + <if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if> | |
| 129 | + <if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if> | |
| 122 | 130 | <if test="status != null and status != ''">status = #{status},</if> |
| 123 | 131 | <if test="remark != null">remark = #{remark},</if> |
| 124 | 132 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> | ... | ... |
ruoyi-ui/src/assets/styles/ruoyi.scss
| ... | ... | @@ -92,6 +92,14 @@ |
| 92 | 92 | padding: 10px 20px !important; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | +/* tree border */ | |
| 96 | +.tree-border { | |
| 97 | + margin-top: 5px; | |
| 98 | + border: 1px solid #e5e6e7; | |
| 99 | + background: #FFFFFF none; | |
| 100 | + border-radius:4px; | |
| 101 | +} | |
| 102 | + | |
| 95 | 103 | .pagination-container .el-pagination { |
| 96 | 104 | right: 0; |
| 97 | 105 | position: absolute; | ... | ... |
ruoyi-ui/src/views/system/role/index.vue
| ... | ... | @@ -175,11 +175,16 @@ |
| 175 | 175 | </el-radio-group> |
| 176 | 176 | </el-form-item> |
| 177 | 177 | <el-form-item label="菜单权限"> |
| 178 | + <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox> | |
| 179 | + <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox> | |
| 180 | + <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox> | |
| 178 | 181 | <el-tree |
| 182 | + class="tree-border" | |
| 179 | 183 | :data="menuOptions" |
| 180 | 184 | show-checkbox |
| 181 | 185 | ref="menu" |
| 182 | 186 | node-key="id" |
| 187 | + :check-strictly="!form.menuCheckStrictly" | |
| 183 | 188 | empty-text="加载中,请稍后" |
| 184 | 189 | :props="defaultProps" |
| 185 | 190 | ></el-tree> |
| ... | ... | @@ -214,12 +219,17 @@ |
| 214 | 219 | </el-select> |
| 215 | 220 | </el-form-item> |
| 216 | 221 | <el-form-item label="数据权限" v-show="form.dataScope == 2"> |
| 222 | + <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox> | |
| 223 | + <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox> | |
| 224 | + <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox> | |
| 217 | 225 | <el-tree |
| 226 | + class="tree-border" | |
| 218 | 227 | :data="deptOptions" |
| 219 | 228 | show-checkbox |
| 220 | 229 | default-expand-all |
| 221 | 230 | ref="dept" |
| 222 | 231 | node-key="id" |
| 232 | + :check-strictly="!form.deptCheckStrictly" | |
| 223 | 233 | empty-text="加载中,请稍后" |
| 224 | 234 | :props="defaultProps" |
| 225 | 235 | ></el-tree> |
| ... | ... | @@ -262,6 +272,10 @@ export default { |
| 262 | 272 | open: false, |
| 263 | 273 | // 是否显示弹出层(数据权限) |
| 264 | 274 | openDataScope: false, |
| 275 | + menuExpand: false, | |
| 276 | + menuNodeAll: false, | |
| 277 | + deptExpand: true, | |
| 278 | + deptNodeAll: false, | |
| 265 | 279 | // 日期范围 |
| 266 | 280 | dateRange: [], |
| 267 | 281 | // 状态数据字典 |
| ... | ... | @@ -413,6 +427,10 @@ export default { |
| 413 | 427 | if (this.$refs.menu != undefined) { |
| 414 | 428 | this.$refs.menu.setCheckedKeys([]); |
| 415 | 429 | } |
| 430 | + this.menuExpand = false, | |
| 431 | + this.menuNodeAll = false, | |
| 432 | + this.deptExpand = true, | |
| 433 | + this.deptNodeAll = false, | |
| 416 | 434 | this.form = { |
| 417 | 435 | roleId: undefined, |
| 418 | 436 | roleName: undefined, |
| ... | ... | @@ -421,6 +439,7 @@ export default { |
| 421 | 439 | status: "0", |
| 422 | 440 | menuIds: [], |
| 423 | 441 | deptIds: [], |
| 442 | + menuCheckStrictly: true, | |
| 424 | 443 | remark: undefined |
| 425 | 444 | }; |
| 426 | 445 | this.resetForm("form"); |
| ... | ... | @@ -442,6 +461,36 @@ export default { |
| 442 | 461 | this.single = selection.length!=1 |
| 443 | 462 | this.multiple = !selection.length |
| 444 | 463 | }, |
| 464 | + // 树权限(展开/折叠) | |
| 465 | + handleCheckedTreeExpand(value, type) { | |
| 466 | + if (type == 'menu') { | |
| 467 | + let treeList = this.menuOptions; | |
| 468 | + for (let i = 0; i < treeList.length; i++) { | |
| 469 | + this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value; | |
| 470 | + } | |
| 471 | + } else if (type == 'dept') { | |
| 472 | + let treeList = this.deptOptions; | |
| 473 | + for (let i = 0; i < treeList.length; i++) { | |
| 474 | + this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value; | |
| 475 | + } | |
| 476 | + } | |
| 477 | + }, | |
| 478 | + // 树权限(全选/全不选) | |
| 479 | + handleCheckedTreeNodeAll(value, type) { | |
| 480 | + if (type == 'menu') { | |
| 481 | + this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []); | |
| 482 | + } else if (type == 'dept') { | |
| 483 | + this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []); | |
| 484 | + } | |
| 485 | + }, | |
| 486 | + // 树权限(父子联动) | |
| 487 | + handleCheckedTreeConnect(value, type) { | |
| 488 | + if (type == 'menu') { | |
| 489 | + this.form.menuCheckStrictly = value ? true: false; | |
| 490 | + } else if (type == 'dept') { | |
| 491 | + this.form.deptCheckStrictly = value ? true: false; | |
| 492 | + } | |
| 493 | + }, | |
| 445 | 494 | /** 新增按钮操作 */ |
| 446 | 495 | handleAdd() { |
| 447 | 496 | this.reset(); | ... | ... |
ruoyi-ui/src/views/system/user/index.vue
| ... | ... | @@ -93,7 +93,7 @@ |
| 93 | 93 | </el-col> |
| 94 | 94 | <el-col :span="12"> |
| 95 | 95 | <el-form-item label="归属部门" prop="deptId"> |
| 96 | - <treeselect v-model="form.deptId" :options="deptOptions" :disable-branch-nodes="true" :show-count="true" placeholder="请选择归属部门" /> | |
| 96 | + <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" /> | |
| 97 | 97 | </el-form-item> |
| 98 | 98 | </el-col> |
| 99 | 99 | </el-row> | ... | ... |
sql/ry_20200901.sql renamed to sql/ry_20200919.sql
| ... | ... | @@ -102,26 +102,28 @@ insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', '2018-0 |
| 102 | 102 | -- ---------------------------- |
| 103 | 103 | drop table if exists sys_role; |
| 104 | 104 | create table sys_role ( |
| 105 | - role_id bigint(20) not null auto_increment comment '角色ID', | |
| 106 | - role_name varchar(30) not null comment '角色名称', | |
| 107 | - role_key varchar(100) not null comment '角色权限字符串', | |
| 108 | - role_sort int(4) not null comment '显示顺序', | |
| 109 | - data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', | |
| 110 | - status char(1) not null comment '角色状态(0正常 1停用)', | |
| 111 | - del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', | |
| 112 | - create_by varchar(64) default '' comment '创建者', | |
| 113 | - create_time datetime comment '创建时间', | |
| 114 | - update_by varchar(64) default '' comment '更新者', | |
| 115 | - update_time datetime comment '更新时间', | |
| 116 | - remark varchar(500) default null comment '备注', | |
| 105 | + role_id bigint(20) not null auto_increment comment '角色ID', | |
| 106 | + role_name varchar(30) not null comment '角色名称', | |
| 107 | + role_key varchar(100) not null comment '角色权限字符串', | |
| 108 | + role_sort int(4) not null comment '显示顺序', | |
| 109 | + data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', | |
| 110 | + menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示', | |
| 111 | + dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示', | |
| 112 | + status char(1) not null comment '角色状态(0正常 1停用)', | |
| 113 | + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', | |
| 114 | + create_by varchar(64) default '' comment '创建者', | |
| 115 | + create_time datetime comment '创建时间', | |
| 116 | + update_by varchar(64) default '' comment '更新者', | |
| 117 | + update_time datetime comment '更新时间', | |
| 118 | + remark varchar(500) default null comment '备注', | |
| 117 | 119 | primary key (role_id) |
| 118 | 120 | ) engine=innodb auto_increment=100 comment = '角色信息表'; |
| 119 | 121 | |
| 120 | 122 | -- ---------------------------- |
| 121 | 123 | -- 初始化-角色信息表数据 |
| 122 | 124 | -- ---------------------------- |
| 123 | -insert into sys_role values('1', '超级管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '超级管理员'); | |
| 124 | -insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); | |
| 125 | +insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '超级管理员'); | |
| 126 | +insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); | |
| 125 | 127 | |
| 126 | 128 | |
| 127 | 129 | -- ---------------------------- | ... | ... |