|
@@ -1,13 +1,19 @@
|
|
|
package com.ym.mec.web.service.impl;
|
|
|
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.web.dal.dao.OrganizationDao;
|
|
|
import com.ym.mec.web.dal.entity.Organization;
|
|
|
+import com.ym.mec.web.dal.page.OrganizationQueryInfo;
|
|
|
import com.ym.mec.web.service.OrganizationService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@Service
|
|
|
public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organization> implements OrganizationService {
|
|
|
|
|
@@ -18,5 +24,32 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
|
|
|
public BaseDAO<Integer, Organization> getDAO() {
|
|
|
return organizationDao;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo<Organization> queryTreePage(OrganizationQueryInfo queryInfo){
|
|
|
+ PageInfo<Organization> pageInfo = queryPage(queryInfo);
|
|
|
+ for (Organization organization:pageInfo.getRows()) {
|
|
|
+ organization = getTree(organization);
|
|
|
+ }
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private Organization getTree(Organization org){
|
|
|
+ //得到根节点对象
|
|
|
+ //获取子节点list
|
|
|
+ List<Organization> byParentId = organizationDao.findByParentId(org.getId(), null);
|
|
|
+ //如果存在子节点
|
|
|
+ if(byParentId != null && byParentId.size() > 0) {
|
|
|
+ //将子节点list放入父节点对象
|
|
|
+ org.setOrganizations(byParentId);
|
|
|
+ //遍历子节点....
|
|
|
+ for (Organization organization : byParentId) {
|
|
|
+ getTree(organization);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return org;
|
|
|
+ }
|
|
|
|
|
|
}
|