<?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.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper">

    <resultMap type="FastgptChatVoiceHomo" id="FastgptChatVoiceHomoResult">
        <result property="id"    column="id"    />
        <result property="content"    column="content"    />
        <result property="changeCount"    column="change_count"    />
        <result property="companyId"    column="company_id"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectFastgptChatVoiceHomoVo">
        select id, content, change_count, company_id, create_time from fastgpt_chat_voice_homo
    </sql>

    <select id="selectFastgptChatVoiceHomoList" parameterType="FastgptChatVoiceHomo" resultMap="FastgptChatVoiceHomoResult">
        <include refid="selectFastgptChatVoiceHomoVo"/>
        <where>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="changeCount != null  and changeCount != ''"> and change_count = #{changeCount}</if>
            <if test="companyId != null "> and company_id = #{companyId}</if>
        </where>
    </select>

    <select id="selectFastgptChatVoiceHomoById" parameterType="Long" resultMap="FastgptChatVoiceHomoResult">
        <include refid="selectFastgptChatVoiceHomoVo"/>
        where id = #{id}
    </select>

    <insert id="insertFastgptChatVoiceHomo" parameterType="FastgptChatVoiceHomo">
        insert into fastgpt_chat_voice_homo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="content != null">content,</if>
            <if test="changeCount != null">change_count,</if>
            <if test="companyId != null">company_id,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="content != null">#{content},</if>
            <if test="changeCount != null">#{changeCount},</if>
            <if test="companyId != null">#{companyId},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateFastgptChatVoiceHomo" parameterType="FastgptChatVoiceHomo">
        update fastgpt_chat_voice_homo
        <trim prefix="SET" suffixOverrides=",">
            <if test="content != null">content = #{content},</if>
            <if test="changeCount != null">change_count = #{changeCount},</if>
            <if test="companyId != null">company_id = #{companyId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFastgptChatVoiceHomoById" parameterType="Long">
        delete from fastgpt_chat_voice_homo where id = #{id}
    </delete>

    <delete id="deleteFastgptChatVoiceHomoByIds" parameterType="String">
        delete from fastgpt_chat_voice_homo where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
