|
@@ -6,11 +6,77 @@
|
|
|
package org.eco.vip.auth.controller.menu;
|
|
|
|
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
+import org.eco.vip.auth.domain.menu.pojo.MenuBO;
|
|
|
+import org.eco.vip.auth.domain.menu.pojo.MenuVO;
|
|
|
+import org.eco.vip.auth.service.menu.IMenuService;
|
|
|
+import org.eco.vip.orm.pojo.CommonResult;
|
|
|
+import org.eco.vip.orm.pojo.PageResult;
|
|
|
+import org.eco.vip.security.annotation.PermissionsResource;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+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;
|
|
|
+
|
|
|
+import static org.eco.vip.orm.pojo.CommonResult.fail;
|
|
|
+import static org.eco.vip.orm.pojo.CommonResult.success;
|
|
|
+
|
|
|
/**
|
|
|
* @description MenuController
|
|
|
*
|
|
|
* @author GaoKunW
|
|
|
* @date 2025/7/4 14:51
|
|
|
*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/system/menu")
|
|
|
+@Validated
|
|
|
+@PermissionsResource("menu")
|
|
|
public class MenuController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IMenuService menuService;
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ public CommonResult<PageResult<MenuVO>> page(MenuBO menuBO) {
|
|
|
+ return success(menuService.selectPage(menuBO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ public CommonResult<List<MenuVO>> list(MenuBO menuBO) {
|
|
|
+ return success(menuService.selectList(menuBO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @SaCheckPermission("system:menu:add")
|
|
|
+ public CommonResult<String> add(@RequestBody @Valid MenuBO menuBO) {
|
|
|
+ boolean result = menuService.insert(menuBO);
|
|
|
+ if (!result) {
|
|
|
+ return fail("新增组织失败!");
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/edit")
|
|
|
+ public CommonResult<String> edit(@RequestBody @Valid MenuBO menuBO) {
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @SaCheckPermission("system:menu:delete")
|
|
|
+ public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空") List<String> ids) {
|
|
|
+ boolean result = menuService.delete(ids);
|
|
|
+ if (!result) {
|
|
|
+ return fail("删除菜单失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ return success();
|
|
|
+ }
|
|
|
}
|