From 261698358e2b756a61e992bc1651e01b3f45290b Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 23 十月 2025 16:50:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/common/servicebase/src/main/resources/mapper/OptimizeProjectMapper.xml |   77 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OptimizeProjectMapper.xml b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OptimizeProjectMapper.xml
index decf51f..da44ded 100644
--- a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OptimizeProjectMapper.xml
+++ b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OptimizeProjectMapper.xml
@@ -13,12 +13,85 @@
 
     </resultMap>
 
+    <resultMap id="resultMap" type="com.mes.pp.entity.OptimizeProject">
+        <result property="id" column="id"/>
+        <result property="projectNo" column="project_no"/>
+        <result property="projectName" column="project_name"/>
+        <result property="state" column="state"/>
+        <result property="type" column="type"/>
+    </resultMap>
+
     <select id="saveProject" parameterType="com.mes.pp.entity.request.OptimizeRequest" resultMap="sequenceMap">
-        select a.project_no, b.glass_type, a.width, a.height, b.glass_thickness, a.heat_layout_sort, 0 as state
+        select a.project_no,
+               1                                            as glass_type,
+               a.width,
+               a.height,
+               REGEXP_REPLACE(b.glass_thickness, '\\D', '') as glass_thickness,
+               a.heat_layout_sort,
+               0                                            as state
         from optimize_detail a
                  left join optimize_project b on a.project_no = b.project_no
-        where a.project_no = #{projectNo,jdbcType=VARCHAR}
+        where a.project_no = #{projectNo}
     </select>
 
+    <select id="queryEngineer" parameterType="com.mes.pp.entity.OptimizeProject" resultMap="resultMap">
+        select p.project_no,
+               p.project_name
+        from pp.optimize_project p
+        where p.state = 100
+          and p.project_no not in (
+            select es.project_no
+            from north_glass_mes.engineer_scheduling es
+            where es.project_no is not null
+        )
+        order by p.id
+    </select>
+
+    <select id="engineerScheduling" parameterType="com.mes.pp.entity.request.OptimizeRequest" resultMap="resultMap">
+        select es.project_no,
+        es.project_name,
+        es.type
+        from north_glass_mes.engineer_scheduling es
+        where es.state = 100
+        <if test="type != null and type != ''">
+            and es.type = #{type}
+        </if>
+        order by es.id
+    </select>
+
+    <!-- 鏍规嵁绫诲瀷鍒犻櫎engineer_scheduling琛ㄤ腑鐨勬暟鎹� -->
+    <delete id="deleteByType">
+        DELETE
+        FROM north_glass_mes.engineer_scheduling
+        WHERE type = #{type}
+    </delete>
+    <delete id="deleteByScheduling">
+        DELETE
+        FROM north_glass_mes.engineer_scheduling
+        WHERE project_no = #{engineerId}
+        and type in (
+        <foreach collection="types" item="item" separator=",">
+            #{item}
+        </foreach>
+        )
+    </delete>
+
+    <!-- 鎵归噺鎻掑叆鏁版嵁鍒癳ngineer_scheduling琛� -->
+    <insert id="batchInsert">
+        INSERT INTO north_glass_mes.engineer_scheduling (
+        project_no,
+        project_name,
+        state,
+        type
+        ) VALUES
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.projectNo},
+            #{item.projectName},
+            #{item.state},
+            #{item.type}
+            )
+        </foreach>
+    </insert>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0