package com.ruoyi.production.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.dto.ProductModelDto; import com.ruoyi.basic.dto.ProductTreeDto; import com.ruoyi.basic.mapper.ProductMapper; import com.ruoyi.basic.mapper.ProductModelMapper; import com.ruoyi.basic.pojo.Product; import com.ruoyi.basic.pojo.ProductModel; import com.ruoyi.production.dto.ProductStructureDto; import com.ruoyi.production.mapper.ProductBomMapper; import com.ruoyi.production.mapper.ProductStructureMapper; import com.ruoyi.production.pojo.ProductStructure; import com.ruoyi.production.service.ProductStructureService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service @RequiredArgsConstructor @Slf4j public class ProductStructureServiceImpl extends ServiceImpl implements ProductStructureService { @Autowired private ProductStructureMapper productStructureMapper; @Override public Boolean addProductStructureDto(ProductStructureDto productStructureDto) { this.remove(new QueryWrapper().lambda().eq(ProductStructure::getBomId, productStructureDto.getBomId())); productStructureDto.getProductStructureList().forEach(productStructure -> { productStructure.setBomId(productStructureDto.getBomId()); }); return this.saveBatch(productStructureDto.getProductStructureList()); } @Override public List listBybomId(Long bomId) { List tree = productStructureMapper.listBybomId(bomId); return tree; } }