From a5fac95408a43ad43de9d88c30d06c0918c7bc8f Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Wed, 29 May 2024 11:14:44 +0800
Subject: [PATCH] 配置调整
---
src/main/java/org/springblade/modules/system/controller/MenuController.java | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/springblade/modules/system/controller/MenuController.java b/src/main/java/org/springblade/modules/system/controller/MenuController.java
index 578148d..45b18b4 100644
--- a/src/main/java/org/springblade/modules/system/controller/MenuController.java
+++ b/src/main/java/org/springblade/modules/system/controller/MenuController.java
@@ -16,10 +16,12 @@
*/
package org.springblade.modules.system.controller;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
@@ -31,7 +33,9 @@
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.node.TreeNode;
import org.springblade.core.tool.support.Kv;
+import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.system.dto.MenuDTO;
import org.springblade.modules.system.entity.Menu;
import org.springblade.modules.system.entity.TopMenu;
import org.springblade.modules.system.service.IMenuService;
@@ -68,12 +72,17 @@
* 详情
*/
@GetMapping("/detail")
- @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
+// @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入menu")
public R<MenuVO> detail(Menu menu) {
Menu detail = menuService.getOne(Condition.getQueryWrapper(menu));
- return R.data(MenuWrapper.build().entityVO(detail));
+ MenuVO menuVO = MenuWrapper.build().entityVO(detail);
+ if(StringUtils.isNotBlank(menuVO.getLabelStr())){
+ List<List<String>> lists = (List<List<String>>) JSON.parse(menuVO.getLabelStr() );
+ menuVO.setLabelList(lists);
+ }
+ return R.data(menuVO);
}
/**
@@ -84,7 +93,7 @@
@ApiImplicitParam(name = "code", value = "菜单编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "菜单名称", paramType = "query", dataType = "string")
})
- @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
+// @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入menu")
public R<List<MenuVO>> list(@ApiIgnore @RequestParam Map<String, Object> menu) {
@@ -100,7 +109,7 @@
@ApiImplicitParam(name = "code", value = "菜单编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "菜单名称", paramType = "query", dataType = "string")
})
- @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
+// @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperationSupport(order = 3)
@ApiOperation(value = "懒加载列表", notes = "传入menu")
public R<List<MenuVO>> lazyList(Long parentId, @ApiIgnore @RequestParam Map<String, Object> menu) {
@@ -116,7 +125,7 @@
@ApiImplicitParam(name = "code", value = "菜单编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "菜单名称", paramType = "query", dataType = "string")
})
- @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
+// @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperationSupport(order = 4)
@ApiOperation(value = "菜单列表", notes = "传入menu")
public R<List<MenuVO>> menuList(@ApiIgnore @RequestParam Map<String, Object> menu) {
@@ -129,8 +138,11 @@
*/
@GetMapping("/dynamicMenu")
@ApiOperation(value = "菜单列表", notes = "传入menu")
- public R<List<MenuVO>> dynamicMenu(String roleId, Long topMenuId, @RequestParam(value = "labelType", required = false) Integer labelType) {
- List<MenuVO> list = menuService.routes(roleId, topMenuId,labelType);
+ public R<List<MenuVO>> dynamicMenu(String roleId, Long topMenuId,
+ @RequestParam(value = "labelType", required = false,defaultValue = "0") Integer labelType,
+ @RequestParam(value = "roleName",required = false) String roleName,
+ @RequestParam(value = "houseCode",required = false) String houseCode) {
+ List<MenuVO> list = menuService.routes(roleId, topMenuId,labelType,1,roleName,houseCode);
return R.data(list);
}
@@ -144,7 +156,7 @@
@ApiImplicitParam(name = "code", value = "菜单编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "name", value = "菜单名称", paramType = "query", dataType = "string")
})
- @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
+// @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperationSupport(order = 5)
@ApiOperation(value = "懒加载菜单列表", notes = "传入menu")
public R<List<MenuVO>> lazyMenuList(Long parentId, @ApiIgnore @RequestParam Map<String, Object> menu) {
@@ -156,10 +168,10 @@
* 新增或修改
*/
@PostMapping("/submit")
- @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
+// @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入menu")
- public R submit(@Valid @RequestBody Menu menu) {
+ public R submit(@Valid @RequestBody MenuDTO menu) {
if (menuService.submit(menu)) {
CacheUtil.clear(MENU_CACHE);
CacheUtil.clear(MENU_CACHE, Boolean.FALSE);
@@ -191,7 +203,7 @@
@ApiOperationSupport(order = 8)
@ApiOperation(value = "前端菜单数据", notes = "前端菜单数据")
public R<List<MenuVO>> routes(BladeUser user, Long topMenuId) {
- List<MenuVO> list = menuService.routes((user == null) ? null : user.getRoleId(), topMenuId,null);
+ List<MenuVO> list = menuService.routes((user == null) ? null : user.getRoleId(), topMenuId,null,0,"","");
return R.data(list);
}
--
Gitblit v1.9.3