package com.ruoyi.aftersalesservice.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.aftersalesservice.pojo.AfterSalesServiceFile;
import com.ruoyi.aftersalesservice.service.AfterSalesServiceFileService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
*
* 售后服务附件表控制层
*
*
* @author deslrey
* @version 1.0
* @since 2026/03/02 11:20
*/
@RestController
@Api(tags = "售后服务附件表")
@RequestMapping("/afterSalesService/file")
public class AfterSalesServiceFileController extends BaseController {
@Autowired
private AfterSalesServiceFileService afterSalesServiceFileService;
@PostMapping("/upload")
@ApiOperation("售后服务-文件上传")
@Log(title = "售后服务-文件上传", businessType = BusinessType.INSERT)
public AjaxResult fileUpload(@RequestParam("file") MultipartFile file,
@RequestParam("id") Long afterSalesServiceId) {
afterSalesServiceFileService.fileUpload(file, afterSalesServiceId);
return AjaxResult.success("上传成功");
}
@GetMapping("/listPage")
@ApiOperation("售后处理-售后附件列表")
@Log(title = "售后处理-售后附件列表", businessType = BusinessType.OTHER)
public AjaxResult fileList(Page page, Long afterSalesServiceId) {
return AjaxResult.success(afterSalesServiceFileService.fileList(page, afterSalesServiceId));
}
@DeleteMapping("/del/{fileId}")
@ApiOperation("售后处理-删除附件")
@Log(title = "售后处理-删除附件", businessType = BusinessType.DELETE)
public AjaxResult delFile(@PathVariable Long fileId) {
afterSalesServiceFileService.delFile(fileId);
return AjaxResult.success("删除成功!");
}
}