<?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.aucma.report.mapper.ReportPointDnbMapper">

    <resultMap type="ReportPointDnb" id="ReportPointDnbResult">
            <result property="objId"    column="obj_id"    />
            <result property="monitorCode"    column="monitor_code"    />
            <result property="instrumentValue"    column="instrument_value"    />
            <result property="expend"    column="expend"    />
            <result property="recordTime"    column="record_time"    />
            <result property="beginTime"    column="begin_time"    />
            <result property="endTime"    column="end_time"    />
            <result property="isFlag"    column="is_flag"    />
            <result property="createdBy"    column="created_by"    />
            <result property="createdTime"    column="created_time"    />
            <result property="updatedBy"    column="updated_by"    />
            <result property="updatedTime"    column="updated_time"    />
    </resultMap>

    <sql id="selectReportPointDnbVo">
        select obj_id, monitor_code, instrument_value, expend, record_time, begin_time, end_time, is_flag, created_by, created_time, updated_by, updated_time from report_point_dnb
    </sql>

    <select id="selectReportPointDnbList" parameterType="ReportPointDnb" resultMap="ReportPointDnbResult">
        <include refid="selectReportPointDnbVo"/>
        <where>
                        <if test="objId != null "> and obj_id = #{objId}</if>
                        <if test="monitorCode != null  and monitorCode != ''"> and monitor_code = #{monitorCode}</if>
                        <if test="instrumentValue != null "> and instrument_value = #{instrumentValue}</if>
                        <if test="expend != null "> and expend = #{expend}</if>
                        <if test="recordTime != null  and recordTime != ''"> and record_time = #{recordTime}</if>
                        <if test="beginTime != null  and beginTime != ''"> and begin_time = #{beginTime}</if>
                        <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
                        <if test="isFlag != null "> and is_flag = #{isFlag}</if>
                        <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
                        <if test="createdTime != null "> and created_time = #{createdTime}</if>
                        <if test="updatedBy != null  and updatedBy != ''"> and updated_by = #{updatedBy}</if>
                        <if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
        </where>
        order by OBJ_ID
    </select>

    <select id="selectReportPointDnbByObjId" parameterType="Long" resultMap="ReportPointDnbResult">
            <include refid="selectReportPointDnbVo"/>
            where obj_id = #{objId}
    </select>

    <insert id="insertReportPointDnb" parameterType="ReportPointDnb">
        <selectKey keyProperty="objId" resultType="long" order="BEFORE">
            SELECT seq_report_point_dnb.NEXTVAL as objId FROM DUAL
        </selectKey>
        insert into report_point_dnb
        <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="objId != null">obj_id,</if>
                <if test="monitorCode != null">monitor_code,</if>
                <if test="instrumentValue != null">instrument_value,</if>
                <if test="expend != null">expend,</if>
                <if test="recordTime != null">record_time,</if>
                <if test="beginTime != null">begin_time,</if>
                <if test="endTime != null">end_time,</if>
                <if test="isFlag != null">is_flag,</if>
                <if test="createdBy != null">created_by,</if>
                <if test="createdTime != null">created_time,</if>
                <if test="updatedBy != null">updated_by,</if>
                <if test="updatedTime != null">updated_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                <if test="objId != null">#{objId},</if>
                <if test="monitorCode != null">#{monitorCode},</if>
                <if test="instrumentValue != null">#{instrumentValue},</if>
                <if test="expend != null">#{expend},</if>
                <if test="recordTime != null">#{recordTime},</if>
                <if test="beginTime != null">#{beginTime},</if>
                <if test="endTime != null">#{endTime},</if>
                <if test="isFlag != null">#{isFlag},</if>
                <if test="createdBy != null">#{createdBy},</if>
                <if test="createdTime != null">#{createdTime},</if>
                <if test="updatedBy != null">#{updatedBy},</if>
                <if test="updatedTime != null">#{updatedTime},</if>
        </trim>
    </insert>

    <update id="updateReportPointDnb" parameterType="ReportPointDnb">
        update report_point_dnb
        <trim prefix="SET" suffixOverrides=",">
                    <if test="monitorCode != null">monitor_code = #{monitorCode},</if>
                    <if test="instrumentValue != null">instrument_value = #{instrumentValue},</if>
                    <if test="expend != null">expend = #{expend},</if>
                    <if test="recordTime != null">record_time = #{recordTime},</if>
                    <if test="beginTime != null">begin_time = #{beginTime},</if>
                    <if test="endTime != null">end_time = #{endTime},</if>
                    <if test="isFlag != null">is_flag = #{isFlag},</if>
                    <if test="createdBy != null">created_by = #{createdBy},</if>
                    <if test="createdTime != null">created_time = #{createdTime},</if>
                    <if test="updatedBy != null">updated_by = #{updatedBy},</if>
                    <if test="updatedTime != null">updated_time = #{updatedTime},</if>
        </trim>
        where obj_id = #{objId}
    </update>

    <delete id="deleteReportPointDnbByObjId" parameterType="Long">
        delete from report_point_dnb where obj_id = #{objId}
    </delete>

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