单体电池-增加簇号
This commit is contained in:
@ -11,7 +11,7 @@ import com.xzzn.common.annotation.Excel;
|
||||
* Modbus设备配置对象 ems_devices_setting
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-06-29
|
||||
* @date 2025-07-01
|
||||
*/
|
||||
public class EmsDevicesSetting extends BaseEntity
|
||||
{
|
||||
@ -86,14 +86,18 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
@Excel(name = "站点id")
|
||||
private String siteId;
|
||||
|
||||
/** 通信状态 */
|
||||
@Excel(name = "通信状态")
|
||||
/** 通信状态:0-正常 1-通信中断 2-异常 */
|
||||
@Excel(name = "通信状态:0-正常 1-通信中断 2-异常")
|
||||
private String communicationStatus;
|
||||
|
||||
/** 设备唯一标识符 */
|
||||
@Excel(name = "设备唯一标识符")
|
||||
private String deviceId;
|
||||
|
||||
/** 上级设备id */
|
||||
@Excel(name = "上级设备id")
|
||||
private String parentId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -284,6 +288,16 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -306,6 +320,7 @@ public class EmsDevicesSetting extends BaseEntity
|
||||
.append("siteId", getSiteId())
|
||||
.append("communicationStatus", getCommunicationStatus())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("parentId", getParentId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ public class BatteryDataStatsListVo {
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
/** 簇号 */
|
||||
private String clusterDeviceId;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
@ -73,4 +76,12 @@ public class BatteryDataStatsListVo {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getClusterDeviceId() {
|
||||
return clusterDeviceId;
|
||||
}
|
||||
|
||||
public void setClusterDeviceId(String clusterDeviceId) {
|
||||
this.clusterDeviceId = clusterDeviceId;
|
||||
}
|
||||
}
|
||||
|
@ -139,17 +139,15 @@
|
||||
t.alarm_start_time as alarmStartTime,t.alarm_end_time as alarmEndTime
|
||||
from ems_alarm_records t
|
||||
where t.site_id = #{siteId}
|
||||
<if test="deviceType != null and deviceType != 0">
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
AND t.device_type = #{deviceType}
|
||||
</if>
|
||||
<if test="alarmLevel != null and alarmLevel != ''">
|
||||
AND t.alarm_level = #{alarmLevel}
|
||||
</if>
|
||||
<if test="alarmStartTime != null and alarmStartTime != ''">
|
||||
AND date_format(t.alarm_start_time,'%Y%m%d') >= date_format(#{alarmStartTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="alarmEndTime != null and alarmEndTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(t.alarm_end_time,'%Y%m%d') <= date_format(#{alarmEndTime},'%Y%m%d')
|
||||
<if test="alarmStartTime != null and alarmStartTime != null and alarmEndTime != null and alarmEndTime != ''">
|
||||
AND (date_format(t.alarm_start_time,'%Y%m%d') BETWEEN date_format(#{alarmStartTime},'%Y%m%d') and date_format(#{alarmEndTime},'%Y%m%d')
|
||||
or date_format(t.alarm_end_time,'%Y%m%d') BETWEEN date_format(#{alarmStartTime},'%Y%m%d') and date_format(#{alarmEndTime},'%Y%m%d') )
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -179,16 +179,18 @@
|
||||
|
||||
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
||||
SELECT t.data_timestamp as updateTime, t.voltage, t.temperature,
|
||||
t.soc, t.soh, t.device_id as deviceId
|
||||
t.soc, t.soh, t.device_id as deviceId,t.cluster_device_id as clusterDeviceId
|
||||
FROM ems_battery_data t
|
||||
JOIN ( SELECT device_id, MAX(data_timestamp) AS max_update_time
|
||||
INNER JOIN ( SELECT device_id, cluster_device_id, MAX(data_timestamp) AS max_update_time
|
||||
FROM ems_battery_data
|
||||
WHERE site_id = #{siteId}
|
||||
and data_timestamp >= CURDATE()
|
||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||
and cluster_device_id = #{clusterDeviceId}
|
||||
</if>
|
||||
GROUP BY device_id
|
||||
GROUP BY device_id, cluster_device_id
|
||||
) latest ON t.device_id = latest.device_id AND t.data_timestamp = latest.max_update_time
|
||||
AND t.cluster_device_id = latest.cluster_device_id
|
||||
WHERE t.site_id = #{siteId}
|
||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||
and t.cluster_device_id = #{clusterDeviceId}
|
||||
|
@ -24,10 +24,11 @@
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="communicationStatus" column="communication_status" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsDevicesSettingVo">
|
||||
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id from ems_devices_setting
|
||||
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id from ems_devices_setting
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
|
||||
@ -51,6 +52,7 @@
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
|
||||
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -80,6 +82,7 @@
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="communicationStatus != null">communication_status,</if>
|
||||
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
@ -100,6 +103,7 @@
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="communicationStatus != null">#{communicationStatus},</if>
|
||||
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -124,6 +128,7 @@
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
|
||||
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -146,9 +151,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getAllClusterInfoByStackId" parameterType="String" resultType="java.util.Map">
|
||||
select device_id as id,device_name as deviceName
|
||||
from ems_devices_setting
|
||||
where device_id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
||||
select distinct t.device_id,t.device_name from ems_devices_setting t where t.parent_id = #{stackDeviceId}
|
||||
</select>
|
||||
|
||||
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">
|
||||
|
Reference in New Issue
Block a user