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