diff --git a/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java index b297921..3506b60 100644 --- a/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java @@ -127,13 +127,13 @@ public class DepartmentDictServiceImpl extends ServiceImpl=0 ; i--){ + for (int i = depNames.size() - 1; i >= 0; i--) { fullName.append(depNames.get(i)); } departmentDictDO1.setFullName(fullName.toString()); @@ -189,57 +189,62 @@ public class DepartmentDictServiceImpl extends ServiceImpl getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO){ + public List getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO) { List getMembersVOS = new ArrayList<>(); - GetMembersVO getMembersVO = new GetMembersVO(); +// GetMembersVO getMembersVO = new GetMembersVO(); //找到父节点 DepartmentDictDO departmentDictDO = this.baseMapper.selectOne(new QueryWrapper() - .lambda() - .eq(DepartmentDictDO::getCompanyId,getDepartmentMembersDTO.getCompanyId()) - .isNull(DepartmentDictDO::getParentId)); - BeanUtils.copyProperties(departmentDictDO,getMembersVO); - - List departmentDictDOS = new ArrayList<>(); - departmentDictDOS.add(departmentDictDO); - - for (DepartmentDictDO dpt : departmentDictDOS){ - GetMembersVO gmv = new GetMembersVO(); - BeanUtils.copyProperties(dpt,gmv); - if (null!=departmentDictDO.getParentId()){ - DepartmentDictDO departmentDictDO1 =this.baseMapper.selectById(departmentDictDO.getParentId()); - gmv.setParentDepartmentName(departmentDictDO1.getDepartmentName()); - } - gmv.setChildren(getChildNodes(gmv)); + .lambda() + .eq(DepartmentDictDO::getCompanyId, getDepartmentMembersDTO.getCompanyId()) + .isNull(DepartmentDictDO::getParentId)); +// BeanUtils.copyProperties(departmentDictDO,getMembersVO); + +// List departmentDictDOS = new ArrayList<>(); +// departmentDictDOS.add(departmentDictDO); + +// for (DepartmentDictDO dpt : departmentDictDOS){ + GetMembersVO gmv = new GetMembersVO(); + BeanUtils.copyProperties(departmentDictDO, gmv); +// if (null!=departmentDictDO.getParentId()){ +// DepartmentDictDO departmentDictDO1 =this.baseMapper.selectById(departmentDictDO.getParentId()); +// gmv.setParentDepartmentName(departmentDictDO1.getDepartmentName()); +// } + gmv.setChildren(getChildNodes(gmv)); + //父节点人员 + List memberDOS = memberMapper.getMemberWithoutPage(departmentDictDO.getId(), getDepartmentMembersDTO.getUserName(), null, null, null); + if (memberDOS.size() > 0) { + gmv.setMemberDOS(memberDOS); + } // if (dpt.getParentId()!=null){ // //部门人员 // List memberDOS1 = memberMapper.getMemberWithoutPage(dpt.getId(),getMembersVO.getUserName(),null,null,null); // gmv.setMemberDOS(memberDOS1); // getMembersVOS.add(gmv); // }else { -// //公司人员 + //公司人员 // List memberDOS = memberMapper.selectList(new QueryWrapper() // .lambda() // .eq(MemberDO::getCompanyId,getDepartmentMembersDTO.getCompanyId())); // gmv.setMemberDOS(memberDOS); // getMembersVOS.add(gmv); // } - getMembersVOS.add(gmv); - } + getMembersVOS.add(gmv); +// } return getMembersVOS; } @@ -252,6 +257,7 @@ public class DepartmentDictServiceImpl extends ServiceImpl getChildNodes(GetMembersVO getMembersVO) { + List getAllDepartmentVOS = new ArrayList<>(); //查询该节点的子节点 @@ -263,7 +269,7 @@ public class DepartmentDictServiceImpl extends ServiceImpl memberDOS = memberMapper.getMemberWithoutPage(dd.getId(),getMembersVO.getUserName(),null,null,null); - if (memberDOS.size()>0){ + List memberDOS = memberMapper.getMemberWithoutPage(dd.getId(), getMembersVO.getUserName(), null, null, null); + if (memberDOS.size() > 0) { gmv.setMemberDOS(memberDOS); } getAllDepartmentVOS.add(gmv); diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 927e329..602d9bb 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -2,7 +2,7 @@ spring.server.port=23459 # 数据源配置 -spring.datasource.url=jdbc:mysql://rm-uf69w46mo6agw0ahao.mysql.rds.aliyuncs.com:3306/subsidy_new?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 +spring.datasource.url=jdbc:mysql://rm-uf69w46mo6agw0ahao.mysql.rds.aliyuncs.com:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username=ykadmin_new diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 559f4ed..50ca700 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ # 环境配置 -spring.profiles.active=dev +spring.profiles.active=prod #和CPU数 spring.server.acceptorThreadCount=600 spring.server.minSpareThreads=100 diff --git a/src/main/resources/mapper/ClassMemberMappingMapper.xml b/src/main/resources/mapper/ClassMemberMappingMapper.xml index 0345037..e55ad9d 100644 --- a/src/main/resources/mapper/ClassMemberMappingMapper.xml +++ b/src/main/resources/mapper/ClassMemberMappingMapper.xml @@ -59,7 +59,7 @@ and t2.user_name like concat('%',#{userName} ,'%') - order by t2.id + order by t2.account_name