<?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.qw.mapper.QwIpadServerMapper">

    <resultMap type="QwIpadServer" id="QwIpadServerResult">
        <result property="id"    column="id"    />
        <result property="title"    column="title"    />
        <result property="addressId"    column="address_id"    />
        <result property="ip"    column="ip"    />
        <result property="port"    column="port"    />
        <result property="url"    column="url"    />
        <result property="totalCount"    column="total_count"    />
        <result property="count"    column="count"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectQwIpadServerVo">
        select id, title, address_id, ip, port, url, total_count, count, create_time, update_time from qw_ipad_server
    </sql>

    <select id="selectQwIpadServerList" parameterType="QwIpadServer" resultMap="QwIpadServerResult">
        <include refid="selectQwIpadServerVo"/>
        <where>
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="addressId != null  and addressId != ''"> and address_id = #{addressId}</if>
            <if test="ip != null  and ip != ''"> and ip = #{ip}</if>
            <if test="port != null  and port != ''"> and port = #{port}</if>
            <if test="url != null  and url != ''"> and url = #{url}</if>
            <if test="totalCount != null "> and total_count = #{totalCount}</if>
            <if test="count != null "> and count = #{count}</if>
        </where>
    </select>

    <select id="selectQwIpadServerById" parameterType="Long" resultMap="QwIpadServerResult">
        <include refid="selectQwIpadServerVo"/>
        where id = #{id}
    </select>

    <insert id="insertQwIpadServer" parameterType="QwIpadServer">
        insert into qw_ipad_server
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="title != null">title,</if>
            <if test="addressId != null">address_id,</if>
            <if test="ip != null">ip,</if>
            <if test="port != null">port,</if>
            <if test="url != null">url,</if>
            <if test="totalCount != null">total_count,</if>
            <if test="count != null">count,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="title != null">#{title},</if>
            <if test="addressId != null">#{addressId},</if>
            <if test="ip != null">#{ip},</if>
            <if test="port != null">#{port},</if>
            <if test="url != null">#{url},</if>
            <if test="totalCount != null">#{totalCount},</if>
            <if test="count != null">#{count},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateQwIpadServer" parameterType="QwIpadServer">
        update qw_ipad_server
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null">title = #{title},</if>
            <if test="addressId != null">address_id = #{addressId},</if>
            <if test="ip != null">ip = #{ip},</if>
            <if test="port != null">port = #{port},</if>
            <if test="url != null">url = #{url},</if>
            <if test="totalCount != null">total_count = #{totalCount},</if>
            <if test="count != null">count = #{count},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteQwIpadServerById" parameterType="Long">
        delete from qw_ipad_server where id = #{id}
    </delete>

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