Commit bbecec8e by guojuxing

权限菜单查询方式调整:一开始只查询第一层,代码回滚

parent 94281b70
......@@ -117,17 +117,23 @@ public class MenuController {
public RestResponse listMenuTree(MenuListQO params) {
LOGGER.info("菜单列表查询参数:{}", JSON.toJSONString(params));
//逐级展开的方式,所以需要传ID,如果不传,默认查询第一层级,即level = 1
if (params.getMenuId() == null) {
params.setLevel(1);
}
// if (params.getMenuId() == null) {
// params.setLevel(1);
// }
long serviceBefore = System.currentTimeMillis();
if (params.getIsGIC() != null && params.getIsGIC() == MenuProjectConstants.APP_PROJECT_CODE) {
//如果是查询app应用类别,必须实时更新最新应用数据
params.setNeedUpdateAppMenu(true);
}
ServiceResponse<List<MenuDTO>> result = menuApiService.listMenuTree(params);
long serviceAfter = System.currentTimeMillis();
LOGGER.info("menuApiService.listMenuTree权限菜单服务调用时间:{}", serviceAfter - serviceBefore);
if (result.isSuccess()) {
if (StringUtils.isBlank(params.getSearch())) {
return RestResponse.success(addAuthItemSignAndChildrenSignToList(result.getResult()));
List<Map<String, Object>> resultInfo = changeListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID,
result.getResult());
LOGGER.info("changeListToTree权限菜单数据递归时间:{}", System.currentTimeMillis() - serviceAfter);
return RestResponse.success(resultInfo);
} else {
return ResultControllerUtils.commonResult(result);
}
......@@ -149,7 +155,8 @@ public class MenuController {
params.setMenuType(MenuTypeEnum.PAGE.getCode());
ServiceResponse<List<MenuDTO>> result = menuApiService.listMenuTree(params);
if (result.isSuccess()) {
return RestResponse.success(changePageListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, result.getResult()));
return RestResponse
.success(changePageListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, result.getResult()));
}
return EnterpriseRestResponse.failure(result);
}
......@@ -295,7 +302,8 @@ public class MenuController {
String menuVersion = dto.getMenuVersion();
String menuVersionName = dto.getMenuVersionName();
if (StringUtils.isNotBlank(menuVersion)) {
String[] menuVersionArr = menuVersion.substring(1, menuVersion.length() - 1).split(SignConstants.UNDERLINE);
String[] menuVersionArr = menuVersion.substring(1, menuVersion.length() - 1)
.split(SignConstants.UNDERLINE);
String[] menuVersionNameArr = menuVersionName.split(SignConstants.SLASH);
for (int i = 0, len = menuVersionArr.length; i < len; i++) {
map.put(menuVersionArr[i], menuVersionNameArr[i]);
......@@ -362,7 +370,8 @@ public class MenuController {
}
Set<String> authItemMap = new HashSet<>(16);
Set<String> childrenMap = new HashSet<>(16);
ServiceResponse<List<MenuDTO>> listByParentIdListResult = menuApiService.listByParentMenuIdList(parentMenuIdList);
ServiceResponse<List<MenuDTO>> listByParentIdListResult = menuApiService
.listByParentMenuIdList(parentMenuIdList);
if (listByParentIdListResult.isSuccess()) {
List<MenuDTO> listByParentIdList = listByParentIdListResult.getResult();
if (CollectionUtils.isNotEmpty(listByParentIdList)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment