From b78295e8da96c3e5e76befeef9582ce5273dbb74 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期二, 29 九月 2026 13:10:23 +0800
Subject: [PATCH] 按代码规范检查整改实体注释、Service Javadoc 与分层边界
---
battery-business/src/main/resources/mapper/battery/TDeviceIngestRecordMapper.xml | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/battery-business/src/main/resources/mapper/battery/TDeviceIngestRecordMapper.xml b/battery-business/src/main/resources/mapper/battery/TDeviceIngestRecordMapper.xml
index c7eeca2..b33e572 100644
--- a/battery-business/src/main/resources/mapper/battery/TDeviceIngestRecordMapper.xml
+++ b/battery-business/src/main/resources/mapper/battery/TDeviceIngestRecordMapper.xml
@@ -30,6 +30,12 @@
<result property="receivedAtUtc" column="received_at_utc"/>
</resultMap>
+ <!-- 落地行的显式列名,顺序与建表脚本一致;列集合不随运行期表结构变化。 -->
+ <sql id="ingestColumns">ingest_id, adapter_code, payload_kind, devtype, devid, subdevid, chlid, record_sequence, record_key,
+ source_ref, device_time_utc, device_time_raw, timezone_id, cycle_no, step_no, relative_time_seconds,
+ voltage_v, current_a, charge_capacity_ah, discharge_capacity_ah, charge_energy_wh, discharge_energy_wh,
+ payload_json, content_sha256, received_at_utc</sql>
+
<!-- 驼峰映射未开启(见 mybatis-config.xml),列名带下划线的查询一律显式映射。 -->
<resultMap id="TDeviceIngestChannelResultMap" type="com.battery.business.domain.vo.TDeviceIngestChannel">
<result property="devtype" column="devtype"/>
@@ -91,7 +97,7 @@
</select>
<select id="selectLatestSample" resultMap="TDeviceIngestRecordResultMap">
- select * from t_device_ingest_record
+ select <include refid="ingestColumns"/> from t_device_ingest_record
where adapter_code = #{adapterCode} and payload_kind = 'SAMPLE'
and devtype = #{devtype} and devid = #{devid} and subdevid = #{subdevid} and chlid = #{chlid}
order by device_time_utc desc, record_sequence desc
@@ -100,7 +106,7 @@
<!-- 只取严格晚于水位的行;同秒多行按协议序号各自成立,不按秒合并。 -->
<select id="selectSamplesSince" resultMap="TDeviceIngestRecordResultMap">
- select * from t_device_ingest_record
+ select <include refid="ingestColumns"/> from t_device_ingest_record
where adapter_code = #{adapterCode} and payload_kind = 'SAMPLE'
and devtype = #{devtype} and devid = #{devid} and subdevid = #{subdevid} and chlid = #{chlid}
<if test="watermarkTime != null">
--
Gitblit v1.7.1