whycxzp
2021-07-26 dfd0dddb3864888a19a93be1100b38f8449abeef
src/main/java/com/whyc/controller/WaterCommController.java
@@ -1,6 +1,8 @@
package com.whyc.controller;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.OilComm;
import com.whyc.pojo.WaterComm;
import com.whyc.service.WaterCommService;
import io.swagger.annotations.Api;
@@ -8,19 +10,17 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Water通讯
 */
@RequestMapping("WaterComm")
@RestController
@Api(tags = "Water通讯")
@Api(tags = "试验台润滑冷却系统-水站")
@Slf4j
public class WaterCommController {
@@ -38,6 +38,27 @@
    public Response<WaterComm> getInfoByDevId(@RequestParam int devId){
        return service.getInfoByDevId(devId);
    }
    @GetMapping("field")
    @ApiOperation(value = "查询告警阈值字段")
    public Response<Map<String, List>> getField(){
        return service.getField();
    }
    @PutMapping("updateStatus")
    @ApiOperation(value = "更新状态-演示使用")
    public Response updateStatus(@RequestParam int devId,@RequestParam int waterState){
        return service.updateStatus(devId,waterState);
    }
    /**
     * ======History======
     * 历史查询时,因为历史记录是按照日期分表的,如果查询所有的日期表(union)后再分页,会导致速度极慢,故查询按照单个日期查询
     * TODO 待确定是否需要加上日期
     * */
    @GetMapping("history/all")
    @ApiOperation(value = "查询历史记录")
    public Response<PageInfo<WaterComm>> getHistory(@RequestParam int pageNum, int pageSize, int devId){
        return service.getHistory(pageNum,pageSize,devId);
    }
}