package com.jwipc.finance.logic.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.finance.entity.AccountStatementApprove;
import com.jwipc.finance.entity.CostAccountStatementApprove;
import com.jwipc.finance.logic.CostAccountStatementApproveLogic;
import com.jwipc.finance.model.query.AsApproveQuery;
import com.jwipc.finance.service.ICostAccountStatementApproveService;
import com.jwipc.page.PageUtil;
import com.jwipc.page.PageView;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shenyang.ou
 * @date 2025/11/4 15:04
 * @desc
 */
@Service
@RequiredArgsConstructor
public class CostAccountStatementApproveLogicImpl implements CostAccountStatementApproveLogic {
    private final ICostAccountStatementApproveService costAccountStatementApproveService;
    @Override
    public PageView findByPage(AsApproveQuery query) {
        final Page<CostAccountStatementApprove> dbPage = PageUtil.toPage(query);
        List<CostAccountStatementApprove> accountStatementApproves = costAccountStatementApproveService.findPageByQuery(dbPage, query);
        return PageUtil.getPV(accountStatementApproves, dbPage.getTotal());
    }
}
