lxw
2022-08-08 9826962e50d84c084a5d9018fcff7a6aa231a38d
产品管理和散装件管理中与散装件有联系的都要加上版本
7个文件已修改
41 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/ComponentController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ProductBomController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/ComponentMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ComponentService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ComponentMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ProductBomMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ComponentController.java
@@ -22,10 +22,10 @@
    public Response getAllComponent(@RequestParam int pageCurr, @RequestParam int pageSize){
        return service.getAllComponent(pageCurr,pageSize);
    }
    @ApiOperation(tags = "产品管理",value = "查询所有的散装件信息不分页(不包含被关联的散装件,status=1可用)")
    @ApiOperation(tags = "产品管理",value = "查询所有的散装件信息不分页(不包含被最新版本关联的散装件,status=1可用)")
    @GetMapping("getComponentWithoutSub")
    public Response getComponentWithoutSub(@RequestParam String parentModel, @RequestParam String subName){
        return service.getComponentWithoutSub(parentModel,subName);
    public Response getComponentWithoutSub(@RequestParam String parentModel, @RequestParam String subName, @RequestParam int version){
        return service.getComponentWithoutSub(parentModel,subName,version);
    }
    @ApiOperation(value = "删除散装件(将散装件标识为不可用)")
    @GetMapping("deleteComponent")
src/main/java/com/whyc/controller/ProductBomController.java
@@ -62,7 +62,7 @@
        return service.getAllBom();
    }
    @ApiOperation(tags = "产品管理",value = "根据母料型号查询子件信息及有关联的散装件信息")
    @ApiOperation(tags = "产品管理",value = "根据母料型号查询子件信息及有最新版本关联的散装件信息")
    @GetMapping("getSubByComponentProduct")
    public Response getSubByComponentProduct(@RequestParam String parentModel){
        return service.getSubByComponentProduct(parentModel);
src/main/java/com/whyc/mapper/ComponentMapper.java
@@ -6,7 +6,7 @@
public interface ComponentMapper extends CustomMapper<Component>{
    //查询所有的散装件信息不分页
    List<Component> getComponentWithoutSub(String parentModel, String subName);
    List<Component> getComponentWithoutSub(String parentModel, String subName,int version);
    //查询所有的散装件信息加设置了替换关系的子件信息
    List<Component> getAllComponent();
}
src/main/java/com/whyc/service/ComponentService.java
@@ -27,8 +27,8 @@
        return new Response().setII(1,list.size()>0?true:false,pageInfo,"返回所有的散装件");
    }
    //查询所有的散装件信息不分页
    public Response getComponentWithoutSub(String parentModel, String subName) {
        List<Component> list=mapper.getComponentWithoutSub(parentModel,subName);
    public Response getComponentWithoutSub(String parentModel, String subName,int version) {
        List<Component> list=mapper.getComponentWithoutSub(parentModel,subName,version);
        return new Response().setII(1,list.size()>0?true:false,list,"返回子件没有添加过联系的散装件");
    }
    //删除散装件(将散装件标识为不可用)
src/main/java/com/whyc/service/ProductBomService.java
@@ -359,7 +359,7 @@
        List<ProductBom> list=mapper.getAllSubWithOutComponent(componentId);
        return new Response().setII(1,list.size()>0?true:false,list,"返回数据");
    }
    //根据母料型号查询子件信息及有关联的散装件信息
    //根据母料型号查询子件信息及有最新版本关联的散装件信息
    public Response getSubByComponentProduct(String parentModel) {
        List<ProductBom> list=mapper.getSubByComponentProduct(parentModel);
        return new Response().setII(1,list.size()>0?true:false,list,"返回数据");
src/main/resources/mapper/ComponentMapper.xml
@@ -5,7 +5,10 @@
    <select id="getComponentWithoutSub" resultType="com.whyc.pojo.Component">
        select * from  db_doc.tb_component  b
        where (select count(1) as num from  db_doc.tb_component_product  c where b.id= c.component_id   and c.sub_name=#{subName} and parent_model=#{parentModel} ) = 0
        where (select count(1) as num from  db_doc.tb_component_product_history  c
               where b.id= c.component_id   and c.sub_name=#{subName} and parent_model=#{parentModel}
               and c.e_version=#{version}
             ) = 0
        and b.status=1;
    </select>
@@ -38,8 +41,8 @@
        order by id asc
    </select>
    <select id="selectProductBom"  resultType="com.whyc.pojo.ProductBom">
        select DISTINCT tb_product_bom.*  FROM db_doc.tb_product_bom,db_doc.tb_component_product
        where tb_product_bom.sub_name=tb_component_product.sub_name
        and tb_product_bom.parent_model=tb_component_product.parent_model and tb_component_product.component_id=#{id}
        select DISTINCT tb_product_bom.*  FROM db_doc.tb_product_bom,db_doc.tb_component_product_history
        where  tb_product_bom.version=tb_component_product_history.e_version  and  tb_product_bom.sub_name=tb_component_product_history.sub_name
        and tb_product_bom.parent_model=tb_component_product_history.parent_model and tb_component_product_history.component_id=#{id}
    </select>
</mapper>
src/main/resources/mapper/ProductBomMapper.xml
@@ -54,8 +54,11 @@
        </where>
    </select>
    <select id="getAllSubWithOutComponent" resultType="com.whyc.pojo.ProductBom">
        select * from  db_doc.tb_product_bom  b where (select count(1) as num from  db_doc.tb_component_product  c
         where b.parent_model= c.parent_model  and b.sub_name= c.sub_name and c.component_id=#{componentId} ) = 0
        select * from  db_doc.tb_product_bom  b
        where (select count(1) as num from  db_doc.tb_component_product_history  c
               where b.parent_model= c.parent_model  and b.sub_name= c.sub_name  and b.version=c.e_version
                and c.component_id=#{componentId}
              ) = 0
    </select>
    <resultMap id="componentList" type="productBom">
@@ -83,7 +86,7 @@
        <result property="version" column="version"></result>
        <result property="dwgUrl" column="dwg_url"></result>
        <result property="parentVersion" column="parent_version"></result>
        <collection property="components" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Component" column="{subName=sub_name,parentModel=parent_model}" select="selectComponent">
        <collection property="components" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Component" column="{subName=sub_name,parentModel=parent_model,eVersion=version}" select="selectComponent">
        </collection>
    </resultMap>
@@ -96,7 +99,8 @@
    </select>
    <select id="selectComponent"  resultType="com.whyc.pojo.Component">
        select DISTINCT tb_component.*  FROM db_doc.tb_component,db_doc.tb_component_product where tb_component.id=tb_component_product.component_id
        and tb_component_product.sub_name=#{subName} and tb_component_product.parent_model=#{parentModel}
        select DISTINCT tb_component.*  FROM db_doc.tb_component,db_doc.tb_component_product_history where tb_component.id=tb_component_product_history.component_id
        and tb_component_product_history.sub_name=#{subName} and tb_component_product_history.parent_model=#{parentModel
        and tb_component_product_history.e_version=#{eVersion}
    </select>
</mapper>