package com.backendsys.service.Ai.Aiivh;

import com.backendsys.entity.Ai.Aiivh.AiivhQuotaHistoryDTO;
import com.backendsys.mapper.Ai.Aiivh.AiivhQuotaHistoryMapper;
import com.backendsys.utils.response.PageInfoResult;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AiivhQuotaHistoryServiceImpl implements AiivhQuotaHistoryService {

    @Autowired
    private AiivhQuotaHistoryMapper aiivhQuotaHistoryMapper;

    @Override
    public Map<String, Object> getQuotaHistoryList(Integer pageNum, Integer pageSize, AiivhQuotaHistoryDTO aiivhQuotaHistoryDTO) {
        // 分页查询
        if (pageNum != null && pageSize != null) {
            PageHelper.startPage(pageNum, pageSize);
            PageHelper.getLocalPage().setPageSizeZero(true);
        }
        // 分页输出 (自定义)
        List<Map<String, Object>> list = aiivhQuotaHistoryMapper.queryAiivhQuotaHistoryList(aiivhQuotaHistoryDTO);
        PageInfoResult pageInfoResult = new PageInfoResult(list);
        return pageInfoResult.toMap();
    }

}
