| | |
| | | package org.dromara.system.controller.system; |
| | | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import cn.dev33.satoken.exception.NotLoginException; |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import org.dromara.common.core.constant.GlobalConstants; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.system.domain.SysUserRole; |
| | | import org.dromara.system.domain.bo.SysDeptBo; |
| | |
| | | import org.dromara.system.service.ISysDeptService; |
| | | import org.dromara.system.service.ISysRoleService; |
| | | import org.dromara.system.service.ISysUserService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<Void> edit(@Validated @RequestBody SysRoleBo role) { |
| | | roleService.checkRoleAllowed(role.getRoleId()); |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (!roleService.checkRoleNameUnique(role)) { |
| | | return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public R<Void> dataScope(@RequestBody SysRoleBo role) { |
| | | roleService.checkRoleAllowed(role.getRoleId()); |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return toAjax(roleService.authDataScope(role)); |
| | | } |
| | |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<Void> changeStatus(@RequestBody SysRoleBo role) { |
| | | roleService.checkRoleAllowed(role.getRoleId()); |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return toAjax(roleService.updateRoleStatus(role.getRoleId(), role.getStatus())); |
| | | } |