lxw
2022-08-17 d52b6c432190fd2e68bb4d2698c4950c1142552c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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.ComponentProductHistoryMapper;
import com.whyc.pojo.ComponentProductHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class ComponentProductHistoryService {
    @Autowired(required = false)
    private ComponentProductHistoryMapper mapper;
    //增加散装件和产品之间替换关系
    public Response addComponentConnectBom(List<ComponentProductHistory> list) {
        int bl=mapper.insertBatchSomeColumn(list);
        return new Response().setII(1,true,bl,bl>0?"添加关联成功":"添加关联失败");
    }
 
    public List<ComponentProductHistory> getListByParentModel(String parentModel, int currentVersion) {
        QueryWrapper<ComponentProductHistory> query = Wrappers.query();
        query.eq("parent_model",parentModel).le("s_version",currentVersion).ge("e_version",currentVersion);
        return mapper.selectList(query);
    }
 
    public void updateVersionBatch(List<ComponentProductHistory> cphList) {
        mapper.updateVersionBatch(cphList);
    }
 
    public void insertBatch(List<ComponentProductHistory> newHistoryList) {
        mapper.insertBatchSomeColumn(newHistoryList);
    }
 
    public List<ComponentProductHistory> getLatestExistListByComponentId(Integer componentId) {
        return mapper.getLatestExistListByComponentId(componentId);
    }
}