|
|
@ -3,6 +3,8 @@ package org.nl.system.service.menu.impl; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
@ -464,4 +466,42 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl |
|
|
|
baseMapper.getMenusByRole(systemType,category); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> queryAuthority(Map<String, String> param) { |
|
|
|
String accountId = SecurityUtils.getCurrentUserId(); |
|
|
|
JSONObject returnjo = new JSONObject(); |
|
|
|
if (StrUtil.isEmpty(accountId)) { |
|
|
|
returnjo.put("code", "0"); |
|
|
|
returnjo.put("desc", "用户id不能为空!"); |
|
|
|
returnjo.put("result", new JSONArray()); |
|
|
|
} |
|
|
|
//查询一级
|
|
|
|
JSONArray pa = baseMapper.queryPdaAuthority(accountId, "0", null); |
|
|
|
if(ObjectUtil.isEmpty(pa)){ |
|
|
|
throw new BadRequestException("当前用户无菜单权限!"); |
|
|
|
} |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
for (int i = 0; i < pa.size(); i++) { |
|
|
|
JSONObject res = pa.getJSONObject(i); |
|
|
|
//查询二级
|
|
|
|
JSONArray secondResults = baseMapper.queryPdaAuthority(accountId, "1", res.getString("menu_id")); |
|
|
|
//查询三级
|
|
|
|
JSONArray roleTree = new JSONArray(); |
|
|
|
for (int j = 0; j < secondResults.size(); j++) { |
|
|
|
JSONObject row = secondResults.getJSONObject(j); |
|
|
|
String menu_id = row.getString("menu_id"); |
|
|
|
JSONArray ThirdResults = baseMapper.queryPdaAuthority(accountId, "2", menu_id); |
|
|
|
row.put("sonTree", ThirdResults); |
|
|
|
roleTree.add(row); |
|
|
|
} |
|
|
|
res.put("sonTree", roleTree); |
|
|
|
result.put("rf_menu" + ("188".equals(res.getString("menu_id"))?1:0), res); |
|
|
|
} |
|
|
|
|
|
|
|
returnjo.put("code", "1"); |
|
|
|
returnjo.put("desc", "查询成功!"); |
|
|
|
returnjo.put("result", result); |
|
|
|
return returnjo; |
|
|
|
} |
|
|
|
} |
|
|
|