| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询所有父节点和本节点名称 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> findListParentTreeAll(String id){ |
| | | MdcProductionEquipment mdcProductionEquipment=productionEquipmentMapper.selectOne(new QueryWrapper<MdcProductionEquipment>().eq("equipment_id",id)); |
| | | if (mdcProductionEquipment==null) { |
| | | return null; |
| | | } |
| | | List<String> strings = new ArrayList<>(); |
| | | MdcProduction en=super.getById(mdcProductionEquipment.getProductionId()); |
| | | if (en == null) { |
| | | return null; |
| | | } |
| | | strings.add(en.getProductionName()); |
| | | if (StringUtils.isEmpty(en.getParentId())) { |
| | | return strings; |
| | | } else { |
| | | return findListParentTree(en.getParentId(),strings); |
| | | } |
| | | } |
| | | |
| | | // 查询所以父节点 |
| | | @Override |
| | | public List<String> findListParentTree(String parentId,List<String> stringList){ |
| | | if (StringUtils.isEmpty(parentId)) { |
| | | return null; |
| | | } |
| | | if (stringList == null || stringList.isEmpty()) { |
| | | stringList = new ArrayList<>(); |
| | | } |
| | | boolean p = true; |
| | | if (p) { |
| | | MdcProduction en = super.getById(parentId); |
| | | if (en != null) { |
| | | stringList.add(0,en.getProductionName()); |
| | | } |
| | | if (StringUtils.isNotBlank(en.getParentId())) { |
| | | parentId = en.getParentId(); |
| | | findListParentTree(parentId,stringList); |
| | | } else { |
| | | p = false; |
| | | return stringList; |
| | | } |
| | | } |
| | | return stringList; |
| | | } |
| | | } |