package com.jiayue.ipfcst.console.controller;

import com.jiayue.ipfcst.common.core.exception.BusinessException;
import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
import com.jiayue.ipfcst.common.data.entity.BoosterStationInfo;
import com.jiayue.ipfcst.console.service.BoosterStationInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * AGC_AVC信息接口
 *
 * @author zy
 * @version 3.0
 */
@RestController
@RequestMapping("boosterStationInfo")
@Slf4j
public class BoosterStationInfoController {
  final BoosterStationInfoService boosterStationInfoService;
  @Autowired

  public BoosterStationInfoController(BoosterStationInfoService boosterStationInfoService) {
    this.boosterStationInfoService = boosterStationInfoService;
  }

  /*
  * 查询
  * */
  @GetMapping
  public ResponseVO getAll(){
    return ResponseVO.success(boosterStationInfoService.getAll());
  }

  /*
  * 保存
  * */
  @PostMapping
  public ResponseVO save(@RequestBody BoosterStationInfo boosterStationInfo){
    boosterStationInfoService.save(boosterStationInfo);
    return ResponseVO.success(1);
  }

  /*
  * 更新
  * */
  @PutMapping
  public ResponseVO update(@RequestBody BoosterStationInfo boosterStationInfo){
    boosterStationInfoService.save(boosterStationInfo);
    return ResponseVO.success(1);
  }

  /*
  * 删除
  * */
  @DeleteMapping("/{id}")
  public ResponseVO delete(@PathVariable String id) throws BusinessException {
    boosterStationInfoService.delete(Integer.parseInt(id));
    return ResponseVO.success(1);
  }
}
