From 804c80b0fd284c7464066efbd5e5833ddacfb635 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 11 四月 2025 13:11:16 +0800
Subject: [PATCH] 原辅材下单优化
---
basic-server/src/main/resources/mapper/StandardTreeMapper.xml | 55 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
index e97a9cd..ffe58e3 100644
--- a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -25,6 +25,18 @@
<resultMap id="LaboratoryDto" type="com.ruoyi.basic.dto.LaboratoryDto">
<result property="label" column="laboratory"/>
<result property="value" column="laboratory"/>
+ <collection property="children" resultMap="ObjectTypeDto"/>
+ </resultMap>
+
+ <resultMap id="ObjectTypeDto" type="com.ruoyi.basic.dto.ObjectTypeDto">
+ <result property="label" column="object_type"/>
+ <result property="value" column="object_type"/>
+ <collection property="children" resultMap="workShopNameDto"/>
+ </resultMap>
+
+ <resultMap id="workShopNameDto" type="com.ruoyi.basic.dto.WorkShopNameDto">
+ <result property="label" column="workShopName"/>
+ <result property="value" column="workShopName"/>
<collection property="children" resultMap="SampleTypeDto"/>
</resultMap>
@@ -35,6 +47,8 @@
<result property="sort" column="sort"/>
<result property="partNo" column="part_no"/>
<result property="sampleTypeEn" column="sample_type_en"/>
+ <result property="workShopName" column="workShopName"/>
+ <result property="workShopId" column="workShopId"/>
<collection property="children" resultMap="SampleDto"/>
</resultMap>
@@ -90,8 +104,10 @@
</sql>
<select id="selectStandardTreeList" resultMap="FactoryDto">
- select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory,
+ select '涓ぉ绉戞妧' factory,
l.laboratory_name laboratory,
+ sto.object_type object_type,
+ ws.`name` workShopName,
sto.specimen_name sample_type,
p.name sample,
st.model,
@@ -99,12 +115,14 @@
sto.id sample_type_id,
sto.sort,
sto.specimen_name_en sample_type_en,
- p.name_en sample_en
+ p.name_en sample_en,
+ ws.id workShopId
from laboratory l
left join structure_test_object sto on sto.laboratory_id = l.id
left join product p on p.object_id = sto.id
left join standard_tree st on st.sample_type = sto.specimen_name
and st.sample = p.name
+ LEFT JOIN work_shop ws ON ws.id = sto.work_shop_id
order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
</select>
@@ -164,7 +182,7 @@
</if>
</select>
<select id="selectStandardTreeList2" resultType="com.ruoyi.basic.pojo.StandardTree">
- select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory,
+ select '涓ぉ绉戞妧' factory,
l.laboratory_name laboratory,
sto.specimen_name sample_type,
p.name sample
@@ -245,11 +263,15 @@
where name = #{name}
</select>
<select id="selectStandardTreeListByPartNo" resultMap="FactoryDto">
- select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory,
+ select '涓ぉ绉戞妧' factory,
l.laboratory_name laboratory,
+ sto.object_type object_type,
+ ws.`name` workShopName,
sto.specimen_name sample_type,
p.name sample,
- st.model,
+ m.model_name model,
+ ws.`name` workShopName,
+ ws.id workShopId,
CASE
WHEN p.id = (SELECT pp.product_id
FROM product_part pp
@@ -269,6 +291,8 @@
left join product p on p.object_id = sto.id
left join standard_tree st on st.sample_type = sto.specimen_name
and st.sample = p.name
+ LEFT JOIN model m ON m.product_id = p.id
+ LEFT JOIN work_shop ws ON ws.id = sto.work_shop_id
where (p.id = (select pp.product_id
from product_part pp
where pp.part_no = #{partNo})
@@ -322,6 +346,7 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ order by send_time desc
</select>
<select id="selectIfsPage" resultType="com.ruoyi.basic.pojo.IfsInventoryQuantity">
@@ -329,6 +354,7 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ ORDER BY declare_date DESC
</select>
<select id="selectIfsInventoryQuantity" resultType="com.ruoyi.basic.dto.IfsInventoryQuantityCheckDto">
SELECT * from ifs_inventory_quantity ifs
@@ -347,6 +373,7 @@
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
+ order by send_time desc
</select>
<select id="getIfsByOverList" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
select * from (<include refid="getIfsOrder"/>
@@ -378,10 +405,20 @@
select model label,
model value
from standard_tree
- where sample_type in
- <foreach item="item" collection="sampleTypeValues" open="(" separator="," close=")">
- #{item}
- </foreach>
+ where sample is null
+ <if test="sampleTypeValues != null and sampleTypeValues.size() > 0">
+ and sample_type in
+ <foreach item="item" collection="sampleTypeValues" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </if>
+ </select>
+
+ <select id="getStandardTree3" resultType="com.ruoyi.basic.dto.SampleDto">
+ select model label,
+ model value
+ from standard_tree
+ where sample_type = #{sampleType}
and sample is null
</select>
</mapper>
--
Gitblit v1.9.3