package com.ningdatech.carapi.industry.controller;


import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.industry.manage.PurchaseWheelManage;
import com.ningdatech.carapi.industry.model.req.PurchaseOilListReq;
import com.ningdatech.carapi.industry.model.req.PurchaseWheelListReq;
import com.ningdatech.carapi.industry.model.vo.PurchaseOilListVo;
import com.ningdatech.carapi.industry.model.vo.PurchaseWheelListVo;
import com.ningdatech.carapi.industry.service.IPurchaseWheelService;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.validation.Valid;

/**
 * <p>
 * 轮胎采购信息表 前端控制器
 * </p>
 *
 * @author WendyYang
 * @since 2022-11-09
 */
@RestController
@Api(tags = "行业服务-采购服务-轮胎采购信息")
@AllArgsConstructor
@RequestMapping("/api/v1/industry/purchase-wheel")
public class PurchaseWheelController {

    private final IPurchaseWheelService purchaseWheelService;
    private final PurchaseWheelManage purchaseWheelManage;

    @DeleteMapping("/del/{id}")
    @ApiOperation("删除")
    @WebLog(value = "删除")
    public void delete(@PathVariable Long id) {
        purchaseWheelService.removeById(id);
    }

    @GetMapping("/list")
    @ApiOperation("列表")
    public PageVo<PurchaseWheelListVo> list(PurchaseWheelListReq req) {
        return purchaseWheelManage.purchaseWheelList(req);
    }

    @PostMapping("/saveOrUpdate")
    @ApiOperation("保存/修改")
    @WebLog(value = "保存/修改")
    public void saveOrUpdate(@Valid @RequestBody PurchaseWheelListVo req) {
        purchaseWheelManage.saveOrUpdate(req);
    }


}
