package com.tofly.xrtygis.custom.controller;

import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.service.CosTprStationService;
import com.tofly.xrtygis.entity.Costprestation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author 20126
 */
@RestController
@AllArgsConstructor
@RequestMapping("/cosTprStation")
@Api(tags = "实际管理-加压站指标")
public class CosTprStationController {

    private final CosTprStationService cosTprStationService;

    @PostMapping("/insertInfo")
    @ApiOperation("添加加压站信息")
    public ResultRespone insertInfo(@RequestBody Costprestation costprestation){
        return ResultRespone.success(cosTprStationService.insertInfo(costprestation));
    }

    @GetMapping("/viewInfo")
    @ApiOperation("查看加压站信息")
    public ResultRespone viewInfo(Long preId,String month){
        return ResultRespone.success(cosTprStationService.viewInfo(preId,month));
    }

    @PutMapping("/updateInfo")
    @ApiOperation("修改加压站信息")
    public ResultRespone updateInfo(@RequestBody Costprestation costprestation){
        return ResultRespone.success(cosTprStationService.updateInfo(costprestation));
    }

    @DeleteMapping("/deleteInfo")
    @ApiOperation("删除加压站信息")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "id",value = "多个id",readOnly = true,dataType = "string")
    )
    public ResultRespone deleteInfo(String id){
        return ResultRespone.success(cosTprStationService.deleteInfo(id));
    }


    @GetMapping("/getPreName")
    @ApiOperation("查看加压站名称")
    public ResultRespone getPreName(){
        return ResultRespone.success(cosTprStationService.getPreName());
    }

    @ApiOperation("获取测站最大/最小/平均值")
    @GetMapping("/getPreValue")
    public ResultRespone getPreValue(String month,Long preId){
        return ResultRespone.success(cosTprStationService.getPreValue(month,preId));
    }
}
