liyong
6 天以前 9a30a3a8d3862a9b2ce898535b7cb51c3ddac816
src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
@@ -1,31 +1,47 @@
package com.ruoyi.sales.controller;
import com.ruoyi.framework.web.domain.AjaxResult;
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 org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/sales/quotation")
public class SalesQuotationController {
    @Autowired
    private SalesQuotationService salesQuotationService;
@AllArgsConstructor
public class SalesQuotationController extends BaseController {
    private final SalesQuotationService salesQuotationService;
    @GetMapping("/list")
    public AjaxResult getList(Page page, SalesQuotationDto salesQuotationDto) {
        return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto));
    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<SalesQuotationDto> listPage = salesQuotationService.listPage(page, afterSalesService);
        ExcelUtil<SalesQuotationDto> util = new ExcelUtil<SalesQuotationDto>(SalesQuotationDto.class);
        util.exportExcel(response, listPage.getRecords() , "销售报价");
    }
    @PostMapping("/add")
    public AjaxResult add(@RequestBody SalesQuotationDto salesQuotationDto) {
        return AjaxResult.success(salesQuotationService.add(salesQuotationDto));
    public R<?> add(@RequestBody SalesQuotationDto salesQuotationDto) {
        return R.ok(salesQuotationService.add(salesQuotationDto));
    }
    @PostMapping("/update")
    public AjaxResult update(@RequestBody SalesQuotationDto salesQuotationDto) {
        return AjaxResult.success(salesQuotationService.edit(salesQuotationDto));
    public R<?> update(@RequestBody SalesQuotationDto salesQuotationDto) {
        return R.ok(salesQuotationService.edit(salesQuotationDto));
    }
    @DeleteMapping("/delete")
    public AjaxResult delete(@RequestBody Long id) {
        return AjaxResult.success(salesQuotationService.delete(id));
    public R<?> delete(@RequestBody Long id) {
        return R.ok(salesQuotationService.delete(id));
    }
}