|
|
|
@ -7,6 +7,8 @@ import com.wayn.common.util.R;
|
|
|
|
|
import com.wayn.common.util.SecurityUtils;
|
|
|
|
|
import com.wayn.project.system.domain.SysRole;
|
|
|
|
|
import com.wayn.project.system.service.IRoleService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Api(value = "角色接口")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("system/role")
|
|
|
|
|
public class RoleController extends BaseController {
|
|
|
|
@ -21,13 +24,14 @@ public class RoleController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IRoleService iRoleService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "角色列表", notes = "角色列表")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public R list(SysRole role) {
|
|
|
|
|
Page<SysRole> page = getPage();
|
|
|
|
|
return R.success().add("page", iRoleService.listPage(page, role));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "保存用户", notes = "保存用户")
|
|
|
|
|
@PostMapping
|
|
|
|
|
public R addRole(@Validated @RequestBody SysRole role) {
|
|
|
|
|
if (SysConstants.NOT_UNIQUE.equals(iRoleService.checkRoleNameUnique(role))) {
|
|
|
|
@ -40,6 +44,7 @@ public class RoleController extends BaseController {
|
|
|
|
|
return R.result(iRoleService.insertRoleAndMenu(role));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "更新用户", notes = "更新用户")
|
|
|
|
|
@PutMapping
|
|
|
|
|
public R updateRole(@Validated @RequestBody SysRole role) {
|
|
|
|
|
iRoleService.checkRoleAllowed(role);
|
|
|
|
@ -52,6 +57,7 @@ public class RoleController extends BaseController {
|
|
|
|
|
return R.result(iRoleService.updateRoleAndMenu(role));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "更新用户状态", notes = "更新用户状态")
|
|
|
|
|
@PutMapping("changeStatus")
|
|
|
|
|
public R changeStatus(@RequestBody SysRole role) {
|
|
|
|
|
iRoleService.checkRoleAllowed(role);
|
|
|
|
@ -59,14 +65,15 @@ public class RoleController extends BaseController {
|
|
|
|
|
return R.result(iRoleService.updateById(role));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("获取角色详细")
|
|
|
|
|
@GetMapping("/{roleId}")
|
|
|
|
|
public R getRole(@PathVariable Long roleId) {
|
|
|
|
|
return R.success().add("data", iRoleService.getById(roleId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("删除角色")
|
|
|
|
|
@DeleteMapping("/{roleIds}")
|
|
|
|
|
public R getRole(@PathVariable List<Long> roleIds) {
|
|
|
|
|
public R deleteRole(@PathVariable List<Long> roleIds) {
|
|
|
|
|
return R.success().add("data", iRoleService.deleteRoleByIds(roleIds));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|