package com.njcn.product.event.transientes.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.product.event.transientes.pojo.param.PqUserLedgerParam;
import com.njcn.product.event.transientes.pojo.po.PqUserLedgerPO;
import com.njcn.product.event.transientes.service.PqUserLedgerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: cdf
 * @CreateTime: 2025-07-28
 * @Description:
 */
@RestController
@RequestMapping("/pqUser/ledger")
public class PqUserLedgerController {

    @Autowired
    private PqUserLedgerService pqUserLedgerService;



    // 添加记录
    @PostMapping("addLedger")
    public boolean addLedger(@RequestBody PqUserLedgerParam ledgerParam) {
        return pqUserLedgerService.addLedger(ledgerParam);
    }

    // 更新记录
    @PostMapping("updateLedger")
    public boolean updateLedger(@RequestBody PqUserLedgerParam ledgerParam) {
        return pqUserLedgerService.updateLedger(ledgerParam);
    }

    // 删除记录
    @PostMapping("deleteLedger")
    public boolean deleteLedger(@RequestBody List<String> ids) {
        return pqUserLedgerService.deleteLedger(ids);
    }

    // 查询单条记录
    @GetMapping("/getLedgerById")
    public PqUserLedgerPO getLedgerById(@PathVariable String id) {
        return pqUserLedgerService.getLedgerById(id);
    }

    // 查询所有记录
    @GetMapping
    public Page<PqUserLedgerPO> pageList(@RequestBody PqUserLedgerParam ledgerParam) {
        return pqUserLedgerService.pageList(ledgerParam);
    }
}
