chenrui
昨天 ab01a0f611c0adb97662bc8f548ca4a911ec8045
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package com.ruoyi.purchase.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.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("/purchase/ledger")
@AllArgsConstructor
public class PurchaseLedgerController extends BaseController {
    private IPurchaseLedgerService purchaseLedgerService;
 
    private ISalesLedgerService salesLedgerService;
 
    /**
     * 查询采购台账列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PurchaseLedger purchaseLedger) {
        startPage();
        List<PurchaseLedger> list = purchaseLedgerService.selectPurchaseLedgerList(purchaseLedger);
        return getDataTable(list);
    }
 
    /**
     * 导出采购台账列表
     */
    @Log(title = "采购台账", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PurchaseLedger purchaseLedger) {
        List<PurchaseLedger> list = purchaseLedgerService.selectPurchaseLedgerList(purchaseLedger);
        ExcelUtil<PurchaseLedger> util = new ExcelUtil<PurchaseLedger>(PurchaseLedger.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }
 
    /**
     * 新增修改采购台账
     */
    @Log(title = "采购台账", businessType = BusinessType.INSERT)
    @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")
    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));
    }
 
    /**
     * 查询采购台账列表
     */
    @GetMapping("/listPage")
    public IPage<PurchaseLedger> listPage(Page page, PurchaseLedger purchaseLedger) {
         return purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger);
    }
}