whycrzg
2021-04-23 37b0a788be60ad59dfaa141e67303a69986018c7
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
package com.whyc.app.controller;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.OilComm;
import com.whyc.app.service.OilCommService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
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;
 
/**
 * Oil通讯
 */
@RequestMapping("phone/OilComm")
@RestController("APP-OilCommController")
@Api(tags = "试验台润滑冷却系统-油站")
@Slf4j
public class OilCommController {
 
    @Qualifier("SER-OilCommService")
    @Autowired
    private OilCommService service;
 
    @GetMapping("all")
    @ApiOperation(value = "获取所有oil信息")
    public Response<List<OilComm>> getAll(){
        return service.getAll();
    }
 
    @GetMapping("infoByDevId")
    @ApiOperation(value = "根据设备id获取oil信息")
    public Response<OilComm> getInfoByDevId(@RequestParam int devId){
        return service.getInfoByDevId(devId);
    }
 
    /**
     * ======History======
     * 历史查询时,因为历史记录是按照日期分表的,如果查询所有的日期表(union)后再分页,会导致速度极慢,故查询按照单个日期查询
     * TODO 待确定是否需要加上日期
     * */
    @GetMapping("history/all")
    @ApiOperation(value = "查询历史记录")
    public Response<PageInfo<OilComm>> getHistory(@RequestParam int pageNum, int pageSize, int devId){
        return service.getHistory(pageNum,pageSize,devId);
    }
 
}