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<MdcProductionEquipmentMapper, MdcProductionEquipment> implements IMdcProductionEquipmentService {
|
|
@Resource
|
private IMdcProductionService mdcProductionService;
|
|
/**
|
* 根据设备id查询产线信息
|
*/
|
@Override
|
public List<ProductionIdModel> queryProductionIdsOfEquipment(String equipmentId) {
|
LambdaQueryWrapper<MdcProductionEquipment> queryEquipmentPro = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MdcProduction> queryPro = new LambdaQueryWrapper<>();
|
try {
|
queryEquipmentPro.eq(MdcProductionEquipment::getEquipmentId, equipmentId);
|
List<String> proIdList = new ArrayList<>();
|
List<ProductionIdModel> proIdModelList = new ArrayList<>();
|
List<MdcProductionEquipment> equipmentProList = this.list(queryEquipmentPro);
|
if (equipmentProList != null && !equipmentProList.isEmpty()) {
|
for (MdcProductionEquipment productionEquipment : equipmentProList) {
|
proIdList.add(productionEquipment.getProductionId());
|
}
|
queryPro.in(MdcProduction::getId, proIdList);
|
List<MdcProduction> 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;
|
}
|
}
|