liding
8 天以前 0050395dfb05425f0a929bc1587b971d78f1e95e
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
@@ -1,36 +1,35 @@
package com.ruoyi.purchase.controller;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.purchase.service.IPurchaseLedgerService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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 com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.purchase.service.IPurchaseLedgerService;
import com.ruoyi.sales.service.ISalesLedgerService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
 * 采购台账Controller
 *
 *
 * @author ruoyi
 * @date 2025-05-09
 */
@RestController
@RequestMapping("/system/ledger")
@RequestMapping("/purchase/ledger")
@AllArgsConstructor
public class PurchaseLedgerController extends BaseController {
    private IPurchaseLedgerService purchaseLedgerService;
    private ISalesLedgerService salesLedgerService;
    /**
     * 查询采购台账列表
@@ -57,17 +56,65 @@
     * 新增修改采购台账
     */
    @Log(title = "采购台账", businessType = BusinessType.INSERT)
    @PostMapping ("/addOrEditPurchase")
    public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger) {
        return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedger));
    @PostMapping("/addOrEditPurchase")
    public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws IOException {
        return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto));
    }
    /**
     * 查询采购台账和产品父子列表
     */
    @GetMapping("/getPurchaseById")
    public PurchaseLedgerDto getPurchaseById(PurchaseLedgerDto purchaseLedgerDto) {
        return purchaseLedgerService.getPurchaseById(purchaseLedgerDto);
    }
    /**
     * 删除采购台账
     */
    @Log(title = "采购台账", businessType = BusinessType.DELETE)
   @DeleteMapping("/delPurchase")
    @DeleteMapping("/delPurchase")
    public AjaxResult remove(@RequestBody Long[] ids) {
        return toAjax(purchaseLedgerService.deletePurchaseLedgerByIds(ids));
    }
    /**
     * 查询销售合同号
     */
    @GetMapping("/getSalesNo")
    public List getSalesNo() {
        return salesLedgerService.getSalesNo();
    }
    /**
     * 查询采购合同号
     */
    @GetMapping("/getPurchaseNo")
    public List getPurchasesNo() {
        return purchaseLedgerService.getPurchasesNo();
    }
    /**
     * 根据id查询采购合同号
     */
    @GetMapping("/getPurchaseNoById")
    public AjaxResult getPurchaseNoById(Long id) {
        return AjaxResult.success(purchaseLedgerService.getPurchaseNoById(id));
    }
    /**
     * 根据采购合同号查询产品
     */
    @GetMapping("/getProduct")
    public List getProduct(PurchaseLedgerDto purchaseLedgerDto) {
        return purchaseLedgerService.getProduct(purchaseLedgerDto);
    }
    /**
     * 根据采购合同号查询产品
     */
    @GetMapping("/getInfo")
    public AjaxResult getInfo(PurchaseLedgerDto purchaseLedgerDto) {
        return AjaxResult.success(purchaseLedgerService.getInfo(purchaseLedgerDto));
    }
}