package com.cool.store.service.tp.impl;

import com.cool.store.dao.tp.TpScoreJournalDAO;
import com.cool.store.entity.tp.TpScoreJournalDO;
import com.cool.store.request.tp.TpScoreJournalQueryRequest;
import com.cool.store.service.tp.TpScoreJournalService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.vo.tp.TpScoreJournalVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 十二分制-积分流水 服务实现类
 * </p>
 *
 * @author wangff
 * @since 2025/11/10
 */
@Service
@RequiredArgsConstructor
public class TpScoreJournalServiceImpl implements TpScoreJournalService {
    private final TpScoreJournalDAO tpScoreJournalDAO;

    @Override
    public PageInfo<TpScoreJournalVO> getPage(TpScoreJournalQueryRequest request) {
        PageHelper.startPage(request.getPageNum(), request.getPageSize());
        List<TpScoreJournalDO> list = tpScoreJournalDAO.getList(request);
        PageInfo<TpScoreJournalDO> page = new PageInfo<>(list);
        return BeanUtil.toPage(page, TpScoreJournalVO.class);
    }

    @Override
    public Long count(TpScoreJournalQueryRequest request) {
        return tpScoreJournalDAO.count(request);
    }
}
