若依微服务1.1.2版本:

1、tdengine服务设备状态信息tags增加deviceId
dev 1.1.2
xins 1 year ago
parent 1d41a016b3
commit 90e2eaed96

@ -13,6 +13,8 @@ public class DeviceStatus extends BaseEntity {
private Long ts; private Long ts;
private Long deviceId;
private String deviceCode; private String deviceCode;
private int deviceType; private int deviceType;
@ -29,6 +31,14 @@ public class DeviceStatus extends BaseEntity {
this.ts = ts; this.ts = ts;
} }
public Long getDeviceId() {
return deviceId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() { public String getDeviceCode() {
return deviceCode; return deviceCode;
} }

@ -386,10 +386,6 @@ public class TdEngineController {
List<DeviceStatus> deviceStatuses = this.deviceStatusService.getOnlineDevicesGroupByDay(queryDeviceStatus); List<DeviceStatus> deviceStatuses = this.deviceStatusService.getOnlineDevicesGroupByDay(queryDeviceStatus);
Map<Long, List<DeviceStatus>> deviceStatusMap = deviceStatuses.stream() Map<Long, List<DeviceStatus>> deviceStatusMap = deviceStatuses.stream()
.collect(Collectors.groupingBy(DeviceStatus::getTs)); .collect(Collectors.groupingBy(DeviceStatus::getTs));
deviceStatusMap.forEach((k,v)->{
System.out.println(k+"----"+v);
});
return R.ok(deviceStatusMap); return R.ok(deviceStatusMap);
} catch (UncategorizedSQLException e) { } catch (UncategorizedSQLException e) {
String message = e.getCause().getMessage(); String message = e.getCause().getMessage();

@ -4,13 +4,13 @@
<mapper namespace="com.ruoyi.tdengine.mapper.DeviceStatusMapper"> <mapper namespace="com.ruoyi.tdengine.mapper.DeviceStatusMapper">
<select id="getOnlineDevicesGroupByDay" parameterType="com.ruoyi.tdengine.api.domain.DeviceStatus" resultType="com.ruoyi.tdengine.api.domain.DeviceStatus" > <select id="getOnlineDevicesGroupByDay" parameterType="com.ruoyi.tdengine.api.domain.DeviceStatus" resultType="com.ruoyi.tdengine.api.domain.DeviceStatus" >
select timetruncate(ts,1d) ts,devicetype,onlinestatus,devicecode from #{params.databaseName}.#{params.superTableName} select timetruncate(ts,1d) ts,devicetype,onlinestatus,deviceid from #{params.databaseName}.#{params.superTableName}
where onlinestatus=1 where onlinestatus=1
<if test="{params.beginTime}!= null and {params.endTime} != null"> <if test="{params.beginTime}!= null and {params.endTime} != null">
and ts BETWEEN #{params.beginTime} AND #{params.endTime} and ts BETWEEN #{params.beginTime} AND #{params.endTime}
</if> </if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if> <if test="sceneId != null "> and scene_id = #{sceneId}</if>
group by timetruncate(ts,1d),devicetype,onlinestatus,devicecode group by timetruncate(ts,1d),devicetype,onlinestatus,deviceid
order by ts order by ts
</select> </select>

Loading…
Cancel
Save