package com.om.controller.admin;


import com.om.entity.dto.*;
import com.om.entity.vo.*;
import com.om.service.IBrushFileService;
import com.om.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bmmx
 * @since 2024-03-21
 */
@RestController
@Api(tags = "ECU刷写文件管理")
@RequestMapping("web/brush")
public class BrushFileController {


    @Resource
    private IBrushFileService brushFileService;

    @PostMapping("getPageList")
    @ApiOperation("分页查询ECU刷写文件列表")
    public Result<BlushQueryPageVO> getPageList(@RequestBody BlushQueryPageDTO dto){
        return brushFileService.getPageList(dto);
    }

    @PostMapping("create")
    @ApiOperation("新增ECU刷写文件")
    public Result createBrush(@RequestBody BrushAddDTO dto){
        return brushFileService.createBrush(dto);
    }

    @PostMapping("upload")
    @ApiOperation("上传ECU刷写文件")
    public Result<BrushUploadVO> uploadBrush(MultipartFile file){
        return brushFileService.uploadBrush(file);
    }

    @GetMapping("delete")
    @ApiOperation("根据id删除ECU刷写文件")
    public Result deleteBrush(@RequestParam Integer id){
        return brushFileService.deleteBrush(id);
    }

    @GetMapping("updateStatus")
    @ApiOperation("修改ECU刷写文件状态")
    public Result updateStatus(@RequestParam("id") Integer id,@RequestParam("status") Integer status){
        return brushFileService.updateStatus(id,status);
    }

    @PostMapping("push")
    @ApiOperation("推送ECU刷写文件")
    public Result pushBrush(@RequestParam("id") Integer id){
        return brushFileService.pushBrush(id);
    }




}
