Merge remote-tracking branch 'origin/master'

dev
Wen JY 1 year ago
commit 931934613a

@ -5,14 +5,16 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* @Description:
* @ClassName: DeviceStatus
* @Author : xins
* @Date :2023-09-05 11:35
* @Author : xins
* @Date :2023-09-05 11:35
* @Version :1.0
*/
public class DeviceStatus extends BaseEntity {
private Long ts;
private Long deviceId;
private String deviceCode;
private int deviceType;
@ -29,6 +31,14 @@ public class DeviceStatus extends BaseEntity {
this.ts = ts;
}
public Long getDeviceId() {
return deviceId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getDeviceCode() {
return deviceCode;
}

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

@ -4,13 +4,13 @@
<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 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
<if test="{params.beginTime}!= null and {params.endTime} != null">
and ts BETWEEN #{params.beginTime} AND #{params.endTime}
</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
</select>

Loading…
Cancel
Save