From 165050015b3bc1a8a41eed7851d29e2e8d3db187 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期一, 07 四月 2025 17:33:48 +0800
Subject: [PATCH] 成品下单人员权限修改

---
 inspect-server/src/main/resources/mapper/InsOrderMapper.xml |  176 ++++++++--------------------------------------------------
 1 files changed, 25 insertions(+), 151 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
index 2eb8e88..2fe9e71 100644
--- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -96,11 +96,28 @@
         GROUP BY ins_sample_id
         ORDER BY ins_sample_id) isu ON isu.ins_sample_id = io.id
         where (io.ifs_inventory_id IS NULL OR TRIM(io.ifs_inventory_id)  = '')
-        <if test="isOrderAll != null and isOrderAll != ''">
+        <if test="otherParam.isOrderAll != null and otherParam.isOrderAll != ''">
             AND io.state in (1, 4)
         </if>
-        <if test="laboratory!=null and laboratory!=''">
-            AND io.laboratory=#{laboratory}
+        <if test="otherParam.laboratory!=null and otherParam.laboratory!=''">
+            AND io.laboratory=#{otherParam.laboratory}
+        </if>
+        <if test="otherParam.checkUserFlag != null and otherParam.checkUserFlag and otherParam.checkUserId != null ">
+            AND io.id IN (
+                SELECT DISTINCT
+                ins_sample_id AS orderId
+                FROM
+                ins_sample_user
+                WHERE
+                user_id = #{otherParam.checkUserId} UNION
+                SELECT
+                T2.ins_order_id AS orderId
+                FROM
+                ins_product T1
+                JOIN ins_sample T2 ON T1.ins_sample_id = T2.id
+                WHERE
+                T1.check_user_id = #{otherParam.checkUserId}
+            )
         </if>
         GROUP BY io.id,type
         order by type desc,io.id desc
@@ -166,10 +183,13 @@
         i.order_type,
         ip.sort,
         ip.cable_tag,
-        ip.radius
+        ip.radius,
+        ip.check_user_id,
+        ur.name AS checkUserName
         from ins_sample isa
         left join ins_order i on isa.ins_order_id = i.id
         left join ins_product ip on isa.id = ip.ins_sample_id
+        left join user ur on ip.check_user_id = ur.id
         where ip.state = 1
         and i.id=#{id}
         and ip.is_binding != 1
@@ -178,60 +198,7 @@
             ${ew.customSqlSegment}
         </if>
     </select>
-    <select id="selectCostStatistics" resultType="com.ruoyi.inspect.dto.CostStatisticsDto">
-        select * from (
-        SELECT A.id,
-        A.entrust_code,
-        A.create_time,
-        A.sample,
-        A.model,
-        A.inspection_item,
-        A.company,
-        A.`name`,
-        COUNT(1) num,
-        SUM(A.price) price,
-        SUM(A.cost) cost
-        FROM
-        (SELECT
-        i.id,
-        i.entrust_code,
-        i.create_time,
-        isa.sample,
-        isa.sample_code,
-        isa.model,
-        c.price,
-        c.cost,
-        c.inspection_item,
-        i.company,
-        u.`name`,
-        i.create_user,
-        c.ins_sample_id
-        FROM
-        ins_order i
-        LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id
-        LEFT JOIN `user` u ON u.id = i.user_id
-        left join custom cus on cus.id = u.company
-        LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,
-        GROUP_CONCAT(b.inspection_item2
-        SEPARATOR ',')
-        inspection_item from (select * ,
-        GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP
-        BY b.ins_sample_id) c ON c.ins_sample_id = isa.id
-        where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not  NULL)A
-        GROUP BY
-        A.id,
-        A.entrust_code,
-        A.create_time,
-        A.sample,
-        A.model,
-        A.inspection_item,
-        A.company,
-        A.`name`
-        ) B
-        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
-            ${ew.customSqlSegment}
-        </if>
-    </select>
+
     <select id="selectDeviceList" resultType="java.util.Map">
         select device_name,
                en_device_name,
@@ -272,28 +239,6 @@
         </if>
     </select>
 
-    <select id="getCount" resultType="long">
-        select count(1)
-        from (
-        SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id
-        from ins_order io
-        left JOIN ins_sample sam on io.id=sam.ins_order_id
-        LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id
-        LEFT JOIN
-        (SELECT create_time,create_user,ins_product_id FROM (select * FROM ins_product_user ORDER BY
-        ins_product_user.create_time DESC) a GROUP BY a.ins_product_id) b
-        on b.ins_product_id=ip.id
-        left JOIN `user` u on u.id=b.create_user
-        where (ip.ins_result=0 OR ip.state=0)
-        <if test="inspectionItems != null and inspectionItems != ''">
-            and inspection_item like concat('%', #{inspectionItems}, '%')
-        </if>
-        <if test="orderNumber != null and orderNumber != ''">
-            and io.entrust_code like concat('%', #{orderNumber}, '%')
-        </if>
-        ) temp
-    </select>
-
     <select id="getStandardMethodCode" resultType="java.lang.String">
         select code
         from standard_method
@@ -312,77 +257,6 @@
                      where son_laboratory = #{laboratory}
                        and ins_sample_id in
                            (select id from ins_sample where ins_order_id = #{id}))
-    </select>
-
-    <select id="selectCostStatistics2" resultType="com.ruoyi.inspect.dto.CostStatisticsDto">
-        select * from (
-        SELECT A.id,
-        A.entrust_code,
-        A.create_time,
-        A.sample,
-        A.model,
-        A.inspection_item,
-        A.company,
-        A.`name`,
-        production,
-        engineering,
-        COUNT(1) num,
-        SUM(A.price) price,
-        SUM(A.cost) cost
-        FROM
-        (SELECT
-        i.id,
-        i.entrust_code,
-        i.create_time,
-        isa.sample,
-        isa.sample_code,
-        isa.model,
-        c.price,
-        c.cost,
-        c.inspection_item,
-        i.company,
-        u.`name`,
-        i.create_user,
-        c.ins_sample_id,
-        production,
-        engineering
-        FROM
-        ins_order i
-        LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id
-        LEFT JOIN `user` u ON u.id = i.user_id
-        left join custom cus on cus.id = u.company
-        LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,
-        GROUP_CONCAT(b.inspection_item2
-        SEPARATOR ',')
-        inspection_item from (select * ,
-        GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP
-        BY b.ins_sample_id) c ON c.ins_sample_id = isa.id
-        where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not  NULL)A
-        GROUP BY
-        A.id,
-        A.entrust_code,
-        A.create_time,
-        A.sample,
-        A.model,
-        A.inspection_item,
-        A.company,
-        A.`name`,
-        production,
-        engineering
-        ORDER BY
-        A.id,
-        A.entrust_code,
-        A.create_time,
-        A.sample,
-        A.model,
-        A.inspection_item,
-        A.company,
-        A.`name`,
-        production,
-        engineering) B
-        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
-            ${ew.customSqlSegment}
-        </if>
     </select>
 
     <select id="seldepLimsId" resultType="java.lang.String">

--
Gitblit v1.9.3