package org.jeecg.modules.pms.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail; import org.jeecg.modules.pms.mapper.PmsProcessBillMaterialsDetailMapper; import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsDetailService; import org.jeecg.modules.sap.dto.OrderBomDTO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.stream.Collectors; /** * @Description: 物料清单 * @Author: jeecg-boot * @Date: 2025-07-01 * @Version: V1.0 */ @Service public class PmsProcessBillMaterialsDetailServiceImpl extends ServiceImpl implements IPmsProcessBillMaterialsDetailService { @Override public List queryByMaterialId(String materialId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PmsProcessBillMaterialsDetail::getMaterialId, materialId); return baseMapper.selectList(queryWrapper); } @Override @Transactional(rollbackFor = Exception.class) public void removeByMaterialsId(String materialsId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PmsProcessBillMaterialsDetail::getMaterialId, materialsId); this.getBaseMapper().delete(queryWrapper); } @Override @Transactional(rollbackFor = Exception.class) public void saveBatchDetail(String materialsId, List collect) { if (CollectionUtil.isEmpty(collect)) { return; } List list = collect.stream().map(orderBomDTO -> new PmsProcessBillMaterialsDetail(materialsId, orderBomDTO)).collect(Collectors.toList()); super.saveBatch(list); } }