package cn.axzo.msg.center.utils;

import cn.axzo.msg.center.MsgCenterApplication;
import cn.axzo.msg.center.dal.CardDao;
import cn.axzo.msg.center.domain.entity.Card;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @author yanglin
 */
@SpringBootTest(classes = MsgCenterApplication.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
class RecordCursorTest {

    private final CardDao cardDao;

    @Test
    void exec() {
        RecordCursor<Card> cursor = new RecordCursor<>(19, Card::getId, () -> cardDao.lambdaQuery()
                .eq(Card::getTemplateCode, "9f7e48f7c4dc44289bc8e590a0eb47ca"));
        for (List<Card> cards : cursor) {
            System.out.println("--------------> " + cards.size());
        }
    }

}