package org.jk.rag.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jk.common.mybatis.core.mapper.BaseMapperPlus;
import org.jk.rag.domain.Dataset;
import org.jk.rag.domain.SliceInfoHistory;
import org.jk.rag.domain.entity.SliceInfo;
import org.jk.rag.domain.vo.*;

import java.util.List;

/**
 *  数据层
 *
 * @author jk
 */
public interface JkDatasetMapper extends BaseMapperPlus<Dataset, DatasetVo> {

    @Select("<script>" +
        "select " +
        " d.id," +
        " d.name," +
        " d.description," +
        " d.oss_id ossId," +
        " d.url," +
        " d.update_by updateBy," +
        " d.create_time createTime," +
        " d.update_time updateTime," +
        " d.create_by createBy," +
        " su.nick_name nickName" +
        " from dataset d " +
        " left join sys_user su on d.create_by = su.user_id " +
        "  where 1 = 1 " +
        " <if test='name != null and name != \"\"'> " +
        " AND d.name like concat('%',#{name},'%') " +
        " </if>" +
        " <if test='createBy != null and createBy != \"\"'> " +
        " AND d.create_by = #{createBy} " +
        " </if>" +
        " order by d.create_time desc " +
        "</script>")
    Page<DatasetVo> selectPageList(@Param("name") String name,@Param("createBy") String createBy, @Param("page") Page page);


}
