package cn.iocoder.yudao.module.llm.dal.mysql.knowledgedocumentschunks;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.llm.dal.dataobject.knowledgedocumentschunks.KnowledgeDocumentsChunksDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.llm.controller.admin.knowledgedocumentschunks.vo.*;

/**
 * 知识库文档块 Mapper
 *
 * @author 华大大模型
 */
@Mapper
public interface KnowledgeDocumentsChunksMapper extends BaseMapperX<KnowledgeDocumentsChunksDO> {

    default PageResult<KnowledgeDocumentsChunksDO> selectPage(KnowledgeDocumentsChunksPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KnowledgeDocumentsChunksDO>()
                .eqIfPresent(KnowledgeDocumentsChunksDO::getKnowledgeBaseId, reqVO.getKnowledgeBaseId())
                .eqIfPresent(KnowledgeDocumentsChunksDO::getDocumentId, reqVO.getDocumentId())
                .eqIfPresent(KnowledgeDocumentsChunksDO::getChunkId, reqVO.getChunkId())
                .betweenIfPresent(KnowledgeDocumentsChunksDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(KnowledgeDocumentsChunksDO::getVector, reqVO.getVector())
                .eqIfPresent(KnowledgeDocumentsChunksDO::getContent, reqVO.getContent())
                .orderByDesc(KnowledgeDocumentsChunksDO::getId));
    }

}