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

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.controller.admin.dataset.vo.DatasetAnswerPageReqVO;
import cn.iocoder.yudao.module.llm.dal.dataobject.dataset.DatasetAnswerDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 数据集数据问题标注内容 Mapper
 *
 * @author 华大大模型
 */
@Mapper
public interface DatasetAnswerMapper extends BaseMapperX<DatasetAnswerDO> {

    default PageResult<DatasetAnswerDO> selectPage(DatasetAnswerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DatasetAnswerDO>()
                .eqIfPresent(DatasetAnswerDO::getDatasetId, reqVO.getDatasetId())
                .eqIfPresent(DatasetAnswerDO::getDatasetFilesId, reqVO.getDatasetFilesId())
                .eqIfPresent(DatasetAnswerDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(DatasetAnswerDO::getAnswer, reqVO.getAnswer())
                .betweenIfPresent(DatasetAnswerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DatasetAnswerDO::getId));
    }
    @Delete("delete from llm_dataset_answer where dataset_id = #{datasetPostId}")
    void deleteTrue(@Param("datasetPostId") Long datasetPostId);
}