package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.whyc.dto.Response; import com.whyc.mapper.MaterialProductHistoryMapper; import com.whyc.pojo.MaterialProductApproving; import com.whyc.pojo.MaterialProductHistory; import com.whyc.pojo.ProductBom; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class MaterialProductHistoryService { @Autowired(required = false) private MaterialProductHistoryMapper mapper; //增加散装件和产品之间替换关系 public Response addMaterialConnectBom(List list) { int bl=mapper.insertBatchSomeColumn(list); return new Response().setII(1,true,bl,bl>0?"添加关联成功":"添加关联失败"); } public List getListByParentModel(String parentModel, int currentVersion) { QueryWrapper query = Wrappers.query(); query.eq("parent_model",parentModel).le("s_version",currentVersion).ge("e_version",currentVersion); return mapper.selectList(query); } public void updateVersionBatch(List cphList) { mapper.updateVersionBatch(cphList); } public void insertBatch(List newHistoryList) { mapper.insertBatchSomeColumn(newHistoryList); } public List getLatestExistListByMaterialId(Integer materialId) { return mapper.getLatestExistListByMaterialId(materialId); } /** * 解除关联: * 终止版本-1即可 * @param removedList 解除关联列表 */ public void updateVersionSubtractBatch(List removedList) { mapper.updateVersionSubtractBatch(removedList); } public List getListByParentCodeAndCustomCodeAndVersion(String parentCode, String customCode, Integer version) { QueryWrapper query = Wrappers.query(); query.eq("parent_code",parentCode).eq("custom_code",customCode) .le("s_version",version) .ge("e_version",version); return mapper.selectList(query); } public List getListWithMaterialInfo(List mpList) { return mapper.getListWithMaterialInfo(mpList); } public List getListByParentCodeAndCustomCodeAndSubMaterialIdAndVersion(String parentCode, String customCode, List bomList, int currentVersion) { return mapper.getListByParentCodeAndCustomCodeAndSubMaterialIdAndVersion(parentCode,customCode,bomList,currentVersion); } }