<?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.CoreMonitoringTaskRegistrationMapper">

    <resultMap type="com.xunmei.core.access.domain.CoreMonitoringTaskRegistration" id="CoreMonitoringTaskRegistrationResult">
                <result property="id" column="id"/>
                <result property="taskId" column="task_id"/>
                <result property="taskStartTime" column="task_start_time"/>
                <result property="delFlag" column="del_flag"/>
                <result property="nfc" column="nfc"/>
                <result property="picture" column="picture"/>
                <result property="createBy" column="create_by"/>
                <result property="updateBy" column="update_by"/>
                <result property="createTime" column="create_time"/>
                <result property="updateTime" column="update_time"/>
    </resultMap>

    <sql id="selectCoreMonitoringTaskRegistrationVo">
        select id, task_id, task_start_time, del_flag, nfc, picture, create_by, update_by, create_time, update_time
        from core_monitoring_task_registration
    </sql>

    <select id="selectCoreMonitoringTaskRegistrationList" parameterType="com.xunmei.core.access.domain.CoreMonitoringTaskRegistration"
            resultMap="CoreMonitoringTaskRegistrationResult">
        <include refid="selectCoreMonitoringTaskRegistrationVo"/>
        <where>
                        <if test="taskId != null ">
                            and task_id = #{taskId}
                        </if>
                        <if test="taskStartTime != null ">
                            and task_start_time = #{taskStartTime}
                        </if>
                        <if test="nfc != null  and nfc != ''">
                            and nfc = #{nfc}
                        </if>
                        <if test="picture != null  and picture != ''">
                            and picture = #{picture}
                        </if>
        </where>
    </select>

    <select id="selectCoreMonitoringTaskRegistrationById" parameterType="Long"
            resultMap="CoreMonitoringTaskRegistrationResult">
            <include refid="selectCoreMonitoringTaskRegistrationVo"/>
            where id = #{id}
    </select>

    <insert id="insertCoreMonitoringTaskRegistration" parameterType="com.xunmei.core.access.domain.CoreMonitoringTaskRegistration">
        insert into core_monitoring_task_registration
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="taskId != null">task_id,
                    </if>
                    <if test="taskStartTime != null">task_start_time,
                    </if>
                    <if test="delFlag != null">del_flag,
                    </if>
                    <if test="nfc != null">nfc,
                    </if>
                    <if test="picture != null">picture,
                    </if>
                    <if test="createBy != null">create_by,
                    </if>
                    <if test="updateBy != null">update_by,
                    </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="taskId != null">#{taskId},
                    </if>
                    <if test="taskStartTime != null">#{taskStartTime},
                    </if>
                    <if test="delFlag != null">#{delFlag},
                    </if>
                    <if test="nfc != null">#{nfc},
                    </if>
                    <if test="picture != null">#{picture},
                    </if>
                    <if test="createBy != null">#{createBy},
                    </if>
                    <if test="updateBy != null">#{updateBy},
                    </if>
                    <if test="createTime != null">#{createTime},
                    </if>
                    <if test="updateTime != null">#{updateTime},
                    </if>
        </trim>
    </insert>

    <update id="updateCoreMonitoringTaskRegistration" parameterType="com.xunmei.core.access.domain.CoreMonitoringTaskRegistration">
        update core_monitoring_task_registration
        <trim prefix="SET" suffixOverrides=",">
                    <if test="taskId != null">task_id =
                        #{taskId},
                    </if>
                    <if test="taskStartTime != null">task_start_time =
                        #{taskStartTime},
                    </if>
                    <if test="delFlag != null">del_flag =
                        #{delFlag},
                    </if>
                    <if test="nfc != null">nfc =
                        #{nfc},
                    </if>
                    <if test="picture != null">picture =
                        #{picture},
                    </if>
                    <if test="createBy != null">create_by =
                        #{createBy},
                    </if>
                    <if test="updateBy != null">update_by =
                        #{updateBy},
                    </if>
                    <if test="createTime != null">create_time =
                        #{createTime},
                    </if>
                    <if test="updateTime != null">update_time =
                        #{updateTime},
                    </if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCoreMonitoringTaskRegistrationById" parameterType="Long">
        delete
        from core_monitoring_task_registration where id = #{id}
    </delete>

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