Commit 74531e65 authored by zjy's avatar zjy

user/role/tright 7.13

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