From feb347e6c4f94fa7becf9072a685d3ce0c3464fd Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期日, 11 十月 2026 11:08:24 +0800
Subject: [PATCH] 天津-奇缘恒艺 录数据需求更改

---
 src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml |   70 ++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index 7de15bd..7c31196 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -4,64 +4,66 @@
 
     <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger">
         SELECT
-        id,
-        user_id,
-        user_name,
-        code,
-        name,
-        model,
-        most_date,
-        valid,
-        next_date,
-        record_date,
+        t.id,
+        t.user_id,
+        <!-- user_name 瀛樼殑鏄櫥褰曡处鍙凤紝杩欓噷鏀瑰彇鐢ㄦ埛鏄电О锛涘彇涓嶅埌鏃跺洖閫�涓哄師鍊� -->
+        IFNULL(su.nick_name, t.user_name) AS user_name,
+        t.code,
+        t.name,
+        t.model,
+        t.most_date,
+        t.valid,
+        t.next_date,
+        t.record_date,
         CASE
-        WHEN most_date IS NOT NULL
-        AND valid IS NOT NULL
-        AND DATE_ADD(most_date, INTERVAL valid DAY) &gt;= CURDATE() THEN 1
+        WHEN t.most_date IS NOT NULL
+        AND t.valid IS NOT NULL
+        AND DATE_ADD(t.most_date, INTERVAL t.valid DAY) &gt;= CURDATE() THEN 1
         ELSE 2
         END AS status,
-        create_user,
-        create_time,
-        update_user,
-        update_time,
-        tenant_id,
-        unit,
-        dept_id,
-        instation_location,
-        cycle
+        t.create_user,
+        t.create_time,
+        t.update_user,
+        t.update_time,
+        t.tenant_id,
+        t.unit,
+        t.dept_id,
+        t.instation_location,
+        t.cycle
         FROM
-        measuring_instrument_ledger
+        measuring_instrument_ledger t
+        LEFT JOIN sys_user su ON t.user_id = su.user_id
         <where>
             <!-- 鏌ヨ鏉′欢鍚屼笂 -->
             <if test="req.code != null and req.code != ''">
-                AND code LIKE CONCAT('%', #{req.code}, '%')
+                AND t.code LIKE CONCAT('%', #{req.code}, '%')
             </if>
             <if test="req.name != null and req.name != ''">
-                AND name LIKE CONCAT('%', #{req.name}, '%')
+                AND t.name LIKE CONCAT('%', #{req.name}, '%')
             </if>
             <if test="req.status != null">
                 <choose>
                     <when test="req.status == 1">
-                        AND most_date IS NOT NULL
-                        AND valid IS NOT NULL
-                        AND DATE_ADD(most_date, INTERVAL valid DAY) &gt;= CURDATE()
+                        AND t.most_date IS NOT NULL
+                        AND t.valid IS NOT NULL
+                        AND DATE_ADD(t.most_date, INTERVAL t.valid DAY) &gt;= CURDATE()
                     </when>
                     <when test="req.status == 2">
                         AND (
-                        most_date IS NULL
-                        OR valid IS NULL
-                        OR DATE_ADD(most_date, INTERVAL valid DAY) &lt; CURDATE()
+                        t.most_date IS NULL
+                        OR t.valid IS NULL
+                        OR DATE_ADD(t.most_date, INTERVAL t.valid DAY) &lt; CURDATE()
                         )
                     </when>
                 </choose>
             </if>
             <if test="req.tenantId != null">
-                AND tenant_id = #{req.tenantId}
+                AND t.tenant_id = #{req.tenantId}
             </if>
             <if test="req.recordDate != null">
-                AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
+                AND t.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
             </if>
         </where>
-        ORDER BY create_time DESC
+        ORDER BY t.create_time DESC
     </select>
 </mapper>

--
Gitblit v1.9.3