<?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.project.zcustom.mapper.basics.PlatBasicsMapper">
    
    <resultMap type="PlatBasics" id="PlatBasicsResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="appOrg"    column="app_org"    />
        <result property="registerNum"    column="register_num"    />
        <result property="onlineNum"    column="online_num"    />
        <result property="orderNum"    column="order_num"    />
        <result property="onlineRate"    column="online_rate"    />
        <result property="cpuOverloadNum"    column="cpu_overload_num"    />
        <result property="diskOverloadNum"    column="disk_overload_num"    />
        <result property="memoryOverloadNum"    column="memory_overload_num"    />
        <result property="insufficientNum"    column="insufficient_num"    />
    </resultMap>

    <sql id="selectPlatBasicsVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, register_num, online_num, order_num, online_rate, cpu_overload_num, disk_overload_num, memory_overload_num, insufficient_num from large_plat_basics
    </sql>

    <select id="selectPlatBasicsList" parameterType="PlatBasics" resultMap="PlatBasicsResult">
        <include refid="selectPlatBasicsVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="registerNum != null "> and register_num = #{registerNum}</if>
            <if test="onlineNum != null "> and online_num = #{onlineNum}</if>
            <if test="orderNum != null "> and order_num = #{orderNum}</if>
            <if test="onlineRate != null "> and online_rate = #{onlineRate}</if>
            <if test="cpuOverloadNum != null "> and cpu_overload_num = #{cpuOverloadNum}</if>
            <if test="diskOverloadNum != null "> and disk_overload_num = #{diskOverloadNum}</if>
            <if test="memoryOverloadNum != null "> and memory_overload_num = #{memoryOverloadNum}</if>
            <if test="insufficientNum != null "> and insufficient_num = #{insufficientNum}</if>
        </where>
    </select>
    
    <select id="selectPlatBasicsById" parameterType="Long" resultMap="PlatBasicsResult">
        <include refid="selectPlatBasicsVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatBasics" parameterType="PlatBasics" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_basics
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="appOrg != null">app_org,</if>
            <if test="registerNum != null">register_num,</if>
            <if test="onlineNum != null">online_num,</if>
            <if test="orderNum != null">order_num,</if>
            <if test="onlineRate != null">online_rate,</if>
            <if test="cpuOverloadNum != null">cpu_overload_num,</if>
            <if test="diskOverloadNum != null">disk_overload_num,</if>
            <if test="memoryOverloadNum != null">memory_overload_num,</if>
            <if test="insufficientNum != null">insufficient_num,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="appOrg != null">#{appOrg},</if>
            <if test="registerNum != null">#{registerNum},</if>
            <if test="onlineNum != null">#{onlineNum},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="onlineRate != null">#{onlineRate},</if>
            <if test="cpuOverloadNum != null">#{cpuOverloadNum},</if>
            <if test="diskOverloadNum != null">#{diskOverloadNum},</if>
            <if test="memoryOverloadNum != null">#{memoryOverloadNum},</if>
            <if test="insufficientNum != null">#{insufficientNum},</if>
         </trim>
    </insert>

    <update id="updatePlatBasics" parameterType="PlatBasics">
        update large_plat_basics
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="appOrg != null">app_org = #{appOrg},</if>
            <if test="registerNum != null">register_num = #{registerNum},</if>
            <if test="onlineNum != null">online_num = #{onlineNum},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="onlineRate != null">online_rate = #{onlineRate},</if>
            <if test="cpuOverloadNum != null">cpu_overload_num = #{cpuOverloadNum},</if>
            <if test="diskOverloadNum != null">disk_overload_num = #{diskOverloadNum},</if>
            <if test="memoryOverloadNum != null">memory_overload_num = #{memoryOverloadNum},</if>
            <if test="insufficientNum != null">insufficient_num = #{insufficientNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatBasicsById" parameterType="Long">
        delete from large_plat_basics where id = #{id}
    </delete>

    <delete id="deletePlatBasicsByIds" parameterType="String">
        delete from large_plat_basics where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="reallyDeleteByWrapper">
        DELETE FROM large_plat_basics ${ew.customSqlSegment}
    </delete>
</mapper>