76 lines
2.6 KiB
Java
76 lines
2.6 KiB
Java
package com.cczsa.xinghe.codegen.controller;
|
|
|
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleAddReq;
|
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleBindFunReq;
|
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleEditReq;
|
|
import com.cczsa.xinghe.codegen.entity.req.role.RoleQueryReq;
|
|
import com.cczsa.xinghe.codegen.entity.res.role.RoleQueryRes;
|
|
import com.cczsa.xinghe.codegen.service.RoleService;
|
|
import com.cczsa.xinghe.codegen.util.XResult;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.validation.Valid;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 角色管理 控制层。
|
|
*
|
|
* @author xia
|
|
* @version 0.0.1
|
|
*/
|
|
@Tag(name = "角色管理")
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/role")
|
|
public class RoleController {
|
|
|
|
private final RoleService roleService;
|
|
|
|
|
|
@Operation(summary = "获取角色列表", description = "获取角色列表")
|
|
@PostMapping("/query")
|
|
public XResult<List<RoleQueryRes>> query(@RequestBody @Valid RoleQueryReq req) {
|
|
return roleService.query(req);
|
|
}
|
|
|
|
@Operation(summary = "创建角色", description = "创建角色")
|
|
@PutMapping("/add")
|
|
public XResult<Void> add(@RequestBody @Valid RoleAddReq req) {
|
|
return roleService.add(req);
|
|
}
|
|
|
|
@Operation(summary = "修改角色", description = "修改角色")
|
|
@PostMapping("/edit")
|
|
public XResult<Void> edit(@RequestBody @Valid RoleEditReq req) {
|
|
return roleService.edit(req);
|
|
}
|
|
|
|
@Operation(summary = "删除角色", description = "删除角色")
|
|
@DeleteMapping("/delete/{roleId}")
|
|
public XResult<Void> delete(@PathVariable Long roleId) {
|
|
return roleService.delete(roleId);
|
|
}
|
|
|
|
@Operation(summary = "角色设置权限", description = "角色设置权限")
|
|
@PostMapping("/bind/fun")
|
|
public XResult<Void> bindFun(@RequestBody @Valid RoleBindFunReq req) {
|
|
return roleService.bindFun(req);
|
|
}
|
|
|
|
@Operation(summary = "删除角色权限", description = "删除角色权限")
|
|
@DeleteMapping("/delete/fun/{roleBindFunId}")
|
|
public XResult<Void> deleteFun(@PathVariable Long roleBindFunId) {
|
|
return roleService.deleteFun(roleBindFunId);
|
|
}
|
|
|
|
|
|
} |