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);
|
}
|
}
|