| | |
| | | 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 |
| | |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listByproductModelId(Long productModelId) { |
| | | return productStructureMapper.listByproductModelId( productModelId); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Boolean addProductStructureDto(ProductStructureDto productStructureDto) { |
| | | this.remove(new QueryWrapper<ProductStructure>().lambda().eq(ProductStructure::getProductModelId, productStructureDto.getProductModelId())); |
| | | this.remove(new QueryWrapper<ProductStructure>().lambda().eq(ProductStructure::getBomId, productStructureDto.getBomId())); |
| | | productStructureDto.getProductStructureList().forEach(productStructure -> { |
| | | productStructure.setBomId(productStructureDto.getBomId()); |
| | | }); |
| | | return this.saveBatch(productStructureDto.getProductStructureList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listBybomId(Long bomId) { |
| | | List<ProductStructureDto> tree = productStructureMapper.listBybomId(bomId); |
| | | return tree; |
| | | |
| | | } |
| | | } |