package org.jk.rag.mapper;


import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jk.rag.domain.entity.SliceInfo;
import org.jk.rag.domain.entity.JkSliceInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface JkSliceInfoMapper {

    List<JkSliceInfo> selectByDocumentId(@Param("documentId") String documentId,@Param("sliceText") String sliceText);

    List<JkSliceInfo> selectOldSliceByDocumentId(@Param("documentId") String documentId,@Param("sliceText") String sliceText);
    Page<JkSliceInfo> selectPageByDocumentId(@Param("documentId") String documentId, @Param("sliceText") String sliceText,@Param("page")Page page);


    JkSliceInfo selectBySliceId(@Param("sliceId") String sliceId);

    @InterceptorIgnore(tenantLine = "true", dataPermission = "false")
    List<SliceInfo> slicePageInfoList(List<String> list);

    @Select("<script>" +
        " delete from slice_info where document_id = #{docId}  " +
        "</script>")
    void delByDocId(@Param("docId") String docId);

    @Update("<script>" +
        " update slice_info set slice_index = #{sliceIndex},del_flag = 0 where slice_id = #{sliceId}  " +
        "</script>")
    void updateSliceIndex(@Param("sliceIndex") Integer sliceIndex,@Param("sliceId") String sliceId);

}
