|
@@ -1,11 +1,10 @@
|
|
|
package com.dragoninfo.dcuc.auth.sub.service.impl;
|
|
|
|
|
|
import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
|
|
|
-import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
|
|
|
import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
|
|
|
import com.dragoninfo.dcuc.auth.sub.repo.AuthOrgInfoRepository;
|
|
|
-import com.dragoninfo.dcuc.auth.sub.repo.ChildCountDO;
|
|
|
import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
|
|
|
+import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
|
|
|
import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
@@ -150,16 +149,21 @@ public class AuthOrgInfoService implements IAuthOrgInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseDTO<List<AuthOrgDTO>> orgMatch(String name, Integer pageNum, Integer pageSize) {
|
|
|
- Integer limit = (pageNum-1) * pageSize;
|
|
|
- List<AuthOrgInfo> list = orgInfoRepository.orgMatch(name, limit, pageSize);
|
|
|
- List<AuthOrgDTO> collect = list.stream().map(item -> {
|
|
|
- AuthOrgDTO orgDTO = new AuthOrgDTO();
|
|
|
- BeanUtils.copyProperties(item, orgDTO);
|
|
|
- return orgDTO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- Integer count = orgInfoRepository.orgMatchCount(name);
|
|
|
- return ResponseDTO.success("" + count, collect);
|
|
|
+ public ResponseDTO<List<AuthOrgDTO>> orgMatch(String name, String mts, Integer pageNum, Integer pageSize) {
|
|
|
+ List<AuthOrgInfo> list = orgInfoRepository.orgMatch(name);
|
|
|
+ if(StringUtils.isNotBlank(mts)) {
|
|
|
+ list = list.stream()
|
|
|
+ .filter(e-> OrgInfoUtil.isHaveAuth(e.getId(), e.getPath(), mts))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ List<AuthOrgDTO> collect = list
|
|
|
+ .stream().skip(pageNum * pageSize).limit(pageSize)
|
|
|
+ .map(item -> {
|
|
|
+ AuthOrgDTO orgDTO = new AuthOrgDTO();
|
|
|
+ BeanUtils.copyProperties(item, orgDTO);
|
|
|
+ return orgDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return ResponseDTO.success("" + list.size(), collect);
|
|
|
}
|
|
|
|
|
|
}
|