From d337c8e2e21df8ff7d2ecae493fa7a65627fedea Mon Sep 17 00:00:00 2001
From: Zhu Zhonghua <zhonghua@qq.com>
Date: 星期四, 22 五月 2025 14:52:48 +0800
Subject: [PATCH] 处理焊缝大数据插入异常问题

---
 aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml |   67 ++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml
index c17395f..2cac72f 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml
@@ -4,10 +4,10 @@
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.aps.core.mapper.ApsBomMapper">
     
-    <resultMap type="ApsBom" id="ApsBomResult">
+    <resultMap type="com.aps.core.domain.ApsBom" id="ApsBomResult">
         <result property="id"    column="id"    />
-        <result property="bomId"    column="bom_id"    />
-        <result property="parentBomId"    column="parent_bom_id"    />
+        <result property="bomLineId"    column="bom_line_id"    />
+        <result property="bomHeaderId"    column="bom_header_id"    />
         <result property="itemCode"    column="item_code"    />
         <result property="itemName"    column="item_name"    />
         <result property="startDate"    column="start_date"    />
@@ -28,23 +28,26 @@
     </resultMap>
 
     <sql id="selectApsBomVo">
-        select id, bom_id, parent_bom_id, item_code, item_name, start_date, end_date, org_code, del_flag, create_by, create_time, update_by, update_time, drawing_no, process_no, unit, num, total_num, preparation_time, processing_time from aps_bom
+        select id, bom_line_id, bom_header_id, item_code, item_name, start_date, end_date, org_code,
+               del_flag, create_by, create_time, update_by, update_time, drawing_no, process_no, unit, num,
+               total_num, preparation_time, processing_time
+        from aps_bom_line
     </sql>
 
-    <select id="selectApsBomList" parameterType="ApsBom" resultMap="ApsBomResult">
+    <select id="selectApsBomList" parameterType="com.aps.core.domain.ApsBom" resultMap="ApsBomResult">
         <include refid="selectApsBomVo"/>
         <where>  
-            <if test="bomId != null  and bomId != ''"> and bom_id = #{bomId}</if>
-            <if test="parentBomId != null  and parentBomId != ''"> and parent_bom_id = #{parentBomId}</if>
-            <if test="itemCode != null  and itemCode != ''"> and item_code like '%'||#{itemCode}||'%'</if>
-            <if test="itemName != null  and itemName != ''"> and item_name like '%'|| #{itemName}||'%'</if>
+            <if test="bomLineId != null  and bomLineId != ''"> and bom_line_id = #{bomLineId}</if>
+            <if test="bomHeaderId != null  and bomHeaderId != ''"> and bom_header_id = #{bomHeaderId}</if>
+            <if test="itemCode != null  and itemCode != ''"> and item_code like '%' || #{itemCode} || '%'</if>
+            <if test="itemName != null  and itemName != ''"> and item_name like '%' || #{itemName} || '%'</if>
             <if test="params.beginStartDate != null and params.beginStartDate != '' and params.endStartDate != null and params.endStartDate != ''"> and start_date between #{params.beginStartDate} and #{params.endStartDate}</if>
             <if test="params.beginEndDate != null and params.beginEndDate != '' and params.endEndDate != null and params.endEndDate != ''"> and end_date between #{params.beginEndDate} and #{params.endEndDate}</if>
             <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
             <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
             and del_flag='0'
         </where>
-        order by parent_bom_id,bom_id
+        order by bom_header_id,bom_line_id
     </select>
     
     <select id="selectApsBomById" parameterType="Long" resultMap="ApsBomResult">
@@ -52,11 +55,11 @@
         where id = #{id}
     </select>
 
-    <insert id="insertApsBom" parameterType="ApsBom" useGeneratedKeys="true" keyProperty="id">
-        insert into aps_bom
+    <insert id="insertApsBom" parameterType="com.aps.core.domain.ApsBom" useGeneratedKeys="true" keyProperty="id">
+        insert into aps_bom_line
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="bomId != null">bom_id,</if>
-            <if test="parentBomId != null">parent_bom_id,</if>
+            <if test="bomLineId != null">bom_line_id,</if>
+            <if test="bomHeaderId != null">bom_header_id,</if>
             <if test="itemCode != null">item_code,</if>
             <if test="itemName != null">item_name,</if>
             <if test="startDate != null">start_date,</if>
@@ -76,8 +79,8 @@
             <if test="processingTime != null">processing_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="bomId != null">#{bomId},</if>
-            <if test="parentBomId != null">#{parentBomId},</if>
+            <if test="bomLineId != null">#{bomLineId},</if>
+            <if test="bomHeaderId != null">#{bomHeaderId},</if>
             <if test="itemCode != null">#{itemCode},</if>
             <if test="itemName != null">#{itemName},</if>
             <if test="startDate != null">#{startDate},</if>
@@ -98,11 +101,11 @@
          </trim>
     </insert>
 
-    <update id="updateApsBom" parameterType="ApsBom">
-        update aps_bom
+    <update id="updateApsBom" parameterType="com.aps.core.domain.ApsBom">
+        update aps_bom_line
         <trim prefix="SET" suffixOverrides=",">
-            <if test="bomId != null">bom_id = #{bomId},</if>
-            <if test="parentBomId != null">parent_bom_id = #{parentBomId},</if>
+            <if test="bomLineId != null">bom_line_id = #{bomLineId},</if>
+            <if test="bomHeaderId != null">bom_header_id = #{bomHeaderId},</if>
             <if test="itemCode != null">item_code = #{itemCode},</if>
             <if test="itemName != null">item_name = #{itemName},</if>
             <if test="startDate != null">start_date = #{startDate},</if>
@@ -125,13 +128,33 @@
     </update>
 
     <delete id="deleteApsBomById" parameterType="Long">
-        delete from aps_bom where id = #{id}
+        delete from aps_bom_line where id = #{id}
     </delete>
 
     <delete id="deleteApsBomByIds" parameterType="String">
-        delete from aps_bom where id in 
+        delete from aps_bom_line where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
+
+    <resultMap type="com.aps.core.domain.ApsBom" id="ApsBomLineResult">
+        <result property="id"    column="id"    />
+        <result property="bomLineId"    column="bom_line_id"    />
+        <result property="itemCode"    column="item_code"    />
+        <result property="itemName"    column="item_name"    />
+        <result property="num"    column="num"    />
+    </resultMap>
+    <sql id="selectApsBomLineVo">
+        select id, bom_line_id,  item_code, item_name,  num
+        from aps_bom_line
+    </sql>
+
+    <select id="selectApsBomLineList" parameterType="String" resultMap="ApsBomLineResult">
+        select id, bom_line_id,  item_code,   num
+        from aps_bom_line  where del_flag='0'
+             and org_code = #{orgCode}
+              and bom_header_id = #{bomHeaderId}
+        order by bom_line_id
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3