TakaiSliceInfoMapper.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.takai.ai.mapper.TakaiSliceInfoMapper">
  6. <resultMap type="com.takai.ai.domain.entity.TakaiSliceInfo" id="SliceInfoResult" >
  7. <id property="sliceId" column="slice_id"/>
  8. <result property="knowledgeId" column="knowledge_id"/>
  9. <result property="documentId" column="document_id"/>
  10. <result property="sliceIndex" column="slice_index"/>
  11. <result property="sliceType" column="slice_type"/>
  12. <result property="sliceText" column="slice_text"/>
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. </resultMap>
  18. <resultMap type="com.takai.ai.domain.entity.SliceInfo" id="SliceInfoScoreResult" >
  19. <id property="sliceId" column="slice_id"/>
  20. <result property="knowledgeId" column="knowledge_id"/>
  21. <result property="documentId" column="document_id"/>
  22. <result property="sliceIndex" column="slice_index"/>
  23. <result property="sliceType" column="slice_type"/>
  24. <result property="sliceText" column="slice_text"/>
  25. <result property="createBy" column="create_by" />
  26. <result property="createTime" column="create_time" />
  27. <result property="updateBy" column="update_by" />
  28. <result property="updateTime" column="update_time" />
  29. </resultMap>
  30. <sql id="Base_Column">
  31. slice_id, knowledge_id, document_id, slice_index, slice_type, slice_text, create_by, create_time, update_by, update_time
  32. </sql>
  33. <select id="selectByDocumentId" resultMap="SliceInfoResult">
  34. select
  35. <include refid="Base_Column"/>
  36. from slice_info
  37. where document_id = #{documentId}
  38. <if test="sliceText != null and sliceText != ''">
  39. AND slice_text LIKE CONCAT('%', #{sliceText}, '%')
  40. </if>
  41. order by slice_index asc
  42. </select>
  43. <select id="selectBySliceId" resultMap="SliceInfoResult">
  44. select
  45. <include refid="Base_Column"/>
  46. from slice_info
  47. where slice_id = #{sliceId}
  48. </select>
  49. <select id="slicePageInfoList" resultMap="SliceInfoScoreResult">
  50. select
  51. <include refid="Base_Column"/>
  52. from slice_info
  53. where slice_id in
  54. <foreach collection="list" item="sliceId" open="(" separator="," close=")">
  55. #{sliceId}
  56. </foreach>
  57. </select>
  58. </mapper>