| | |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.ruoyi.common.core.constant.GlobalConstants; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.excel.utils.ExcelUtil; |
| | |
| | | import com.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import com.ruoyi.common.satoken.utils.LoginHelper; |
| | | import com.ruoyi.common.web.core.BaseController; |
| | | import com.ruoyi.system.domain.SysDept; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.domain.bo.SysDeptBo; |
| | | import com.ruoyi.system.domain.bo.SysRoleBo; |
| | | import com.ruoyi.system.domain.bo.SysUserBo; |
| | | import com.ruoyi.system.domain.vo.DeptTreeSelectVo; |
| | |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<Void> add(@Validated @RequestBody SysRoleBo role) { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { |
| | | if (!roleService.checkRoleNameUnique(role)) { |
| | | return R.fail("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { |
| | | } else if (!roleService.checkRoleKeyUnique(role)) { |
| | | return R.fail("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | return toAjax(roleService.insertRole(role)); |
| | |
| | | public R<Void> edit(@Validated @RequestBody SysRoleBo role) { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { |
| | | if (!roleService.checkRoleNameUnique(role)) { |
| | | return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { |
| | | } else if (!roleService.checkRoleKeyUnique(role)) { |
| | | return R.fail("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | |
| | |
| | | public R<DeptTreeSelectVo> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { |
| | | DeptTreeSelectVo selectVo = new DeptTreeSelectVo(); |
| | | selectVo.setCheckedKeys(deptService.selectDeptListByRoleId(roleId)); |
| | | selectVo.setDepts(deptService.selectDeptTreeList(new SysDept())); |
| | | selectVo.setDepts(deptService.selectDeptTreeList(new SysDeptBo())); |
| | | return R.ok(selectVo); |
| | | } |
| | | } |