1
zhang
5 天以前 e5e76412f1a20e8aed95614cbd7bf2b638cda2cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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<DeviceMessage> deviceMessages = influxDBService.queryPoints("select * from device order by time desc limit 10", DeviceMessage.class);
        return R.ok(deviceMessages);
    }
 
 
}