whycxzp
2022-09-02 6fa17d717f1d8717259efd94715b398d72d467b3
更新
4个文件已修改
61 ■■■■■ 已修改文件
src/main/java/com/whyc/pojo/ProductBomHistory.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ProductHistory.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomHistoryService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ProductBomHistoryMapper.xml 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ProductBomHistory.java
@@ -24,6 +24,8 @@
    private Integer subSVersion;
    @ApiModelProperty("bom终止版本")
    private Integer subEVersion;
    @ApiModelProperty("物料实体类")
    private Material materialObj;
    @ApiModelProperty("结构件类型")
    @TableField(exist = false)
@@ -303,4 +305,12 @@
    public void setSubEVersion(Integer subEVersion) {
        this.subEVersion = subEVersion;
    }
    public Material getMaterialObj() {
        return materialObj;
    }
    public void setMaterialObj(Material materialObj) {
        this.materialObj = materialObj;
    }
}
src/main/java/com/whyc/pojo/ProductHistory.java
@@ -46,5 +46,8 @@
    @ApiModelProperty(value = "是否启用:更新自动启用,同时可以手动启用某个")
    private Integer enabled;
    @ApiModelProperty("最大的子版本号")
    private Integer subVersionMax;
}
src/main/java/com/whyc/service/ProductBomHistoryService.java
@@ -345,7 +345,7 @@
        List<ProductBomHistory> addList = new LinkedList<>();
        List<ProductBomHistory> deleteList = new LinkedList<>();
        //通过物料编码定位,对比字段:物料型号/数量/材质/料厚/表面处理/生产商/备注,无法实现,物料没有历史记录
        /*baseBomHistoryList.forEach(baseBom->{
        baseBomHistoryList.forEach(baseBom->{
            bomHistoryList.forEach(bom->{
                if(bom.getSubCode().equals(baseBom.getSubCode())){
                    ProductBomHistory history = new ProductBomHistory();
@@ -355,7 +355,7 @@
                    }
                }
            });
        });*/
        });
        List<Integer> baseCodeList = baseBomHistoryList.stream().map(ProductBomHistory::getMaterialId).collect(Collectors.toList());
        List<Integer> codeList = bomHistoryList.stream().map(ProductBomHistory::getMaterialId).collect(Collectors.toList());
        bomHistoryList.forEach(bom->{
src/main/resources/mapper/ProductBomHistoryMapper.xml
@@ -3,26 +3,27 @@
<mapper namespace="com.whyc.mapper.ProductBomHistoryMapper" >
    <resultMap id="Map_ProductBomHistory" type="productBomHistory">
        <id property="id" column="id"></id>
        <result property="type" column="type"></result>
        <result property="category" column="category"></result>
        <result property="subCode" column="sub_code"></result>
        <result property="subName" column="sub_name"></result>
        <result property="subModel" column="sub_model"></result>
        <result property="unit" column="unit"></result>
        <result property="quantity" column="quantity"></result>
        <result property="producer" column="producer"></result>
        <result property="material" column="material"></result>
        <result property="thickness" column="thickness"></result>
        <result property="surfaceDetail" column="surface_detail"></result>
        <result property="notes" column="notes"></result>
        <result property="pictureUrl" column="picture_url"></result>
        <result property="fileUrl" column="file_url"></result>
        <result property="createDate" column="create_date"></result>
        <result property="version" column="version"></result>
        <result property="dwgUrl" column="dwg_url"></result>
        <collection property="materials" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Material" column="{parentCode=parent_code,customCode=custom_code,subCode=sub_code,version=version}" select="selectMaterial">
        </collection>
        <result property="productId" column="product_id" />
        <result property="materialId" column="material_id" />
        <result property="quantity" column="quantity"/>
        <association property="materialObj" javaType="com.whyc.pojo.Material">
            <id property="id" column="id" />
            <result property="type" column="type" />
            <result property="category" column="category"/>
            <result property="subCode" column="sub_code"/>
            <result property="subName" column="sub_name"/>
            <result property="subModel" column="sub_model"/>
            <result property="unit" column="unit"/>
            <result property="producer" column="producer"/>
            <result property="material" column="material"/>
            <result property="thickness" column="thickness"/>
            <result property="surfaceDetail" column="surface_detail"/>
            <result property="notes" column="notes"/>
            <result property="pictureUrl" column="picture_url"/>
            <result property="fileUrl" column="file_url"/>
            <result property="dwgUrl" column="dwg_url"/>
            <result property="createDate" column="create_date"/>
        </association>
    </resultMap>
    <update id="updateVersionBatch">
@@ -93,7 +94,8 @@
        and tb_product_history.id=#{productId}
    </select>
    <select id="getBomListByProductIdAndSubVersion" resultMap="Map_ProductBomHistory">
        SELECT * FROM db_doc.tb_product_bom_history h,db_doc.tb_material m
        SELECT h.product_id,h.material_id,h.quantity,m.*
        FROM db_doc.tb_product_bom_history h,db_doc.tb_material m
        where product_id = #{productId}
        and sub_s_version &lt;= #{subVersion}
        and sub_e_version &gt;= #{subVersion}