<?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.zehong.system.mapper.ConveyorBeltIpMaintainMapper">
    
    <resultMap type="ConveyorBeltIpMaintain" id="ConveyorBeltIpMaintainResult">
        <result property="id"    column="f_id"    />
        <result property="ip"    column="f_ip"    />
        <result property="port"    column="f_port"    />
        <result property="fetchKey"    column="f_fetch_key"    />
        <result property="conveyorDesc"    column="f_conveyor_desc"    />
        <result property="createTime"    column="f_create_time"    />
        <result property="updateTime"    column="f_update_time"    />
    </resultMap>

    <sql id="selectConveyorBeltIpMaintainVo">
        select f_id, f_ip, f_port,f_fetch_key, f_conveyor_desc, f_create_time, f_update_time from t_conveyor_belt_ip_maintain
    </sql>

    <select id="selectConveyorBeltIpMaintainList" parameterType="ConveyorBeltIpMaintain" resultMap="ConveyorBeltIpMaintainResult">
        <include refid="selectConveyorBeltIpMaintainVo"/>
        <where>  
            <if test="ip != null  and ip != ''"> and f_ip = #{ip}</if>
            <if test="port != null  and port != ''"> and f_port = #{port}</if>
            <if test="fetchKey != null  and fetchKey != ''"> and f_fetch_key = #{fetchKey}</if>
            <if test="conveyorDesc != null  and conveyorDesc != ''"> and f_conveyor_desc = #{conveyorDesc}</if>
            <if test="createTime != null "> and f_create_time = #{createTime}</if>
            <if test="updateTime != null "> and f_update_time = #{updateTime}</if>
        </where>
    </select>
    
    <select id="selectConveyorBeltIpMaintainById" parameterType="Integer" resultMap="ConveyorBeltIpMaintainResult">
        <include refid="selectConveyorBeltIpMaintainVo"/>
        where f_id = #{id}
    </select>
    <select id="selectConfig" parameterType="string" resultMap="ConveyorBeltIpMaintainResult">
        <include refid="selectConveyorBeltIpMaintainVo"></include>
        where f_fetch_key = #{fetchKey}
    </select>
        
    <insert id="insertConveyorBeltIpMaintain" parameterType="ConveyorBeltIpMaintain" useGeneratedKeys="true" keyProperty="id">
        insert into t_conveyor_belt_ip_maintain
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ip != null and ip != ''">f_ip,</if>
            <if test="port != null and port != ''">f_port,</if>
            <if test="fetchKey != null and fetchKey != ''">f_fetch_key,</if>
            <if test="conveyorDesc != null">f_conveyor_desc,</if>
            <if test="createTime != null">f_create_time,</if>
            <if test="updateTime != null">f_update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ip != null and ip != ''">#{ip},</if>
            <if test="port != null and port != ''">#{port},</if>
            <if test="fetchKey != null and fetchKey != ''">#{fetchKey},</if>
            <if test="conveyorDesc != null">#{conveyorDesc},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateConveyorBeltIpMaintain" parameterType="ConveyorBeltIpMaintain">
        update t_conveyor_belt_ip_maintain
        <trim prefix="SET" suffixOverrides=",">
            <if test="ip != null and ip != ''">f_ip = #{ip},</if>
            <if test="port != null and port != ''">f_port = #{port},</if>
            <if test="fetchKey != null and fetchKey != ''">f_fetch_key = #{fetchKey},</if>
            <if test="conveyorDesc != null">f_conveyor_desc = #{conveyorDesc},</if>
            <if test="createTime != null">f_create_time = #{createTime},</if>
            <if test="updateTime != null">f_update_time = #{updateTime},</if>
        </trim>
        where f_id = #{id}
    </update>

    <delete id="deleteConveyorBeltIpMaintainById" parameterType="Integer">
        delete from t_conveyor_belt_ip_maintain where f_id = #{id}
    </delete>

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