whycxzp
2022-08-25 802572535e54d8aadf548353eeeb382000226b44
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.MaterialMapper;
import com.whyc.pojo.Material;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class MaterialService {
    @Autowired(required = false)
    private MaterialMapper mapper;
    //查询所有的散装件信息加设置了替换关系的子件信息
    /*public Response getAllMaterial(String category,String subCode,String subName,String subModel,int pageCurr,int pageSize) {
        PageHelper.startPage(pageCurr,pageSize);
        *//*QueryWrapper wrapper=new QueryWrapper();
        wrapper.orderByAsc("id");
        List<Material> list=mapper.selectList(wrapper);*//*
        List<Material> list=mapper.getAllMaterial(category,subCode,subName,subModel);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list.size()>0?true:false,pageInfo,"返回所有的散装件");
    }*/
    //查询所有的散装件信息不分页
    /*public Response getMaterialWithoutSub(String parentModel, String subName,int version) {
        List<Material> list=mapper.getMaterialWithoutSub(parentModel,subName,version);
        return new Response().setII(1,list.size()>0?true:false,list,"返回子件没有添加过联系的散装件");
    }*/
    //删除散装件(将散装件标识为不可用)
    /*public Response deleteMaterial(int id) {
        UpdateWrapper wrapper=new UpdateWrapper();
        wrapper.set("status",0);
        wrapper.eq("id",id);
        int bl=mapper.update(null,wrapper);
        return new Response().setII(1,bl>0?true:false,bl,"将散装件标识为不可用");
    }*/
 
    public List<Material> getList() {
        return mapper.selectList(null);
    }
 
    public void insertBatch(List<Material> MaterialList) {
        mapper.insertBatchSomeColumn(MaterialList);
    }
 
    /**mybatis-plus逻辑删除*/
    public void deleteBatch(List<Integer> MaterialIdList) {
        mapper.deleteBatchIds(MaterialIdList);
    }
 
    //查询所有物料(分页,模糊查询)
    public Response getMaterialLimit(String subCode, String subName, String subModel, int pageCurr, int pageSize) {
       PageHelper.startPage(pageCurr,pageSize);
        List<Material> list=mapper.getMaterialLimit(subCode,subName,subModel);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list.size()>0?true:false,pageInfo,"查询所有物料(分页,模糊查询)");
    }
    //建立关联时查询所有的物料(不分页)
    public Response getAllMaterialNoLimit() {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.ne("status",0);
        wrapper.orderByAsc("id");
        List<Material> list=mapper.selectList(wrapper);
        return new Response().setII(1,list.size()>0?true:false,list,"查询所有物料(不分页)");
    }
 
    public List<String> getListByCodeList(List<String> codeList) {
        return mapper.getListByCodeList(codeList);
    }
 
    public void updateDwgUrl(List<Material> materialDwgUrlNameList) {
        mapper.updateDwgUrl(materialDwgUrlNameList);
    }
}