<?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.xunmei.core.access.mapper.CoreMonitoringTaskMonitorInfoMapper">

    <resultMap type="com.xunmei.core.access.domain.CoreMonitoringTaskMonitorInfo" id="CoreMonitoringTaskMonitorInfoResult">
                <result property="id" column="id"/>
                <result property="taskMonitorId" column="task_monitor_id"/>
                <result property="project" column="project"/>
                <result property="situation" column="situation"/>
                <result property="abnormalIllustrate" column="abnormal_illustrate"/>
                <result property="createTime" column="create_time"/>
                <result property="createBy" column="create_by"/>
                <result property="updateTime" column="update_time"/>
                <result property="updateBy" column="update_by"/>
                <result property="delFlag" column="del_flag"/>
    </resultMap>

    <sql id="selectCoreMonitoringTaskMonitorInfoVo">
        select id, task_monitor_id, project, situation, abnormal_illustrate, create_time, create_by, update_time, update_by, del_flag
        from core_monitoring_task_monitor_info
    </sql>

    <select id="selectCoreMonitoringTaskMonitorInfoList" parameterType="com.xunmei.core.access.domain.CoreMonitoringTaskMonitorInfo"
            resultMap="CoreMonitoringTaskMonitorInfoResult">
        <include refid="selectCoreMonitoringTaskMonitorInfoVo"/>
        <where>
                        <if test="taskMonitorId != null ">
                            and task_monitor_id = #{taskMonitorId}
                        </if>
                        <if test="project != null  and project != ''">
                            and project = #{project}
                        </if>
                        <if test="situation != null  and situation != ''">
                            and situation = #{situation}
                        </if>
                        <if test="abnormalIllustrate != null  and abnormalIllustrate != ''">
                            and abnormal_illustrate = #{abnormalIllustrate}
                        </if>
        </where>
    </select>

    <select id="selectCoreMonitoringTaskMonitorInfoById" parameterType="Long"
            resultMap="CoreMonitoringTaskMonitorInfoResult">
            <include refid="selectCoreMonitoringTaskMonitorInfoVo"/>
            where id = #{id}
    </select>
    <select id="selectCoreMonitoringTaskMonitorInfoByMonitorId"
            resultType="com.xunmei.core.access.domain.CoreMonitoringTaskMonitorInfo">
        <include refid="selectCoreMonitoringTaskMonitorInfoVo"/>
        where task_monitor_id = #{monitorId}
    </select>

    <insert id="insertCoreMonitoringTaskMonitorInfo" parameterType="com.xunmei.core.access.domain.CoreMonitoringTaskMonitorInfo">
        insert into core_monitoring_task_monitor_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="taskMonitorId != null">task_monitor_id,
                    </if>
                    <if test="project != null">project,
                    </if>
                    <if test="situation != null">situation,
                    </if>
                    <if test="abnormalIllustrate != null">abnormal_illustrate,
                    </if>
                    <if test="createTime != null">create_time,
                    </if>
                    <if test="createBy != null">create_by,
                    </if>
                    <if test="updateTime != null">update_time,
                    </if>
                    <if test="updateBy != null">update_by,
                    </if>
                    <if test="delFlag != null">del_flag,
                    </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},
                    </if>
                    <if test="taskMonitorId != null">#{taskMonitorId},
                    </if>
                    <if test="project != null">#{project},
                    </if>
                    <if test="situation != null">#{situation},
                    </if>
                    <if test="abnormalIllustrate != null">#{abnormalIllustrate},
                    </if>
                    <if test="createTime != null">#{createTime},
                    </if>
                    <if test="createBy != null">#{createBy},
                    </if>
                    <if test="updateTime != null">#{updateTime},
                    </if>
                    <if test="updateBy != null">#{updateBy},
                    </if>
                    <if test="delFlag != null">#{delFlag},
                    </if>
        </trim>
    </insert>

    <update id="updateCoreMonitoringTaskMonitorInfo" parameterType="com.xunmei.core.access.domain.CoreMonitoringTaskMonitorInfo">
        update core_monitoring_task_monitor_info
        <trim prefix="SET" suffixOverrides=",">
                    <if test="taskMonitorId != null">task_monitor_id =
                        #{taskMonitorId},
                    </if>
                    <if test="project != null">project =
                        #{project},
                    </if>
                    <if test="situation != null">situation =
                        #{situation},
                    </if>
                    <if test="abnormalIllustrate != null">abnormal_illustrate =
                        #{abnormalIllustrate},
                    </if>
                    <if test="createTime != null">create_time =
                        #{createTime},
                    </if>
                    <if test="createBy != null">create_by =
                        #{createBy},
                    </if>
                    <if test="updateTime != null">update_time =
                        #{updateTime},
                    </if>
                    <if test="updateBy != null">update_by =
                        #{updateBy},
                    </if>
                    <if test="delFlag != null">del_flag =
                        #{delFlag},
                    </if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCoreMonitoringTaskMonitorInfoById" parameterType="Long">
        delete
        from core_monitoring_task_monitor_info where id = #{id}
    </delete>

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