Commit 74531e65 authored by zjy's avatar zjy

user/role/tright 7.13

parent 797dd760
......@@ -426,12 +426,13 @@ public class RegisterServiceImpl implements RegisterService {
}
}
List<AuthorityVo> levelOneList = new ArrayList();
for (String authorityId:authorityIdList) {
for (int i = 0; i < authorityIdList.size(); i++) {
AuthorityGetReqVo authorityGetReqVo = new AuthorityGetReqVo();
authorityGetReqVo.setId(authorityId);
authorityGetReqVo.setId(authorityIdList.get(i));
AuthorityVo authorityVo = authorityDaoImpl.load(authorityGetReqVo,AuthorityVo.class);
if (null == authorityVo.getPid() || authorityVo.getPid().isEmpty()){
levelOneList.add(authorityVo);
authorityIdList.remove(i);
}
}
Collections.sort(levelOneList);
......@@ -442,7 +443,7 @@ public class RegisterServiceImpl implements RegisterService {
for (AuthorityVo authorityVo:levelOneList) {
AuthorityListByLevelResVo resVo1 = new AuthorityListByLevelResVo();
ObjectHelper.writeWithFrom(resVo1,authorityVo);
List<AuthorityListByLevelResVo> childList = getChildList(authorityVo.getId());
List<AuthorityListByLevelResVo> childList = getChildList(authorityVo,authorityIdList);
resVo1.setChildList(childList);
authorityListByLevel.add(resVo1);
}
......@@ -455,22 +456,24 @@ public class RegisterServiceImpl implements RegisterService {
return resVo;
}
private List<AuthorityListByLevelResVo> getChildList(String id){
AuthorityGetReqVo reqVo = new AuthorityGetReqVo();
reqVo.setPid(id);
List<AuthorityVo> childList = authorityDaoImpl.loadList(reqVo,AuthorityVo.class);
List<AuthorityListByLevelResVo> childResList = new ArrayList();
if (null != childList && !childList.isEmpty()){
for (AuthorityVo authorityVo:childList) {
private List<AuthorityListByLevelResVo> getChildList(AuthorityVo authorityVo,List<String> authorityIdList){
List<AuthorityListByLevelResVo> resVoList = new ArrayList<>();
for (int i = 0;i<authorityIdList.size();i++) {
AuthorityGetReqVo authorityGetReqVo = new AuthorityGetReqVo();
authorityGetReqVo.setId(authorityIdList.get(i));
AuthorityVo authorityVo1 = authorityDaoImpl.load(authorityGetReqVo,AuthorityVo.class);
if (authorityVo1.getPid().equals(authorityVo.getId())){
authorityIdList.remove(i);
AuthorityListByLevelResVo resVo = new AuthorityListByLevelResVo();
ObjectHelper.writeWithFrom(resVo,authorityVo);
List<AuthorityListByLevelResVo> grandchildList = getChildList(authorityVo.getId());
resVo.setChildList(grandchildList);
childResList.add(resVo);
ObjectHelper.writeWithFrom(resVo,authorityVo1);
if (authorityIdList.size()>0){
resVo.setChildList(getChildList(authorityVo1,authorityIdList));
}
resVoList.add(resVo);
}
}
Collections.sort(childResList);
return childResList;
Collections.sort(resVoList);
return resVoList;
}
@Override
......
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