From 79cb8d1b9b5feff0ec47f4ab2ee1765dd1f220fd Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 May 2026 15:10:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96RFID=E7=9B=B8?= =?UTF-8?q?=E5=85=B3Mapper=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91=E4=B8=8E?= =?UTF-8?q?=E5=85=B3=E8=81=94=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 移除RfidLocationMapper.xml冗余的末尾空格 2. 新增设备统计和看板统计的聚合查询方法 3. 补全读取记录的设备编码字段与位置关联查询 4. 优化多表联合查询的字段映射逻辑 --- .../mapper/rfid/RfidDeviceMapper.xml | 19 ++++++ .../mapper/rfid/RfidLocationMapper.xml | 2 +- .../mapper/rfid/RfidReadRecordMapper.xml | 59 +++++++++++++++---- 3 files changed, 66 insertions(+), 14 deletions(-) diff --git a/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidDeviceMapper.xml b/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidDeviceMapper.xml index 421b16a..5c2e8f9 100644 --- a/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidDeviceMapper.xml +++ b/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidDeviceMapper.xml @@ -88,6 +88,25 @@ + + + + + + - select t.id, t.location_code, t.location_alias, t.location_type, t.parent_id, t.is_marked, t.remark, t.created_by, t.created_at, t.updated_by, t.updated_at + select t.id, t.location_code, t.location_alias, t.location_type, t.parent_id, t.is_marked, t.remark, t.created_by, t.created_at, t.updated_by, t.updated_at from rfid_location t ${ew.customSqlSegment} diff --git a/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidReadRecordMapper.xml b/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidReadRecordMapper.xml index fc91473..6de8efd 100644 --- a/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidReadRecordMapper.xml +++ b/ruoyi-modules/hw-rfid/src/main/resources/mapper/rfid/RfidReadRecordMapper.xml @@ -11,8 +11,9 @@ select combined.id, combined.device_id, - d.device_code as deviceCode, + combined.device_code as deviceCode, d.device_name as deviceName, + l.location_alias as locationAlias, combined.read_status, TRIM(combined.barcode) as barcode, combined.record_time, @@ -46,6 +49,7 @@ select t.id, t.device_id, + t.device_code, t.read_status, TRIM(t.barcode) as barcode, t.record_time, @@ -60,6 +64,7 @@ ) combined left join rfid_device d on combined.device_id = d.id + left join rfid_location l on d.location_id = l.id order by combined.record_time desc @@ -67,8 +72,9 @@ @@ -85,8 +92,9 @@ select t.id, t.device_id, - d.device_code as deviceCode, + t.device_code as deviceCode, d.device_name as deviceName, + l.location_alias as locationAlias, t.read_status, TRIM(t.barcode) as barcode, t.record_time, @@ -139,6 +149,7 @@ t.alarm_action from ${tableName} t left join rfid_device d on t.device_id = d.id + left join rfid_location l on d.location_id = l.id ${ew.customSqlSegment} @@ -150,8 +161,9 @@ @@ -185,6 +199,7 @@ insert into ${tableName}( id, device_id, + device_code, read_status, barcode, record_time, @@ -196,6 +211,7 @@ values ( #{entity.id}, #{entity.deviceId}, + #{entity.deviceCode}, #{entity.readStatus}, #{entity.barcode}, #{entity.recordTime}, @@ -211,6 +227,7 @@ insert into ${tableName}( id, device_id, + device_code, read_status, barcode, record_time, @@ -224,6 +241,7 @@ ( #{item.id}, #{item.deviceId}, + #{item.deviceCode}, #{item.readStatus}, #{item.barcode}, #{item.recordTime}, @@ -242,6 +260,9 @@ device_id = #{entity.deviceId}, + + device_code = #{entity.deviceCode}, + read_status = #{entity.readStatus}, @@ -275,6 +296,9 @@ device_id = #{item.deviceId}, + + device_code = #{item.deviceCode}, + read_status = #{item.readStatus}, @@ -352,8 +376,9 @@ @@ -383,8 +409,9 @@ @@ -450,7 +478,7 @@ select t1.id, t1.device_id, - d.device_code as deviceCode, + t1.device_code as deviceCode, d.device_name as deviceName, + l.location_alias as locationAlias, t1.read_status, TRIM(t1.barcode) as barcode, t1.record_time, @@ -487,6 +516,7 @@ t1.alarm_action from ${tableName} t1 left join rfid_device d on t1.device_id = d.id + left join rfid_location l on d.location_id = l.id inner join ( select @@ -507,8 +537,9 @@