From 1e10fd13f47b8b40e4f4c28aed59b248780231e5 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Fri, 6 Feb 2026 15:56:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/mybatis/index/IndexHomeMapper.xml | 32 ++++++++++--------- resources/mybatis/index/IndexHomeMapper.xml | 32 ++++++++++--------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/build/classes/mybatis/index/IndexHomeMapper.xml b/build/classes/mybatis/index/IndexHomeMapper.xml index 2fe94b1..37dcdc6 100644 --- a/build/classes/mybatis/index/IndexHomeMapper.xml +++ b/build/classes/mybatis/index/IndexHomeMapper.xml @@ -224,21 +224,23 @@ ) AS t UNION - SELECT - 0 as storageNum, - 0 as checkNum, - 0 as useNum, - COUNT(DISTINCT id) as changeNum - FROM - ( - SELECT - mc.id, - to_days(now()) -to_days(mc.time) as days - FROM - ma_total_change mc - ) rs - WHERE rs.days < 30 - ) res + SELECT + 0 as storageNum, + 0 as checkNum, + 0 as useNum, + COUNT(DISTINCT mt.ID) as changeNum + FROM ma_total_change t1 + LEFT JOIN mm_type mt ON mt.ID = t1.type_id + LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID + WHERE + DATEDIFF(NOW(), t1.time) < 30 + AND NOT EXISTS ( + SELECT 1 + FROM ma_total_change t2 + WHERE + t2.type_id = t1.type_id + AND t2.time > t1.time + )) AS stats