|
|
@@ -17,7 +17,6 @@ import com.vber.system.SysUserRole;
|
|
|
import com.vber.system.service.ISysDeptService;
|
|
|
import com.vber.system.service.ISysRoleService;
|
|
|
import com.vber.system.service.ISysUserService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -31,22 +30,25 @@ import java.util.List;
|
|
|
@RestController
|
|
|
@RequestMapping("/system/role")
|
|
|
public class SysRoleController extends BaseController {
|
|
|
- @Autowired
|
|
|
- private ISysRoleService roleService;
|
|
|
+ private final ISysRoleService roleService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private TokenService tokenService;
|
|
|
+ private final TokenService tokenService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private SysPermissionService permissionService;
|
|
|
+ private final SysPermissionService permissionService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISysUserService userService;
|
|
|
+ private final ISysUserService userService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISysDeptService deptService;
|
|
|
+ private final ISysDeptService deptService;
|
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:list')")
|
|
|
+ public SysRoleController(ISysRoleService roleService, TokenService tokenService, SysPermissionService permissionService, ISysUserService userService, ISysDeptService deptService) {
|
|
|
+ this.roleService = roleService;
|
|
|
+ this.tokenService = tokenService;
|
|
|
+ this.permissionService = permissionService;
|
|
|
+ this.userService = userService;
|
|
|
+ this.deptService = deptService;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRole)")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(SysRole role) {
|
|
|
startPage();
|
|
|
@@ -55,18 +57,18 @@ public class SysRoleController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:export')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleExport)")
|
|
|
@PostMapping("/export")
|
|
|
public void export(HttpServletResponse response, SysRole role) {
|
|
|
List<SysRole> list = roleService.selectRoleList(role);
|
|
|
- ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
|
|
+ ExcelUtil<SysRole> util = new ExcelUtil<>(SysRole.class);
|
|
|
util.exportExcel(response, list, "角色数据");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据角色编号获取详细信息
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:query')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleQuery)")
|
|
|
@GetMapping(value = "/{roleId}")
|
|
|
public AjaxResult getInfo(@PathVariable Long roleId) {
|
|
|
roleService.checkRoleDataScope(roleId);
|
|
|
@@ -76,7 +78,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 新增角色
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:add')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleAdd)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@Validated @RequestBody SysRole role) {
|
|
|
@@ -93,7 +95,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 修改保存角色
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleEdit)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@Validated @RequestBody SysRole role) {
|
|
|
@@ -122,7 +124,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 修改保存数据权限
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleEdit)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/dataScope")
|
|
|
public AjaxResult dataScope(@RequestBody SysRole role) {
|
|
|
@@ -134,7 +136,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 状态修改
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleEdit)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/changeStatus")
|
|
|
public AjaxResult changeStatus(@RequestBody SysRole role) {
|
|
|
@@ -147,7 +149,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 删除角色
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:remove')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleRemove)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{roleIds}")
|
|
|
public AjaxResult remove(@PathVariable Long[] roleIds) {
|
|
|
@@ -157,7 +159,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 获取角色选择框列表
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:query')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleQuery)")
|
|
|
@GetMapping("/optionselect")
|
|
|
public AjaxResult optionselect() {
|
|
|
return success(roleService.selectRoleAll());
|
|
|
@@ -166,7 +168,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 查询已分配用户角色列表
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:list')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRole)")
|
|
|
@GetMapping("/authUser/allocatedList")
|
|
|
public TableDataInfo allocatedList(SysUser user) {
|
|
|
startPage();
|
|
|
@@ -177,7 +179,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 查询未分配用户角色列表
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:list')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRole)")
|
|
|
@GetMapping("/authUser/unallocatedList")
|
|
|
public TableDataInfo unallocatedList(SysUser user) {
|
|
|
startPage();
|
|
|
@@ -188,7 +190,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 取消授权用户
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleEdit)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
|
|
@PutMapping("/authUser/cancel")
|
|
|
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
|
|
|
@@ -198,7 +200,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 批量取消授权用户
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleEdit)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
|
|
@PutMapping("/authUser/cancelAll")
|
|
|
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
|
|
|
@@ -208,7 +210,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 批量选择用户授权
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleEdit)")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
|
|
@PutMapping("/authUser/selectAll")
|
|
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
|
|
|
@@ -219,7 +221,7 @@ public class SysRoleController extends BaseController {
|
|
|
/**
|
|
|
* 获取对应角色部门树列表
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermission('system:role:query')")
|
|
|
+ @PreAuthorize("@ss.hasPermission(@pn.SystemRoleQuery)")
|
|
|
@GetMapping(value = "/deptTree/{roleId}")
|
|
|
public AjaxResult deptTree(@PathVariable("roleId") Long roleId) {
|
|
|
AjaxResult ajax = AjaxResult.success();
|