查询出所有的产品信息(分页加模糊查询<产品的编码,型号,名字,定制表编号>)
3个文件已修改
40 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/ProductBomController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ProductController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ProductBomController.java
@@ -14,7 +14,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -56,11 +55,11 @@
        return new Response().set(1,true,"记录下载日志");
    }
    @ApiOperation(tags = "产品管理",value = "获取所有产品信息")
   /* @ApiOperation(tags = "产品管理",value = "获取所有产品信息")
    @GetMapping("getAllBom")
    public Response getAllBom( @RequestParam(required = false) String parentCode,@RequestParam(required = false) String parentName, @RequestParam(required = false) String parentModel,  @RequestParam int pageCurr, @RequestParam int pageSize){
        return service.getAllBom(parentCode,parentName,parentModel,pageCurr,pageSize);
    }
    }*/
    @ApiOperation(tags = "产品管理",value = "根据母料型号查询子件信息及有最新版本关联的散装件信息")
    @GetMapping("getSubByMaterialProduct")
src/main/java/com/whyc/controller/ProductController.java
@@ -6,9 +6,13 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "产品管理")
@RestController
@RequestMapping("product")
public class ProductController {
    @Autowired
    private ProductService service;
@@ -18,4 +22,11 @@
    public Response getProductByMaterial(@RequestParam String subCode){
        return service.getProductByMaterial(subCode);
    }
    @ApiOperation(value = "查询出所有的产品信息(分页加模糊查询<产品的编码,型号,名字,定制表编号>)",notes = "8.17修改后使用")
    @GetMapping("getAllProduct")
    public Response getAllProduct(@RequestParam(required = false) String parentCode,@RequestParam(required = false) String parentName, @RequestParam(required = false) String parentModel
            ,  @RequestParam(required = false) String customCode, @RequestParam int pageCurr, @RequestParam int pageSize){
        return service.getAllProduct(parentCode,parentName,parentModel,customCode,pageCurr,pageSize);
    }
}
src/main/java/com/whyc/service/ProductService.java
@@ -1,5 +1,8 @@
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.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,4 +19,25 @@
        List list=mapper.getProductByMaterial(subCode);
        return new Response().setII(1,list.size()>0?true:false,list,"");
    }
    //查询出所有的产品信息(分页加模糊查询<产品的编码,型号,名字,定制表编号>
    public Response getAllProduct(String parentCode, String parentName, String parentModel, String customCode, int pageCurr, int pageSize) {
        PageHelper.startPage(pageCurr,pageSize);
        QueryWrapper wrapper=new QueryWrapper();
        if(parentCode!=null&&!parentCode.isEmpty()){
            wrapper.like("parent_code",parentCode);
        }
        if(parentName!=null&&!parentName.isEmpty()){
            wrapper.like("parent_name",parentName);
        }
        if(parentModel!=null&&!parentModel.isEmpty()){
            wrapper.like("parent_model",parentModel);
        }
        if(customCode!=null&&!customCode.isEmpty()){
            wrapper.like("custom_code",customCode);
        }
        wrapper.orderByAsc("id");
        List list=mapper.selectList(wrapper);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list.size()>0?true:false,pageInfo,"返回产品信息");
    }
}