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.AGC_AVCInfo;
import com.jiayue.ipfcst.console.service.AGC_AVCInfoService;
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("agcAvcInfo")
@Slf4j
public class AGC_AVCInfoController {
  final AGC_AVCInfoService agcAvcInfoService;

  @Autowired
  public AGC_AVCInfoController(AGC_AVCInfoService agcAvcInfoService) {
    this.agcAvcInfoService = agcAvcInfoService;
  }

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

  /*
  * 保存
  * */
  @PostMapping
  public ResponseVO save(@RequestBody AGC_AVCInfo agc_avcInfo){
    agcAvcInfoService.save(agc_avcInfo);
    return ResponseVO.success(1);
  }

  /*
  * 更新
  * */
  @PutMapping
  public ResponseVO update(@RequestBody AGC_AVCInfo agc_avcInfo){
    agcAvcInfoService.save(agc_avcInfo);
    return ResponseVO.success(1);
  }

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