whycxzp
2021-05-17 0acc33a0bd5316a1413b4d4bc7ae5dd93022f386
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.whyc.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.AFEInverterState;
import com.whyc.service.AFEInverterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.objects.annotations.Getter;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
import java.util.Map;
 
/**
 * 特别注意:
 * 通讯协议中:
 * 有功功率单位为0.1kW
 * 输出电流单位为0.1A
 *
 * web页面端:
 * 有功功率单位为kW
 * 输出电流单位为A
 *
 * 故:
 * 查询时,需要将这两个字段结果,*0.1
 * TODO
 */
@RestController
@RequestMapping("afeInverter")
@Api(tags = "afe变频器-逆变器的数据信息")
public class AFEInverterController {
 
    @Autowired
    AFEInverterService service;
 
    @GetMapping("all")
    @ApiOperation(value="查询所有")
    public Response getAll(@RequestParam int pageNum,int pageSize){
        return service.getAll(pageNum,pageSize);
    }
 
    @GetMapping("infoByDeviceId")
    @ApiOperation(value = "查询单个:根据设备id")
    public Response<AFEInverterState> getInfoByDeviceId(@RequestParam int devId){
        return service.getInfoByDeviceId(devId);
    }
 
    @GetMapping("field")
    @ApiOperation(value = "查询告警阈值字段")
    public Response<Map<String, List>> getField(){
        return service.getField();
    }
 
    @GetMapping("tableNames")
    @ApiOperation(value = "查询历史记录存在的表")
    public Response<String> getTableNames(){
        return service.getTableNames();
    }
 
    /**
     * ======History======
     * 历史查询时,因为历史记录是按照日期分表的,如果查询所有的日期表(union)后再分页,会导致速度极慢,故查询按照单个日期查询
     * TODO 待确定是否需要加上日期
     * */
    @GetMapping("history/all")
    @ApiOperation(value = "查询历史记录")
    public Response<PageInfo<AFEInverterState>> getHistory(@RequestParam int pageNum, int pageSize,int devId){
        return service.getHistory(pageNum,pageSize,devId);
    }
 
}