xufenglei
2017-12-07 7214ae59e03b79372a923eae8206082efc3fab85
src/main/java/com/moral/service/impl/OrganizationServiceImpl.java
@@ -16,8 +16,6 @@
import com.moral.mapper.OrganizationRelationMapper;
import com.moral.service.OrganizationService;
import tk.mybatis.mapper.entity.Example;
@Service
public class OrganizationServiceImpl implements OrganizationService {
@@ -31,11 +29,11 @@
    public Set<Integer> getChildOrganizationIds(Integer orgId){
       Set<Integer> orgIds = new HashSet<Integer>();
       orgIds.add(orgId);
       Example example = new Example(OrganizationRelation.class);
       example.or().andEqualTo("parentId",orgId);
       OrganizationRelation relation = new OrganizationRelation();
       relation.setParentId(orgId);
       Organization organization = organizationMapper.selectByPrimaryKey(orgId);
       if (IS_DELETE_FALSE.equals(organization.getIsDelete())) {
          List<OrganizationRelation> organizationRelations = organizationRelationMapper.selectByExample(example);
          List<OrganizationRelation> organizationRelations = organizationRelationMapper.select(relation);
          for (OrganizationRelation organizationRelation : organizationRelations) {
             Set<Integer> organizationIds = getChildOrganizationIds(organizationRelation.getParentId());
             orgIds.addAll(organizationIds);
@@ -44,4 +42,10 @@
       return orgIds;
    }
   @Override
   public List<Organization> getOrganizationsByAreaName(String areaName) {
      List<Organization> organizations = organizationMapper.getOrganizationsByAreaName(areaName);
      return organizations;
   }
}