From 7aad06fedc12f0183734088fa44c929ac6ff42b3 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 10 十月 2026 11:54:01 +0800
Subject: [PATCH] feat: 增加多个查询的排序功能以优化数据检索
---
src/main/resources/mapper/production/ProductionProductOutputMapper.xml | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
index 48c8c9e..931154f 100644
--- a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
@@ -10,6 +10,7 @@
<result property="tenantId" column="tenant_id"/>
<result property="createTime" column="create_time"/>
</resultMap>
+
<select id="listPageProductionProductOutputDto" resultType="com.ruoyi.production.dto.ProductionProductOutputDto">
select ppo.*,
pm.model as model,
@@ -23,6 +24,38 @@
and ppm.id = #{c.productMainId}
</if>
</where>
- order by ppo.id
+ order by ppo.id DESC
+ </select>
+
+ <delete id="deleteByProductMainIds" parameterType="java.util.List">
+ DELETE FROM production_product_output
+ WHERE product_main_id IN
+ <foreach collection="productMainIds" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <select id="selectOutputStats" resultType="com.ruoyi.production.dto.ProductionProductOutputDto">
+ SELECT
+ create_time,
+ quantity,
+ scrap_qty
+ FROM
+ production_product_output
+ WHERE
+ create_time >= #{startDate}
+ AND create_time <= #{endDate}
+ </select>
+
+ <select id="selectDailyOutputStats" resultType="java.util.Map">
+ SELECT
+ DATE_FORMAT(create_time, '%Y-%m-%d') as date,
+ SUM(quantity-scrap_qty) as quantity
+ FROM
+ production_product_output
+ WHERE
+ create_time >= #{startDate}
+ AND create_time <= #{endDate}
+ GROUP BY
+ DATE_FORMAT(create_time, '%Y-%m-%d')
</select>
</mapper>
--
Gitblit v1.9.3