package com.zy.acs.hex.controller; import com.zy.acs.common.domain.mq.DeviceMessage; import com.zy.acs.framework.common.R; import com.zy.component.influxdb.service.InfluxDBService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @Slf4j @RequestMapping(value = "/deviceLog") public class DeviceLogController { @Autowired private InfluxDBService influxDBService; /** * 查询最新的十条数据 * * @return */ @GetMapping(value = "/query") @ResponseBody public R query() { List deviceMessages = influxDBService.queryPoints("select * from device order by time desc limit 10", DeviceMessage.class); return R.ok(deviceMessages); } }