liding
2025-05-15 6bd1dc0b355e279b709bc49dda5207121e9b41a9
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -1,44 +1,41 @@
package com.ruoyi.sales.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.service.ISalesLedgerService;
import org.springframework.beans.factory.annotation.Autowired;
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.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.service.ICommonFileService;
import com.ruoyi.sales.service.ISalesLedgerService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * 销售台账Controller
 *
 *
 * @author ruoyi
 * @date 2025-05-08
 */
@RestController
@RequestMapping("/sales/ledger")
public class SalesLedgerController extends BaseController
{
    @Autowired
@AllArgsConstructor
public class SalesLedgerController extends BaseController {
    private ISalesLedgerService salesLedgerService;
    private ICommonFileService commonFileService;
    /**
     * 查询销售台账列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SalesLedgerDto salesLedgerDto)
    {
    public TableDataInfo list(SalesLedgerDto salesLedgerDto) {
        startPage();
        List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto);
        return getDataTable(list);
@@ -48,8 +45,8 @@
     * 查询销售台账和产品父子列表
     */
    @GetMapping("/getSalesLedgerWithProducts")
    public SalesLedgerDto getSalesLedgerWithProducts(SalesLedgerDto salesLedgerDto){
        return  salesLedgerService.getSalesLedgerWithProducts(salesLedgerDto);
    public SalesLedgerDto getSalesLedgerWithProducts(SalesLedgerDto salesLedgerDto) {
        return salesLedgerService.getSalesLedgerWithProducts(salesLedgerDto);
    }
    /**
@@ -57,8 +54,7 @@
     */
    @Log(title = "销售台账", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SalesLedgerDto salesLedgerDto)
    {
    public void export(HttpServletResponse response, SalesLedgerDto salesLedgerDto) {
        List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto);
        ExcelUtil<SalesLedger> util = new ExcelUtil<SalesLedger>(SalesLedger.class);
        util.exportExcel(response, list, "销售台账数据");
@@ -68,9 +64,8 @@
     * 新增修改销售台账
     */
    @Log(title = "销售台账", businessType = BusinessType.INSERT)
    @PostMapping ("/addOrUpdateSalesLedger")
    public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto)
    {
    @PostMapping("/addOrUpdateSalesLedger")
    public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto) {
        return toAjax(salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto));
    }
@@ -78,12 +73,34 @@
     * 删除销售台账
     */
    @Log(title = "销售台账", businessType = BusinessType.DELETE)
   @DeleteMapping("/delLedger")
    public AjaxResult remove(@RequestBody Long[] ids)
    {
    @DeleteMapping("/delLedger")
    public AjaxResult remove(@RequestBody Long[] ids) {
        if (ids == null || ids.length == 0) {
            return AjaxResult.error("请传入要删除的ID");
        }
        return toAjax(salesLedgerService.deleteSalesLedgerByIds(ids));
    }
    /**
     * 查询销售台账不分页
     * @param salesLedgerDto
     * @return
     */
    @GetMapping("/listNoPage")
    public AjaxResult listNoPage(SalesLedgerDto salesLedgerDto){
        List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto);
        return AjaxResult.success(list);
    }
    /**
     * 销售台账附件删除
     */
    @Log(title = "销售台账附件删除", businessType = BusinessType.DELETE)
    @DeleteMapping("/delLedgerFile")
    public AjaxResult delLedgerFile(@RequestBody Long[] ids) {
        if (ids == null || ids.length == 0) {
            return AjaxResult.error("请传入要删除的ID");
        }
        return toAjax(commonFileService.deleteSalesLedgerByIds(ids));
    }
}