package org.jeecg.modules.mdc.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.mdc.service.IMdcProductionEquipmentService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.MdcProductionEquipment; import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; import org.jeecg.modules.system.model.ProductionIdModel; import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; /** * @author: LiuS * @create: 2023-03-28 10:31 */ @Service public class MdcProductionEquipmentServiceImpl extends ServiceImpl implements IMdcProductionEquipmentService { @Resource private IMdcProductionService mdcProductionService; /** * 根据设备id查询产线信息 */ @Override public List queryProductionIdsOfEquipment(String equipmentId) { LambdaQueryWrapper queryEquipmentPro = new LambdaQueryWrapper<>(); LambdaQueryWrapper queryPro = new LambdaQueryWrapper<>(); try { queryEquipmentPro.eq(MdcProductionEquipment::getEquipmentId, equipmentId); List proIdList = new ArrayList<>(); List proIdModelList = new ArrayList<>(); List equipmentProList = this.list(queryEquipmentPro); if (equipmentProList != null && !equipmentProList.isEmpty()) { for (MdcProductionEquipment productionEquipment : equipmentProList) { proIdList.add(productionEquipment.getProductionId()); } queryPro.in(MdcProduction::getId, proIdList); List proList = mdcProductionService.list(queryPro); if (proList != null && !proList.isEmpty()) { for (MdcProduction mdcProduction : proList) { proIdModelList.add(new ProductionIdModel().convertByUserProduction(mdcProduction)); } } return proIdModelList; } } catch (Exception e) { e.fillInStackTrace(); } return null; } }