<?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.ruoyi.aicall.mapper.CcLlmAgentProviderMapper">
    
    <resultMap type="CcLlmAgentProvider" id="CcLlmAgentProviderResult">
        <result property="id"    column="id"    />
        <result property="providerClassName"    column="provider_class_name"    />
        <result property="note"    column="note"    />
    </resultMap>

    <sql id="selectCcLlmAgentProviderVo">
        select id, provider_class_name, note from cc_llm_agent_provider
    </sql>

    <select id="selectCcLlmAgentProviderList" parameterType="CcLlmAgentProvider" resultMap="CcLlmAgentProviderResult">
        <include refid="selectCcLlmAgentProviderVo"/>
        <where>  
            <if test="providerClassName != null  and providerClassName != ''"> and provider_class_name like concat('%', #{providerClassName}, '%')</if>
            <if test="note != null  and note != ''"> and note = #{note}</if>
        </where>
    </select>
    
    <select id="selectCcLlmAgentProviderById" parameterType="Integer" resultMap="CcLlmAgentProviderResult">
        <include refid="selectCcLlmAgentProviderVo"/>
        where id = #{id}
    </select>

    <insert id="insertCcLlmAgentProvider" parameterType="CcLlmAgentProvider" useGeneratedKeys="true" keyProperty="id">
        insert into cc_llm_agent_provider
        <trim prefix="(" suffix=")" suffixOverrides=",">
            provider_class_name,
            note,
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{providerClassName},
            #{note},
        </trim>
    </insert>

    <update id="updateCcLlmAgentProvider" parameterType="CcLlmAgentProvider">
        update cc_llm_agent_provider
        <trim prefix="SET" suffixOverrides=",">
            provider_class_name = #{providerClassName},
            note = #{note},
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCcLlmAgentProviderById" parameterType="Integer">
        delete from cc_llm_agent_provider where id = #{id}
    </delete>

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

</mapper>