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 java.util.List; /** * 采购台账Controller * * @author ruoyi * @date 2025-05-09 */ @RestController @RequestMapping("/system/ledger") @AllArgsConstructor public class PurchaseLedgerController extends BaseController { private IPurchaseLedgerService purchaseLedgerService; /** * 查询采购台账列表 */ @GetMapping("/list") public TableDataInfo list(PurchaseLedger purchaseLedger) { startPage(); List list = purchaseLedgerService.selectPurchaseLedgerList(purchaseLedger); return getDataTable(list); } /** * 导出采购台账列表 */ @Log(title = "采购台账", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, PurchaseLedger purchaseLedger) { List list = purchaseLedgerService.selectPurchaseLedgerList(purchaseLedger); ExcelUtil util = new ExcelUtil(PurchaseLedger.class); util.exportExcel(response, list, "【请填写功能名称】数据"); } /** * 新增修改采购台账 */ @Log(title = "采购台账", businessType = BusinessType.INSERT) @PostMapping ("/addOrEditPurchase") public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger) { return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedger)); } /** * 删除采购台账 */ @Log(title = "采购台账", businessType = BusinessType.DELETE) @DeleteMapping("/delPurchase") public AjaxResult remove(@RequestBody Long[] ids) { return toAjax(purchaseLedgerService.deletePurchaseLedgerByIds(ids)); } }