From 6ad5c2cdc193cf7bb02884961b7434cd7f607a0d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 16 四月 2026 10:48:09 +0800
Subject: [PATCH] feat(production): 扩展生产工艺路线支持多产品绑定及工单权限控制

---
 src/main/resources/mapper/production/ProcessRouteMapper.xml |   61 ++++++++++++++++++++++++------
 1 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/src/main/resources/mapper/production/ProcessRouteMapper.xml b/src/main/resources/mapper/production/ProcessRouteMapper.xml
index 058faf3..4a12183 100644
--- a/src/main/resources/mapper/production/ProcessRouteMapper.xml
+++ b/src/main/resources/mapper/production/ProcessRouteMapper.xml
@@ -1,25 +1,60 @@
-<?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">
+锘�<?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.ruoyi.production.mapper.ProcessRouteMapper">
 
-
     <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProcessRoute">
-            <id property="id" column="id"/>
-            <result property="productModelId" column="product_model_id"/>
-            <result property="description" column="description"/>
-            <result property="tenantId" column="tenant_id"/>
-            <result property="createTime" column="create_time"/>
-            <result property="updateTime" column="update_time"/>
+        <id property="id" column="id"/>
+        <result property="productModelId" column="product_model_id"/>
+        <result property="productModelIds" column="product_model_ids"/>
+        <result property="description" column="description"/>
+        <result property="tenantId" column="tenant_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="processRouteCode" column="process_route_code"/>
+        <result property="bomId" column="bom_id"/>
     </resultMap>
 
     <select id="pageProcessRouteDto" resultType="com.ruoyi.production.dto.ProcessRouteDto">
-        select ps.*, pm.speculative_trading_name
+        select ps.*,
+               t.product_name,
+               t.product_id,
+               t.model,
+               pb.bom_no
         from process_route ps
-                 left join product_model pm on ps.product_model_id = pm.id
+        left join product_bom pb on ps.bom_id = pb.id
+        left join (
+            select pr.id as route_id,
+                   group_concat(
+                           distinct p.product_name
+                           order by
+                               case
+                                   when pr.product_model_ids is null or pr.product_model_ids = '' then pm.id
+                                   else find_in_set(pm.id, pr.product_model_ids)
+                               end
+                           separator ','
+                   ) as product_name,
+                   max(pm.product_id) as product_id,
+                   group_concat(
+                           distinct pm.model
+                           order by
+                               case
+                                   when pr.product_model_ids is null or pr.product_model_ids = '' then pm.id
+                                   else find_in_set(pm.id, pr.product_model_ids)
+                               end
+                           separator ','
+                   ) as model
+            from process_route pr
+            left join product_model pm
+                   on (find_in_set(pm.id, pr.product_model_ids) > 0
+                       or ((pr.product_model_ids is null or pr.product_model_ids = '') and pm.id = pr.product_model_id))
+            left join product p on pm.product_id = p.id
+            group by pr.id
+        ) t on t.route_id = ps.id
         <where>
-            <if test="c.speculativeTradingName != null || c.speculativeTradingName != ''">
-                and pm.speculative_trading_name like concat('%',#{c.speculativeTradingName},'%')
+            <if test="c.model != null and c.model != ''">
+                and t.model like concat('%',#{c.model},'%')
             </if>
         </where>
+        order by ps.id asc
     </select>
 </mapper>

--
Gitblit v1.9.3