<?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.zongzhi.mapper.TcNetworkPingtaiMapper">
    
    <resultMap type="TcNetworkPingtai" id="TcNetworkPingtaiResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="type"    column="type"    />
        <result property="name"    column="name"    />
        <result property="props"    column="props"    />
        <result property="fansNum"    column="fans_num"    />
        <result property="dns"    column="dns"    />
        <result property="ipAddress"    column="ip_address"    />
        <result property="licenceNum"    column="licence_num"    />
        <result property="authentication"    column="authentication"    />
        <result property="area"    column="area"    />
        <result property="intro"    column="intro"    />
        <result property="createId"    column="create_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateId"    column="update_id"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTcNetworkPingtaiVo">
        select id, area_id, type, name, props, fans_num, dns, ip_address, licence_num, authentication, area, intro, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_network_pingtai
    </sql>

    <select id="selectTcNetworkPingtaiList" parameterType="TcNetworkPingtai" resultMap="TcNetworkPingtaiResult">
        <include refid="selectTcNetworkPingtaiVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="props != null "> and props = #{props}</if>
            <if test="fansNum != null "> and fans_num = #{fansNum}</if>
            <if test="dns != null  and dns != ''"> and dns = #{dns}</if>
            <if test="ipAddress != null  and ipAddress != ''"> and ip_address = #{ipAddress}</if>
            <if test="licenceNum != null  and licenceNum != ''"> and licence_num = #{licenceNum}</if>
            <if test="authentication != null  and authentication != ''"> and authentication = #{authentication}</if>
            <if test="area != null  and area != ''"> and area = #{area}</if>
            <if test="intro != null  and intro != ''"> and intro = #{intro}</if>
            <if test="createId != null "> and create_id = #{createId}</if>
            <if test="updateId != null "> and update_id = #{updateId}</if>
        </where>
    </select>
    
    <select id="selectTcNetworkPingtaiById" parameterType="Long" resultMap="TcNetworkPingtaiResult">
        <include refid="selectTcNetworkPingtaiVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcNetworkPingtai" parameterType="TcNetworkPingtai" useGeneratedKeys="true" keyProperty="id">
        insert into tc_network_pingtai
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="type != null">type,</if>
            <if test="name != null">name,</if>
            <if test="props != null">props,</if>
            <if test="fansNum != null">fans_num,</if>
            <if test="dns != null">dns,</if>
            <if test="ipAddress != null">ip_address,</if>
            <if test="licenceNum != null">licence_num,</if>
            <if test="authentication != null">authentication,</if>
            <if test="area != null">area,</if>
            <if test="intro != null">intro,</if>
            <if test="createId != null">create_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateId != null">update_id,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="areaId != null">#{areaId},</if>
            <if test="type != null">#{type},</if>
            <if test="name != null">#{name},</if>
            <if test="props != null">#{props},</if>
            <if test="fansNum != null">#{fansNum},</if>
            <if test="dns != null">#{dns},</if>
            <if test="ipAddress != null">#{ipAddress},</if>
            <if test="licenceNum != null">#{licenceNum},</if>
            <if test="authentication != null">#{authentication},</if>
            <if test="area != null">#{area},</if>
            <if test="intro != null">#{intro},</if>
            <if test="createId != null">#{createId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateId != null">#{updateId},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTcNetworkPingtai" parameterType="TcNetworkPingtai">
        update tc_network_pingtai
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="type != null">type = #{type},</if>
            <if test="name != null">name = #{name},</if>
            <if test="props != null">props = #{props},</if>
            <if test="fansNum != null">fans_num = #{fansNum},</if>
            <if test="dns != null">dns = #{dns},</if>
            <if test="ipAddress != null">ip_address = #{ipAddress},</if>
            <if test="licenceNum != null">licence_num = #{licenceNum},</if>
            <if test="authentication != null">authentication = #{authentication},</if>
            <if test="area != null">area = #{area},</if>
            <if test="intro != null">intro = #{intro},</if>
            <if test="createId != null">create_id = #{createId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateId != null">update_id = #{updateId},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcNetworkPingtaiById" parameterType="Long">
        delete from tc_network_pingtai where id = #{id}
    </delete>

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