|
@@ -3,6 +3,7 @@ package com.ozs.web.controller.system;
|
|
|
import java.util.List;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -41,7 +42,7 @@ import com.ozs.system.service.ISysUserService;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/system/role")
|
|
|
-@ApiOperation("角色信息")
|
|
|
+@Api(tags = "角色信息")
|
|
|
public class SysRoleController extends BaseController
|
|
|
{
|
|
|
@Autowired
|
|
@@ -61,6 +62,7 @@ public class SysRoleController extends BaseController
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
|
|
@GetMapping("/list")
|
|
|
+ @ApiOperation("根据条件分页查询角色数据")
|
|
|
public TableDataInfo list(SysRole role)
|
|
|
{
|
|
|
startPage();
|
|
@@ -71,6 +73,7 @@ public class SysRoleController extends BaseController
|
|
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
|
|
@PostMapping("/export")
|
|
|
+ @ApiOperation("角色管理")
|
|
|
public void export(HttpServletResponse response, SysRole role)
|
|
|
{
|
|
|
List<SysRole> list = roleService.selectRoleList(role);
|
|
@@ -96,6 +99,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
+ @ApiOperation("新增角色")
|
|
|
public AjaxResult add(@Validated @RequestBody SysRole role)
|
|
|
{
|
|
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
|
@@ -117,6 +121,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
+ @ApiOperation("修改保存角色")
|
|
|
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
|
|
{
|
|
|
roleService.checkRoleAllowed(role);
|
|
@@ -152,6 +157,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/dataScope")
|
|
|
+ @ApiOperation("修改保存数据权限")
|
|
|
public AjaxResult dataScope(@RequestBody SysRole role)
|
|
|
{
|
|
|
roleService.checkRoleAllowed(role);
|
|
@@ -165,6 +171,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/changeStatus")
|
|
|
+ @ApiOperation("状态修改")
|
|
|
public AjaxResult changeStatus(@RequestBody SysRole role)
|
|
|
{
|
|
|
roleService.checkRoleAllowed(role);
|
|
@@ -179,6 +186,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{roleIds}")
|
|
|
+ @ApiOperation("删除角色")
|
|
|
public AjaxResult remove(@PathVariable Long[] roleIds)
|
|
|
{
|
|
|
return toAjax(roleService.deleteRoleByIds(roleIds));
|
|
@@ -189,6 +197,7 @@ public class SysRoleController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
|
|
@GetMapping("/optionselect")
|
|
|
+ @ApiOperation("获取角色选择框列表")
|
|
|
public AjaxResult optionselect()
|
|
|
{
|
|
|
return success(roleService.selectRoleAll());
|
|
@@ -199,6 +208,7 @@ public class SysRoleController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
|
|
@GetMapping("/authUser/allocatedList")
|
|
|
+ @ApiOperation("查询已分配用户角色列表")
|
|
|
public TableDataInfo allocatedList(SysUser user)
|
|
|
{
|
|
|
startPage();
|
|
@@ -211,6 +221,7 @@ public class SysRoleController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
|
|
@GetMapping("/authUser/unallocatedList")
|
|
|
+ @ApiOperation("查询未分配用户角色列表")
|
|
|
public TableDataInfo unallocatedList(SysUser user)
|
|
|
{
|
|
|
startPage();
|
|
@@ -224,6 +235,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
|
|
@PutMapping("/authUser/cancel")
|
|
|
+ @ApiOperation("取消授权用户")
|
|
|
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
|
|
{
|
|
|
return toAjax(roleService.deleteAuthUser(userRole));
|
|
@@ -235,6 +247,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
|
|
@PutMapping("/authUser/cancelAll")
|
|
|
+ @ApiOperation("批量取消授权用户")
|
|
|
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
|
|
{
|
|
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
|
@@ -246,6 +259,7 @@ public class SysRoleController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
|
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
|
|
@PutMapping("/authUser/selectAll")
|
|
|
+ @ApiOperation("批量选择用户授权")
|
|
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
|
|
{
|
|
|
roleService.checkRoleDataScope(roleId);
|
|
@@ -257,6 +271,7 @@ public class SysRoleController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
|
|
@GetMapping(value = "/deptTree/{roleId}")
|
|
|
+ @ApiOperation("获取对应角色部门树列表")
|
|
|
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
|
|
{
|
|
|
AjaxResult ajax = AjaxResult.success();
|