lxw
2022-07-19 7a1af665e3de11f27b18c07f580b884d18f1465b
图纸管理检索查询
4个文件已添加
1个文件已修改
165 ■■■■ 已修改文件
src/main/java/com/whyc/controller/ProductBomController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/ProductBomMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ProductBom.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ProductBomMapper.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ProductBomController.java
New file
@@ -0,0 +1,24 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.ProductBom;
import com.whyc.service.ProductBomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(tags = "图纸管理")
@RestController
@RequestMapping("productBom")
public class ProductBomController {
    @Autowired
    private ProductBomService service;
    @ApiOperation("图纸分类检索")
    @PostMapping("searchCadDrawer")
    private Response searchCadDrawer(@RequestBody ProductBom productBom, @RequestParam int pageCurr, @RequestParam int pageSize){
        return service.searchCadDrawer(productBom,pageCurr,pageSize);
    }
}
src/main/java/com/whyc/mapper/ProductBomMapper.java
New file
@@ -0,0 +1,10 @@
package com.whyc.mapper;
import com.whyc.pojo.ProductBom;
import java.util.List;
public interface ProductBomMapper extends CustomMapper<ProductBom>{
    //图纸分类检索
    List searchCadDrawer(ProductBom productBom);
}
src/main/java/com/whyc/pojo/ProductBom.java
@@ -1,8 +1,12 @@
package com.whyc.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import org.apache.ibatis.type.Alias;
import java.io.Serializable;
import java.util.Date;
/**
@@ -10,44 +14,62 @@
 */
@TableName(schema = "db_doc",value = "tb_product_bom")
@Alias("ProductBom")
public class ProductBom {
public class ProductBom implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer   id;
    /**母料编号*/
    @ApiModelProperty(value = "母料编号")
    private String     parentCode;
    /**母料名称*/
    @ApiModelProperty(value = "母料名称")
    private String     parentName;
    /**母料型号*/
    @ApiModelProperty(value = "母料型号")
    private String     parentModel;
    /**    类别*/
    @ApiModelProperty(value = "类别")
    private String     category;
    /**子件编码*/
    @ApiModelProperty(value = "子件编码")
    private String     subCode;
    /**子件名称*/
    @ApiModelProperty(value = "子件名称")
    private String     subName;
    /**子件型号*/
    @ApiModelProperty(value = "子件型号")
    private String     subModel;
    /**单位*/
    @ApiModelProperty(value = "单位")
    private String     unit;
    /**子件数量*/
    @ApiModelProperty(value = "子件数量")
    private Integer   quantity;
    /**生产商*/
    @ApiModelProperty(value = "生产商")
    private String     producer;
    /**封装类型/材质*/
    @ApiModelProperty(value = "封装类型/材质")
    private String     material;
    /**元件编号/料厚*/
    @ApiModelProperty(value = "元件编号/料厚")
    private String     thickness;
    /**表面处理/物料详情*/
    @ApiModelProperty(value = "表面处理/物料详情")
    private String     surfaceDetail;
    /**    备注*/
    @ApiModelProperty(value = "备注")
    private String     notes;
    private String     pictureUrl;
    private String     fileUrl;
    /**上传人*/
    @ApiModelProperty(value = "上传人")
    private String     upUser;
    private Date    createDate;
    private Date updateDate;
    /**版本*/
    @ApiModelProperty(value = "版本")
    private Integer   version;
    public Integer getId() {
src/main/java/com/whyc/service/ProductBomService.java
New file
@@ -0,0 +1,25 @@
package com.whyc.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.ProductBomMapper;
import com.whyc.pojo.ProductBom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ProductBomService {
    @Autowired(required = false)
    private ProductBomMapper mapper;
    //图纸分类检索
    public Response searchCadDrawer(ProductBom productBom,int pageCurr,int pageSize) {
        PageHelper.startPage(pageCurr,pageSize);
        List list=mapper.searchCadDrawer(productBom);
        PageInfo pageInfo=new PageInfo(list);
        return  new Response().setII(1,list.size()>0?true:false,pageInfo,"数据返回");
    }
}
src/main/resources/mapper/ProductBomMapper.xml
New file
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.whyc.mapper.ProductBomMapper">
    <select id="searchCadDrawer" resultType="java.util.List" parameterType="ProductBom">
        select distinct * from db_doc.tb_product_bom
        <where>
           1=1
           <if test="parentCode!=null&amp;&amp;parentCode!=''">
               and parent_code like '%${parentCode}%'
           </if>
            <if test="parentName!=null&amp;&amp;parentName!=''">
                and parent_name like '%${parentName}%'
            </if>
            <if test="parentModel!=null&amp;&amp;parentModel!=''">
                and parent_model like '%${parentModel}%'
            </if>
            <if test="category!=null&amp;&amp;category!=''">
                and category like '%${category}%'
            </if>
            <if test="subCode!=null&amp;&amp;subCode!=''">
                and sub_code like '%${subCode}%'
            </if>
            <if test="subName!=null&amp;&amp;subName!=''">
                and sub_name like '%${subName}%'
            </if>
            <if test="subModel!=null&amp;&amp;subModel!=''">
                and sub_model like '%${subModel}%'
            </if>
            <if test="unit!=null&amp;&amp;unit!=''">
                and unit like '%${unit}%'
            </if>
            <if test="producer!=null&amp;&amp;producer!=''">
                and producer like '%${producer}%'
            </if>
            <if test="material!=null&amp;&amp;material!=''">
                and material like '%${material}%'
            </if>
            <if test="thickness!=null&amp;&amp;thickness!=''">
                and material like '%${thickness}%'
            </if>
            <if test="surfaceDetail!=null&amp;&amp;surfaceDetail!=''">
                and surface_detail like '%${surfaceDetail}%'
            </if>
            order by  parent_code asc,sub_code asc
        </where>
    </select>
</mapper>