| | |
| | | package com.dg.core.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dg.core.db.gen.entity.OrganizationChartEntity; |
| | | import com.dg.core.db.gen.mapper.OrganizationChartMapper; |
| | | import com.dg.core.service.IOrganizationChartService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | public OrganizationChartEntity selectConfigById(String id) { |
| | | return baseMapper.selectConfigById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrganizationChartEntity> queryList(IPage<OrganizationChartEntity> page, Integer state, String organizationName) { |
| | | return baseMapper.queryList(page,state,organizationName); |
| | | } |
| | | |
| | | @Override |
| | | public int countList(String organizationName) { |
| | | return baseMapper.countList(organizationName); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<OrganizationChartEntity> selectParentList(String parentId, String grade) { |
| | | return baseMapper.selectConfigList(parentId,grade); |
| | | } |
| | | |
| | | /** |
| | | * 递归获取id 内部使用 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | |
| | | @Override |
| | | public List<String> getIds(String id) |
| | | { |
| | | List<String> ids=new ArrayList<>(); |
| | | List<OrganizationChartEntity> lists = baseMapper.selectConfigList(id,""); |
| | | if(lists.size()<1) |
| | | { |
| | | lists.add(baseMapper.selectConfigById(id)); |
| | | } |
| | | ids=disposestreetId(lists); |
| | | if(ids.size()<1) |
| | | { |
| | | return null; |
| | | } |
| | | ids.add(id); |
| | | return ids; |
| | | } |
| | | |
| | | |
| | | |
| | | //递归取id |
| | | private List<String> disposestreetId(List<OrganizationChartEntity> lists) |
| | | { |
| | | List<String> ids=new ArrayList<>(); |
| | | if(lists==null || lists.size()<1) |
| | | { |
| | | return ids; |
| | | } |
| | | |
| | | for (OrganizationChartEntity sysStreet:lists) |
| | | { |
| | | if(sysStreet!=null&&sysStreet.getId()!=null) |
| | | { |
| | | if(sysStreet.getChild()!=null && sysStreet.getChild().size()>0) |
| | | { |
| | | ids.addAll(disposestreetId(sysStreet.getChild())); |
| | | } |
| | | else |
| | | { |
| | | ids.add(sysStreet.getId()+""); |
| | | } |
| | | } |
| | | } |
| | | return ids; |
| | | } |
| | | |
| | | |
| | | } |