he wei
2022-09-02 d69b38ae695ff86d265e84fb44e1b21217a97d5f
src/main/java/com/whyc/service/MaterialService.java
@@ -1,11 +1,13 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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 com.whyc.pojo.ProductBom;
import com.whyc.util.CommonUtil;
import com.whyc.util.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,12 +33,12 @@
        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,"返回所有的散装件");
        return new Response().setII(1,list.size()>0,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,"返回子件没有添加过联系的散装件");
        return new Response().setII(1,list.size()>0,list,"返回子件没有添加过联系的散装件");
    }*/
    //删除散装件(将散装件标识为不可用)
    /*public Response deleteMaterial(int id) {
@@ -44,7 +46,7 @@
        wrapper.set("status",0);
        wrapper.eq("id",id);
        int bl=mapper.update(null,wrapper);
        return new Response().setII(1,bl>0?true:false,bl,"将散装件标识为不可用");
        return new Response().setII(1,bl>0,bl,"将散装件标识为不可用");
    }*/
    public List<Material> getList() {
@@ -65,7 +67,7 @@
       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,"查询所有物料(分页,模糊查询)");
        return new Response().setII(1,list.size()>0,pageInfo,"查询所有物料(分页,模糊查询)");
    }
    //建立关联时查询所有的物料(不分页)
    public Response getAllMaterialNoLimit() {
@@ -73,7 +75,7 @@
        wrapper.ne("status",0);
        wrapper.orderByAsc("id");
        List<Material> list=mapper.selectList(wrapper);
        return new Response().setII(1,list.size()>0?true:false,list,"查询所有物料(不分页)");
        return new Response().setII(1,list.size()>0,list,"查询所有物料(不分页)");
    }
    public List<String> getListByCodeList(List<String> codeList) {
@@ -151,4 +153,14 @@
    private List<Material> getListByCodeAndModelList(List<Material> materialList) {
        return mapper.getListByCodeAndModelList(materialList);
    }
    public List<Material> getListByCodeAndModelList2(List<ProductBom> bomList) {
        return mapper.getListByCodeAndModelList2(bomList);
    }
    public Material getByCodeAndModel(String subCode, String subModel) {
        QueryWrapper<Material> query = Wrappers.query();
        query.eq("sub_code",subCode).eq("sub_model",subModel).last(" limit 1");
        return mapper.selectOne(query);
    }
}