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

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.knowledgedocuments.KnowledgeDocumentsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.llm.controller.admin.knowledgedocuments.vo.*;

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

    default PageResult<KnowledgeDocumentsDO> selectPage(KnowledgeDocumentsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KnowledgeDocumentsDO>()
                .eqIfPresent(KnowledgeDocumentsDO::getKnowledgeBaseId, reqVO.getKnowledgeBaseId())
                .likeIfPresent(KnowledgeDocumentsDO::getDocumentName, reqVO.getDocumentName())
                .eqIfPresent(KnowledgeDocumentsDO::getFileUrl, reqVO.getFileUrl())
                .betweenIfPresent(KnowledgeDocumentsDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(KnowledgeDocumentsDO::getStatus, reqVO.getStatus())
                .orderByDesc(KnowledgeDocumentsDO::getId));
    }

}