|
|
@ -35,247 +35,263 @@ import java.util.Map; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class SysFunctionService extends MybatisBaseService<SysFunctionMapper, SysFunction> { |
|
|
|
@Autowired |
|
|
|
private SysSourceService sysSourceService; |
|
|
|
@Autowired |
|
|
|
private SysSourceFunctionService sysSourceFunctionService; |
|
|
|
public PagerVo<SysFunction> listPage(PagerQuery<SysFunctionQuery> pq) { |
|
|
|
SysFunctionQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
|
|
|
IPage<SysFunction> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SysFunction> pagging = baseMapper.selectPage(page, qw); |
|
|
|
PagerVo<SysFunction> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
public List<SysFunction> listAll(SysFunctionQuery query) { |
|
|
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
|
|
|
return baseMapper.selectList(qw); |
|
|
|
} |
|
|
|
private QueryWrapper<SysFunction> createQueryWrapper(SysFunctionQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
|
|
|
@Autowired |
|
|
|
private SysSourceService sysSourceService; |
|
|
|
@Autowired |
|
|
|
private SysSourceFunctionService sysSourceFunctionService; |
|
|
|
|
|
|
|
public PagerVo<SysFunction> listPage(PagerQuery<SysFunctionQuery> pq) { |
|
|
|
SysFunctionQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
|
|
|
IPage<SysFunction> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SysFunction> pagging = baseMapper.selectPage(page, qw); |
|
|
|
PagerVo<SysFunction> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public List<SysFunction> listAll(SysFunctionQuery query) { |
|
|
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
|
|
|
return baseMapper.selectList(qw); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<SysFunction> createQueryWrapper(SysFunctionQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.eq("name", query.getName()); |
|
|
|
} |
|
|
|
|
|
|
|
if (query.getLevel() != null) { |
|
|
|
qw.eq("level", query.getLevel()); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getParentSid())) { |
|
|
|
qw.eq("parentSid", query.getParentSid()); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getActionUrl())) { |
|
|
|
qw.eq("actionUrl", query.getActionUrl()); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getControllerName())) { |
|
|
|
qw.eq("controllerName", query.getControllerName()); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getFunId())) { |
|
|
|
qw.eq("funId", query.getFunId()); |
|
|
|
} |
|
|
|
|
|
|
|
if (query.getPhoneFunction() != null) { |
|
|
|
qw.eq("phoneFunction", query.getPhoneFunction()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<SysFunctionVo> listPageVo(PagerQuery<SysFunctionQuery> pq) { |
|
|
|
SysFunctionQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
|
|
|
IPage<SysFunction> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SysFunctionVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<SysFunctionVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.eq("name", query.getName()); |
|
|
|
} |
|
|
|
public List<SysFunctionVo> listAllVo(SysFunctionQuery query) { |
|
|
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("func.parentSid", "0"); |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.selectListAllVo(qw); |
|
|
|
for (SysFunctionVo s : sysFunctionVos) { |
|
|
|
getChildrens(s); |
|
|
|
} |
|
|
|
return sysFunctionVos; |
|
|
|
} |
|
|
|
|
|
|
|
if (query.getLevel() != null) { |
|
|
|
qw.eq("level", query.getLevel()); |
|
|
|
} |
|
|
|
private void getChildrens(SysFunctionVo s) { |
|
|
|
String sid = s.getSid(); |
|
|
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(sid)) { |
|
|
|
qw.eq("func.parentSid", sid); |
|
|
|
} |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.selectListAllVo(qw); |
|
|
|
if (!sysFunctionVos.isEmpty()) { |
|
|
|
for (SysFunctionVo sfv : sysFunctionVos) { |
|
|
|
getChildrens(sfv); |
|
|
|
} |
|
|
|
} |
|
|
|
s.setChildren(sysFunctionVos); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getParentSid())) { |
|
|
|
qw.eq("parentSid", query.getParentSid()); |
|
|
|
} |
|
|
|
public List<SysFunctionVo> listVo() { |
|
|
|
return baseMapper.selectListVo(); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getActionUrl())) { |
|
|
|
qw.eq("actionUrl", query.getActionUrl()); |
|
|
|
} |
|
|
|
public void saveOrUpdateDto(SysFunctionDto dto) { |
|
|
|
SysFunction entity = new SysFunction(); |
|
|
|
dto.fillEntity(entity); |
|
|
|
SysSourceFunction sysSourceFunction = new SysSourceFunction(); |
|
|
|
sysSourceFunction.setFunctionSid(entity.getSid()); |
|
|
|
sysSourceFunction.setSourceSid(dto.getSourceSid()); |
|
|
|
setRootSid(entity, sysSourceFunction); |
|
|
|
sysSourceFunctionService.save(sysSourceFunction); |
|
|
|
this.saveOrUpdate(entity); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getControllerName())) { |
|
|
|
qw.eq("controllerName", query.getControllerName()); |
|
|
|
} |
|
|
|
private void setRootSid(SysFunction entity, SysSourceFunction sysSourceFunction) { |
|
|
|
String pSid = entity.getParentSid(); |
|
|
|
if ("0".equals(pSid)) { |
|
|
|
sysSourceFunction.setFunctionRootSid(entity.getSid()); |
|
|
|
} else { |
|
|
|
SysFunction sysFunction = this.fetchBySid(pSid); |
|
|
|
String pSid1 = sysFunction.getParentSid(); |
|
|
|
if ("0".equals(pSid1)) { |
|
|
|
sysSourceFunction.setFunctionRootSid(sysFunction.getSid()); |
|
|
|
} |
|
|
|
setRootSid(sysFunction, sysSourceFunction); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getFunId())) { |
|
|
|
qw.eq("funId", query.getFunId()); |
|
|
|
} |
|
|
|
public SysFunctionVo fetchByIdVo(String id) { |
|
|
|
SysFunction entity = this.fetchById(id); |
|
|
|
SysFunctionVo vo = new SysFunctionVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
if (query.getPhoneFunction() != null) { |
|
|
|
qw.eq("phoneFunction", query.getPhoneFunction()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<SysFunctionVo> listPageVo(PagerQuery<SysFunctionQuery> pq) { |
|
|
|
SysFunctionQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
|
|
|
IPage<SysFunction> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SysFunctionVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<SysFunctionVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public List<SysFunctionVo> listAllVo(SysFunctionQuery query) { |
|
|
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("func.parentSid", "0"); |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.selectListAllVo(qw); |
|
|
|
for(SysFunctionVo s:sysFunctionVos){ |
|
|
|
getChildrens(s); |
|
|
|
} |
|
|
|
return sysFunctionVos; |
|
|
|
} |
|
|
|
private void getChildrens(SysFunctionVo s){ |
|
|
|
String sid = s.getSid(); |
|
|
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(sid)) { |
|
|
|
qw.eq("func.parentSid", sid); |
|
|
|
} |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.selectListAllVo(qw); |
|
|
|
if(!sysFunctionVos.isEmpty()){ |
|
|
|
for(SysFunctionVo sfv:sysFunctionVos){ |
|
|
|
getChildrens(sfv); |
|
|
|
} |
|
|
|
} |
|
|
|
s.setChildren(sysFunctionVos); |
|
|
|
} |
|
|
|
public List<SysFunctionVo> listVo() { |
|
|
|
return baseMapper.selectListVo(); |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(SysFunctionDto dto){ |
|
|
|
SysFunction entity = new SysFunction(); |
|
|
|
dto.fillEntity(entity); |
|
|
|
SysSourceFunction sysSourceFunction = new SysSourceFunction(); |
|
|
|
sysSourceFunction.setFunctionSid(entity.getSid()); |
|
|
|
sysSourceFunction.setSourceSid(dto.getSourceSid()); |
|
|
|
setRootSid(entity,sysSourceFunction); |
|
|
|
sysSourceFunctionService.save(sysSourceFunction); |
|
|
|
this.saveOrUpdate(entity); |
|
|
|
} |
|
|
|
private void setRootSid(SysFunction entity,SysSourceFunction sysSourceFunction){ |
|
|
|
String pSid = entity.getParentSid(); |
|
|
|
if("0".equals(pSid)){ |
|
|
|
sysSourceFunction.setFunctionRootSid(entity.getSid()); |
|
|
|
}else{ |
|
|
|
SysFunction sysFunction = this.fetchBySid(pSid); |
|
|
|
String pSid1 = sysFunction.getParentSid(); |
|
|
|
if("0".equals(pSid1)){ |
|
|
|
sysSourceFunction.setFunctionRootSid(sysFunction.getSid()); |
|
|
|
} |
|
|
|
setRootSid(sysFunction,sysSourceFunction); |
|
|
|
} |
|
|
|
} |
|
|
|
public SysFunctionVo fetchByIdVo(String id){ |
|
|
|
SysFunction entity = this.fetchById(id); |
|
|
|
SysFunctionVo vo = new SysFunctionVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
public List<SysFunctionVo> listAllByRoleSid(SysFunctionQuery query) { |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.listAllParentByRoleSid(query.getRoleSid(), "0"); |
|
|
|
for (SysFunctionVo s : sysFunctionVos) { |
|
|
|
getChildrensByRoleSid(s, query.getRoleSid()); |
|
|
|
} |
|
|
|
return sysFunctionVos; |
|
|
|
} |
|
|
|
|
|
|
|
public List<SysFunctionVo> listAllByRoleSid(SysFunctionQuery query) { |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.listAllParentByRoleSid(query.getRoleSid(),"0"); |
|
|
|
for(SysFunctionVo s:sysFunctionVos){ |
|
|
|
getChildrensByRoleSid(s,query.getRoleSid()); |
|
|
|
} |
|
|
|
return sysFunctionVos; |
|
|
|
} |
|
|
|
private void getChildrensByRoleSid(SysFunctionVo s,String roleSid){ |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.listAllParentByRoleSid(roleSid,s.getSid()); |
|
|
|
if(!sysFunctionVos.isEmpty()){ |
|
|
|
for(SysFunctionVo sfv:sysFunctionVos){ |
|
|
|
getChildrensByRoleSid(sfv,roleSid); |
|
|
|
} |
|
|
|
} |
|
|
|
s.setChildren(sysFunctionVos); |
|
|
|
} |
|
|
|
private void getChildrensByRoleSid(SysFunctionVo s, String roleSid) { |
|
|
|
List<SysFunctionVo> sysFunctionVos = baseMapper.listAllParentByRoleSid(roleSid, s.getSid()); |
|
|
|
if (!sysFunctionVos.isEmpty()) { |
|
|
|
for (SysFunctionVo sfv : sysFunctionVos) { |
|
|
|
getChildrensByRoleSid(sfv, roleSid); |
|
|
|
} |
|
|
|
} |
|
|
|
s.setChildren(sysFunctionVos); |
|
|
|
} |
|
|
|
|
|
|
|
public List<SysFunctionTreeVo> listAllVoForSource(SysFunctionQuery query) { |
|
|
|
String name = query.getName(); |
|
|
|
List<SysFunctionTreeVo> sysSourceVos = sysSourceService.listFunctionTreeVo(name); |
|
|
|
for (SysFunctionTreeVo s : sysSourceVos) { |
|
|
|
List<SysFunctionTreeVo> sysFunctionVoList = sysSourceFunctionService.fetchRootFunctionBySourceSid(s.getSourceSid()); |
|
|
|
s.setChildren(sysFunctionVoList); |
|
|
|
s.setIsSource("1"); |
|
|
|
//判断该资源下的功能是否有可用的状态
|
|
|
|
int isEnable = 1; |
|
|
|
int count = baseMapper.selectBySourceSid(isEnable, s.getSourceSid()); |
|
|
|
if (count == 0) { |
|
|
|
s.setIsEnable("0"); |
|
|
|
} else { |
|
|
|
s.setIsEnable("1"); |
|
|
|
} |
|
|
|
if (!sysFunctionVoList.isEmpty()) { |
|
|
|
public List<SysFunctionTreeVo> listAllVoForSource(SysFunctionQuery query) { |
|
|
|
String name = query.getName(); |
|
|
|
List<SysFunctionTreeVo> sysSourceVos = sysSourceService.listFunctionTreeVo(name); |
|
|
|
for (SysFunctionTreeVo s : sysSourceVos) { |
|
|
|
List<SysFunctionTreeVo> sysFunctionVoList = sysSourceFunctionService.fetchRootFunctionBySourceSid(s.getSourceSid()); |
|
|
|
s.setChildren(sysFunctionVoList); |
|
|
|
s.setIsSource("1"); |
|
|
|
//判断该资源下的功能是否有可用的状态
|
|
|
|
int isEnable = 1; |
|
|
|
int count = baseMapper.selectBySourceSid(isEnable, s.getSourceSid()); |
|
|
|
if (count == 0) { |
|
|
|
s.setIsEnable("0"); |
|
|
|
} else { |
|
|
|
s.setIsEnable("1"); |
|
|
|
} |
|
|
|
if (!sysFunctionVoList.isEmpty()) { |
|
|
|
// sysFunctionVoList = getChildrensForFunctionTree(sysFunctionVoList);
|
|
|
|
getChildList(sysFunctionVoList); |
|
|
|
} |
|
|
|
} |
|
|
|
return sysSourceVos; |
|
|
|
} |
|
|
|
getChildList(sysFunctionVoList); |
|
|
|
} |
|
|
|
} |
|
|
|
return sysSourceVos; |
|
|
|
} |
|
|
|
|
|
|
|
public void getChildList(List<SysFunctionTreeVo> list) { |
|
|
|
list.forEach(str -> { |
|
|
|
String sid = str.getSid(); |
|
|
|
List<SysFunctionTreeVo> listChildren = baseMapper.selectChildernList(sid); |
|
|
|
str.setChildren(listChildren); |
|
|
|
getChildList(listChildren); |
|
|
|
}); |
|
|
|
} |
|
|
|
public void getChildList(List<SysFunctionTreeVo> list) { |
|
|
|
list.forEach(str -> { |
|
|
|
String sid = str.getSid(); |
|
|
|
List<SysFunctionTreeVo> listChildren = baseMapper.selectChildernList(sid); |
|
|
|
str.setChildren(listChildren); |
|
|
|
getChildList(listChildren); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private List<SysFunctionTreeVo> getChildrensForFunctionTree(List<SysFunctionTreeVo> sysFunctionVoList) { |
|
|
|
List<SysFunctionTreeVo> list = new ArrayList<>(); |
|
|
|
for (SysFunctionTreeVo s : sysFunctionVoList) { |
|
|
|
SysFunction sysFunction = fetchBySid(s.getFunctionRootSid()); |
|
|
|
SysFunctionTreeVo sysFunctionTreeVo = new SysFunctionTreeVo(); |
|
|
|
BeanUtil.copyProperties(sysFunction, sysFunctionTreeVo); |
|
|
|
/*sysFunctionTreeVo.setParentName("顶级功能");*/ |
|
|
|
list.add(sysFunctionTreeVo); |
|
|
|
} |
|
|
|
for (SysFunctionTreeVo s : list) { |
|
|
|
getChildrensForFunctionTree(s, s.getSid()); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
private List<SysFunctionTreeVo> getChildrensForFunctionTree(List<SysFunctionTreeVo> sysFunctionVoList) { |
|
|
|
List<SysFunctionTreeVo> list = new ArrayList<>(); |
|
|
|
for (SysFunctionTreeVo s : sysFunctionVoList) { |
|
|
|
SysFunction sysFunction = fetchBySid(s.getFunctionRootSid()); |
|
|
|
SysFunctionTreeVo sysFunctionTreeVo = new SysFunctionTreeVo(); |
|
|
|
BeanUtil.copyProperties(sysFunction, sysFunctionTreeVo); |
|
|
|
/*sysFunctionTreeVo.setParentName("顶级功能");*/ |
|
|
|
list.add(sysFunctionTreeVo); |
|
|
|
} |
|
|
|
for (SysFunctionTreeVo s : list) { |
|
|
|
getChildrensForFunctionTree(s, s.getSid()); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
private void getChildrensForFunctionTree(SysFunctionTreeVo s, String sid) { |
|
|
|
QueryWrapper<SysFunctionTreeVo> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(sid)) { |
|
|
|
qw.eq("func.parentSid", sid); |
|
|
|
} |
|
|
|
List<SysFunctionTreeVo> sysMenuVos = baseMapper.getChildrensForFunctionTree(qw); |
|
|
|
if (!sysMenuVos.isEmpty()) { |
|
|
|
for (SysFunctionTreeVo smv : sysMenuVos) { |
|
|
|
private void getChildrensForFunctionTree(SysFunctionTreeVo s, String sid) { |
|
|
|
QueryWrapper<SysFunctionTreeVo> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(sid)) { |
|
|
|
qw.eq("func.parentSid", sid); |
|
|
|
} |
|
|
|
List<SysFunctionTreeVo> sysMenuVos = baseMapper.getChildrensForFunctionTree(qw); |
|
|
|
if (!sysMenuVos.isEmpty()) { |
|
|
|
for (SysFunctionTreeVo smv : sysMenuVos) { |
|
|
|
/*SysFunction sysFunction = fetchBySid(sid); |
|
|
|
smv.setParentName(sysFunction.getName());*/ |
|
|
|
getChildrensForFunctionTree(smv, smv.getSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
s.setChildren(sysMenuVos); |
|
|
|
} |
|
|
|
getChildrensForFunctionTree(smv, smv.getSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
s.setChildren(sysMenuVos); |
|
|
|
} |
|
|
|
|
|
|
|
public int updateBySourceSid(Integer isEnable, List<String> sids) { |
|
|
|
return baseMapper.updateBySourceSid(isEnable, sids); |
|
|
|
} |
|
|
|
public int updateBySourceSid(Integer isEnable, List<String> sids) { |
|
|
|
return baseMapper.updateBySourceSid(isEnable, sids); |
|
|
|
} |
|
|
|
|
|
|
|
public List<ButtonPermissionVo> getButtonPermissions(ButtonPermissionQuery query) { |
|
|
|
List<ButtonPermissionVo> buttonPermissions = baseMapper.getButtonPermissions(query); |
|
|
|
return buttonPermissions ; |
|
|
|
public List<ButtonPermissionVo> getButtonPermissions(ButtonPermissionQuery query) { |
|
|
|
List<ButtonPermissionVo> buttonPermissions = baseMapper.getButtonPermissions(query); |
|
|
|
return buttonPermissions; |
|
|
|
} |
|
|
|
|
|
|
|
public List<Map<String, Object>> getFunctionAuthorization(String roleSid) { |
|
|
|
List<Map<String,Object>> list=new ArrayList<>(); |
|
|
|
List<Map<String, Object>> lsources=baseMapper.getSourceAuthorization(roleSid); |
|
|
|
lsources.forEach(f->{ |
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
map.put("name",f.get("sourceName").toString()); |
|
|
|
map.put("sid",f.get("sid").toString()); |
|
|
|
map.put("checked","1"); |
|
|
|
list.add(map); |
|
|
|
}); |
|
|
|
List<Map<String, Object>> list = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> lsources = baseMapper.getSourceAuthorization(roleSid); |
|
|
|
lsources.forEach(f -> { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("name", f.get("sourceName").toString()); |
|
|
|
map.put("sid", f.get("sid").toString()); |
|
|
|
map.put("checked", "1"); |
|
|
|
list.add(map); |
|
|
|
}); |
|
|
|
|
|
|
|
list.forEach(f->{ |
|
|
|
List<Map<String,Object>> list2=new ArrayList<>(); |
|
|
|
String sid = f.get("sid").toString(); |
|
|
|
List<Map<String, Object>> lmenus=baseMapper.getMenuAuthorization(sid); |
|
|
|
lmenus.forEach(ff->{ |
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
map.put("name",ff.get("name")); |
|
|
|
String sids = ff.get("sid").toString(); |
|
|
|
map.put("sid",sids); |
|
|
|
map.put("checked","1"); |
|
|
|
map.put("children",new ArrayList<>()); |
|
|
|
if( ff.get("pageUrl")!=null&& com.yxt.common.base.utils.StringUtils.isNotBlank(ff.get("pageUrl").toString())){ |
|
|
|
String pageUrl =ff.get("pageUrl").toString(); |
|
|
|
List<Map<String, Object>> lfuncs=baseMapper.getFunctionAuthorization(pageUrl); |
|
|
|
lfuncs.forEach(fun->{ |
|
|
|
fun.put("children",new ArrayList<>()); |
|
|
|
}); |
|
|
|
map.put("children",lfuncs); |
|
|
|
} |
|
|
|
list2.add(map); |
|
|
|
}); |
|
|
|
f.put("children",list2); |
|
|
|
}); |
|
|
|
return list; |
|
|
|
list.forEach(f -> { |
|
|
|
List<Map<String, Object>> list2 = new ArrayList<>(); |
|
|
|
String sid = f.get("sid").toString(); |
|
|
|
List<Map<String, Object>> lmenus = baseMapper.getMenuAuthorization(sid); |
|
|
|
lmenus.forEach(ff -> { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("name", ff.get("name")); |
|
|
|
String sids = ff.get("sid").toString(); |
|
|
|
map.put("sid", sids); |
|
|
|
map.put("checked", "1"); |
|
|
|
map.put("children", new ArrayList<>()); |
|
|
|
if (ff.get("pageUrl") != null && com.yxt.common.base.utils.StringUtils.isNotBlank(ff.get("pageUrl").toString())) { |
|
|
|
String pageUrl = ff.get("pageUrl").toString(); |
|
|
|
List<Map<String, Object>> lfuncs = baseMapper.getFunctionAuthorization(pageUrl); |
|
|
|
List<Map<String, Object>> functionByRoleSid = baseMapper.getFunctionByRoleSid(pageUrl, roleSid); |
|
|
|
if (lfuncs.size() > 0){ |
|
|
|
for (Map<String, Object> lfunc : lfuncs) { |
|
|
|
for (Map<String, Object> funByRole : functionByRoleSid) { |
|
|
|
if (lfunc.get("sid").equals(funByRole.get("sid"))) { |
|
|
|
lfunc.put("checked", "0"); |
|
|
|
} |
|
|
|
} |
|
|
|
lfunc.put("children", new ArrayList<>()); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("children", lfuncs); |
|
|
|
} |
|
|
|
list2.add(map); |
|
|
|
}); |
|
|
|
f.put("children", list2); |
|
|
|
}); |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |