package com.ruoyi.sales.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.R; import com.ruoyi.sales.dto.SalesQuotationDto; import com.ruoyi.sales.service.SalesQuotationService; import jakarta.servlet.http.HttpServletResponse; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/sales/quotation") @AllArgsConstructor public class SalesQuotationController extends BaseController { private final SalesQuotationService salesQuotationService; @GetMapping("/list") public R getList(Page page, SalesQuotationDto salesQuotationDto) { return R.ok(salesQuotationService.listPage(page, salesQuotationDto)); } @PostMapping("/export") public void export(HttpServletResponse response) { Page page = new Page(-1,-1); SalesQuotationDto afterSalesService = new SalesQuotationDto(); IPage listPage = salesQuotationService.listPage(page, afterSalesService); ExcelUtil util = new ExcelUtil(SalesQuotationDto.class); util.exportExcel(response, listPage.getRecords() , "销售报价"); } @PostMapping("/add") public R add(@RequestBody SalesQuotationDto salesQuotationDto) { return R.ok(salesQuotationService.add(salesQuotationDto)); } @PostMapping("/update") public R update(@RequestBody SalesQuotationDto salesQuotationDto) { return R.ok(salesQuotationService.edit(salesQuotationDto)); } @DeleteMapping("/delete") public R delete(@RequestBody Long id) { return R.ok(salesQuotationService.delete(id)); } }