XiaoRuby
2023-09-07 088ceb9faf6f1d0d9f57bb9cd65f542337d40b7f
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
@@ -4,17 +4,19 @@
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.Technology;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.TechnologyDto;
import com.yuanchu.mom.service.TechnologyService;
import com.yuanchu.mom.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * <p>
@@ -40,7 +42,16 @@
    MbomMapper mbomMapper;
    @Resource
    MbomService mbomService;
    @Resource
    TechniqueMapper techniqueMapper;
    @Resource
    ProductService productService;
    @Resource
    TechniqueService techniqueService;
    //根据型号id查询版本
@@ -69,6 +80,7 @@
    //右上角新增-->工艺路线
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addTechnology(Integer specificationsId, TechnologyDto technologyDto) {
        Technology technology = new Technology();
        BeanUtils.copyProperties(technologyDto, technology);
@@ -83,21 +95,6 @@
        technology.setId(id);
        technology.setProductionQuota(productionQuota);
        return technologyMapper.updateById(technology);
    }
    //添加同一个型号工艺路线的版本
    @Override
    public Integer addVersion(Integer specificationsId, Integer version) {
        List<Technology> technologyList = technologyMapper.selectList(Wrappers.<Technology>query()
                .eq("specifications_id", specificationsId)
                .eq("version", version));
        for (Technology technology : technologyList) {
            technology.setId(null);
            //最新版本+!
            technology.setVersion(technologyMapper.selectVerByTec(specificationsId).get(0) + 1);
        }
        saveBatch(technologyList);
        return technologyList.get(0).getVersion();
    }
    //删除