<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.pjilisense.flxai.dao.KnowledgeBasesDao">

    <resultMap type="com.pjilisense.flxai.entity.KnowledgeBasesEntity" id="knowledgeBasesMap">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="description" column="description"/>
        <result property="avatar" column="avatar"/>
        <result property="type" column="type"/>
        <result property="userId" column="user_id"/>
        <result property="isPublic" column="is_public"/>
        <result property="settings" column="settings"  typeHandler="com.pjilisense.flxai.handle.JsonbTypeHandler"/>
        <result property="createdAt" column="created_at" jdbcType="TIMESTAMP_WITH_TIMEZONE" javaType="java.time.OffsetDateTime"/>
        <result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP_WITH_TIMEZONE" javaType="java.time.OffsetDateTime"/>
        <result property="accessedAt" column="accessed_at" jdbcType="TIMESTAMP_WITH_TIMEZONE" javaType="java.time.OffsetDateTime"/>
    </resultMap>

    <update id="modifyDescriptuon" parameterType="java.util.Map">
        UPDATE knowledge_bases SET description = #{description,jdbcType=VARCHAR},updated_at = now() WHERE id = #{id}
    </update>

</mapper>