TakaiKnowledgeMapper.xml 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.TakaiKnowledgeMapper">
  6. <resultMap type="com.takai.ai.domain.entity.TakaiKnowledge" id="BmKnowledgeResult">
  7. <id property="knowledgeId" column="knowledge_id" />
  8. <result property="embeddingId" column="embedding_id" />
  9. <result property="name" column="name" />
  10. <result property="description" column="description" />
  11. <result property="background" column="background" />
  12. <result property="icon" column="icon" />
  13. <result property="wordNum" column="word_num" />
  14. <result property="length" column="length" />
  15. <result property="documentSize" column="document_size" />
  16. <result property="remark" column="remark" />
  17. <result property="createBy" column="create_by" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateTime" column="update_time" />
  21. </resultMap>
  22. <sql id="selectSql">
  23. select knowledge_id, embedding_id, name, description, background, icon, word_num, length,document_size, create_by, create_time,update_time, remark
  24. from bm_knowledge
  25. </sql>
  26. <select id="selectKnowledgeList" parameterType="TakaiKnowledge" resultMap="BmKnowledgeResult">
  27. <include refid="selectSql"/>
  28. <where>
  29. <if test="knowledgeId != null and knowledgeId != ''">
  30. AND knowledge_id = #{knowledgeId}
  31. </if>
  32. </where>
  33. order by create_time asc
  34. </select>
  35. <select id="selectTargetKnowledge" parameterType="TakaiKnowledge" resultMap="BmKnowledgeResult">
  36. <include refid="selectSql"/>
  37. where knowledge_id = #{knowledgeId}
  38. </select>
  39. <insert id="insertKnowledge" parameterType="TakaiKnowledge">
  40. insert into bm_knowledge(
  41. <if test="knowledgeId != null and knowledgeId != ''">knowledge_id,</if>
  42. <if test="embeddingId != null and embeddingId != ''">embedding_id,</if>
  43. <if test="name != null and name != ''">name,</if>
  44. <if test="description != null and description != ''">description,</if>
  45. <if test="background != null and background != ''">background,</if>
  46. <if test="icon != null and icon != ''">icon,</if>
  47. <if test="wordNum != null">word_num,</if>
  48. <if test="length != null">length,</if>
  49. <if test="documentSize != null">document_size,</if>
  50. <if test="remark != null and remark != ''">remark,</if>
  51. <if test="createBy != null and createBy != ''">create_by,</if>
  52. create_time
  53. )values(
  54. <if test="knowledgeId != null and knowledgeId != ''">#{knowledgeId},</if>
  55. <if test="embeddingId != null and embeddingId != ''">#{embeddingId},</if>
  56. <if test="name != null and name != ''">#{name},</if>
  57. <if test="description != null and description != ''">#{description},</if>
  58. <if test="background != null and background != ''">#{background},</if>
  59. <if test="icon != null and icon != ''">#{icon},</if>
  60. <if test="wordNum != null">#{wordNum},</if>
  61. <if test="length != null">#{length},</if>
  62. <if test="documentSize != null">#{documentSize},</if>
  63. <if test="remark != null and remark != ''">#{remark},</if>
  64. <if test="createBy != null and createBy != ''">#{createBy},</if>
  65. sysdate()
  66. )
  67. </insert>
  68. <update id="updateKnowledge" parameterType="BmKnowledge">
  69. update bm_knowledge
  70. <set>
  71. <if test="knowledgeId != null and knowledgeId != ''">knowledge_id = #{knowledgeId},</if>
  72. <if test="embeddingId != null">embedding_id = #{embeddingId},</if>
  73. <if test="name != null and name != ''">name = #{name},</if>
  74. <if test="description != null and description != ''">description = #{description},</if>
  75. <if test="background != null and background != ''">background = #{background},</if>
  76. <if test="icon != null and icon != ''">icon = #{icon},</if>
  77. <if test="wordNum != null">word_num = #{wordNum},</if>
  78. <if test="length != null">length = #{length},</if>
  79. <if test="documentSize != null">document_size = #{documentSize},</if>
  80. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  81. <if test="remark != null">remark = #{remark},</if>
  82. update_time = sysdate()
  83. </set>
  84. where knowledge_id = #{knowledgeId}
  85. </update>
  86. <delete id="delKnowledge" parameterType="String">
  87. delete from bm_knowledge where knowledge_id = #{knowledgeId}
  88. </delete>
  89. </mapper>