<?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.business.mapper.TEbsApiMapper">
    
    <resultMap type="TEbsApi" id="TEbsApiResult">
        <result property="url"    column="url"    />
        <result property="apiname"    column="apiName"    />
    </resultMap>

    <sql id="selectTEbsApiVo">
        select url, apiName from t_ebs_api
    </sql>

    <select id="selectTEbsApiList" parameterType="TEbsApi" resultMap="TEbsApiResult">
        <include refid="selectTEbsApiVo"/>
        <where>  
            <if test="url != null  and url != ''"> and url = #{url}</if>
            <if test="apiname != null  and apiname != ''"> and apiName like concat('%', #{apiname}, '%')</if>
        </where>
    </select>
    
    <select id="selectTEbsApiByUrl" parameterType="String" resultMap="TEbsApiResult">
        <include refid="selectTEbsApiVo"/>
        where url = #{url}
    </select>
        
    <insert id="insertTEbsApi" parameterType="TEbsApi">
        insert into t_ebs_api
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="url != null">url,</if>
            <if test="apiname != null">apiName,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="url != null">#{url},</if>
            <if test="apiname != null">#{apiname},</if>
         </trim>
    </insert>

    <update id="updateTEbsApi" parameterType="TEbsApi">
        update t_ebs_api
        <trim prefix="SET" suffixOverrides=",">
            <if test="apiname != null">apiName = #{apiname},</if>
        </trim>
        where url = #{url}
    </update>

    <delete id="deleteTEbsApiByUrl" parameterType="String">
        delete from t_ebs_api where url = #{url}
    </delete>

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

</mapper>