81 lines
2.9 KiB
Java
81 lines
2.9 KiB
Java
package com.cczsa.xinghe.codegen.controller;
|
|
|
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuAddReq;
|
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuBindFunReq;
|
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuEditReq;
|
|
import com.cczsa.xinghe.codegen.entity.req.menu.MenuQueryReq;
|
|
import com.cczsa.xinghe.codegen.entity.res.menu.MenuQueryRes;
|
|
import com.cczsa.xinghe.codegen.service.MenuService;
|
|
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.GetMapping;
|
|
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("/menu")
|
|
public class MenuController {
|
|
|
|
private final MenuService menuService;
|
|
|
|
@Operation(summary = "获取菜单列表", description = "获取菜单列表")
|
|
@PostMapping("/query")
|
|
public XResult<List<MenuQueryRes>> query(@RequestBody @Valid MenuQueryReq req) {
|
|
return menuService.query(req);
|
|
}
|
|
|
|
@Operation(summary = "创建菜单", description = "创建菜单")
|
|
@PutMapping("/add")
|
|
public XResult<Void> add(@RequestBody @Valid MenuAddReq req) {
|
|
return menuService.add(req);
|
|
}
|
|
|
|
@Operation(summary = "修改菜单", description = "修改菜单")
|
|
@PostMapping("/edit")
|
|
public XResult<Void> edit(@RequestBody @Valid MenuEditReq req) {
|
|
return menuService.edit(req);
|
|
}
|
|
|
|
@Operation(summary = "删除菜单", description = "删除菜单")
|
|
@DeleteMapping("/delete/{id}")
|
|
public XResult<Void> delete(@PathVariable Long id) {
|
|
return menuService.delete(id);
|
|
}
|
|
|
|
@Operation(summary = "菜单绑定权限", description = "菜单绑定权限")
|
|
@PostMapping("/bind/fun")
|
|
public XResult<Void> bindFun(@RequestBody @Valid MenuBindFunReq req) {
|
|
return menuService.bindFun(req);
|
|
}
|
|
|
|
@Operation(summary = "删除菜单权限", description = "删除菜单权限")
|
|
@DeleteMapping("/delete/fun/{menuId}")
|
|
public XResult<Void> deleteFun(@PathVariable Long menuId) {
|
|
return menuService.deleteFun(menuId);
|
|
}
|
|
|
|
@Operation(summary = "根据ID获取菜单详情", description = "根据ID获取菜单详情")
|
|
@GetMapping("/get/{id}")
|
|
public XResult<MenuQueryRes> getById(@PathVariable Long id) {
|
|
return menuService.getById(id);
|
|
}
|
|
|
|
} |