免登录获取菜单

yun-zuoyi
zhang.xw 2 years ago
parent f1ce146e04
commit e873d08e06

@ -66,6 +66,7 @@ import com.taobao.api.ApiException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.val;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.*;
@ -1597,4 +1598,44 @@ public class WhiteController extends CoreBaseController {
}
return result;
}
/**
*
*
* @param parentId id
* @return
*/
@GetMapping(value = "/no/login/menu/list")
@ApiOperation(value = "获取登录用户功能权限信息", notes = "获取首页权限信息")
public ResultBean findModuleListByNoLogin(@RequestParam String parentId, @RequestParam String userId) {
try {
ValidatorBean.checkIsNumber(parentId, "父节点不能为空");
List<SysMenu> result = memTreeService.packTreeSysMenuByUserIdAndParentId(Long.valueOf(userId), Long.parseLong(parentId));
result = findChildList(result);
return ResultBean.success("操作成功")
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
.setResultList(result);
} catch (ImppBusiException busExcep) {
LOGGER.error(busExcep.getErrorMsg() + "{}", busExcep.getErrorDetail(), busExcep);
return ResultBean.fail(busExcep);
} catch (Exception e) {
LOGGER.error(LocaleUtils.getEnumLocaleResDesc(ImppExceptionEnum.SYSTEM_EXCEPTION,
ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription()) + "{}", e.getMessage(), e);
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
}
}
private List<SysMenu> findChildList(List<SysMenu> findList) {
List<SysMenu> result = new ArrayList<>();
if (CollectionUtils.isNotEmpty(findList)) {
for (SysMenu menu : findList) {
if (CollectionUtils.isNotEmpty(menu.getChildList())) {
result.addAll(findChildList(menu.getChildList()));
}
result.add(menu);
}
}
return result;
}
}

Loading…
Cancel
Save