<?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.sf.service.gateway.mapper.GatewayInterfaceLinkStrategyMapper">

    <resultMap id="BaseResultMap" type="com.sf.service.gateway.domain.GatewayInterfaceLinkStrategy">
            <id property="interfaceId" column="interface_id" jdbcType="BIGINT"/>
            <id property="strategyId" column="strategy_id" jdbcType="BIGINT"/>
    </resultMap>

    <sql id="Base_Column_List">
        interface_id,strategy_id
    </sql>

    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from Gateway_interface_link_strategy
        where  interface_id = #{interfaceId,jdbcType=BIGINT} AND strategy_id = #{strategyId,jdbcType=BIGINT} 
    </select>
    <select id="selectGatewayInterfaceLinkStrategyByInterfaceIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from Gateway_interface_link_strategy
        where  interface_id in
        <foreach item="id" collection="interfaceIds" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
    <select id="selectGatewayInterfaceLinkStrategyByStrategyIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from Gateway_interface_link_strategy
        where  strategy_id in
        <foreach item="id" collection="strategyIds" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from Gateway_interface_link_strategy
        where  interface_id = #{interfaceId,jdbcType=BIGINT} AND strategy_id = #{strategyId,jdbcType=BIGINT} 
    </delete>

    <delete id="deleteByInterfaceIds">
        delete from Gateway_interface_link_strategy
        where  interface_id in
        <foreach item="id" collection="interfaceIds" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.sf.service.gateway.domain.GatewayInterfaceLinkStrategy" useGeneratedKeys="true">
        insert into Gateway_interface_link_strategy
        ( interface_id,strategy_id)
        values (#{interfaceId,jdbcType=BIGINT},#{strategyId,jdbcType=BIGINT})
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.sf.service.gateway.domain.GatewayInterfaceLinkStrategy" useGeneratedKeys="true">
        insert into Gateway_interface_link_strategy
        <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="interfaceId != null">interfaceId,</if>
                <if test="strategyId != null">strategyId,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                <if test="interfaceId != null">interface_id = #{interfaceId,jdbcType=BIGINT},</if>
                <if test="strategyId != null">strategy_id = #{strategyId,jdbcType=BIGINT},</if>
        </trim>
    </insert>

    <insert id="batchInsertGatewayInterfaceLinkStrategy">
        insert into Gateway_interface_link_strategy (interface_id,strategy_id)
        values
        <foreach collection="linkList" index="" item="link" separator=",">
            (
             #{link.interfaceId,jdbcType=BIGINT},
             #{link.strategyId,jdbcType=BIGINT}
            )
        </foreach>
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.sf.service.gateway.domain.GatewayInterfaceLinkStrategy">
        update Gateway_interface_link_strategy
        <set>
        </set>
        where   interface_id = #{interfaceId,jdbcType=BIGINT} AND strategy_id = #{strategyId,jdbcType=BIGINT} 
    </update>
    <update id="updateByPrimaryKey" parameterType="com.sf.service.gateway.domain.GatewayInterfaceLinkStrategy">
        update Gateway_interface_link_strategy
        set 
        where   interface_id = #{interfaceId,jdbcType=BIGINT} AND strategy_id = #{strategyId,jdbcType=BIGINT} 
    </update>
</mapper>
