<?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.goldenwater.slaj.hazard.mapper.TBusiInspectRecordMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TBusiInspectRecord" id="TBusiInspectRecordResult">
        <result property="guid" column="guid"/>
        <result property="hazIdenGuid" column="haz_iden_guid"/>
        <result property="taskGuid" column="task_guid"/>
        <result property="startTime" column="start_time"/>
        <result property="endTime" column="end_time"/>
        <result property="quantType" column="quant_type"/>
        <result property="early" column="early"/>
        <result property="threshold" column="threshold"/>
        <result property="result" column="result"/>
        <result property="remark" column="remark"/>
        <result property="inspectPerGuid" column="inspect_per_guid"/>
        <result property="inspectPer" column="inspect_per"/>
        <result property="inspectTime" column="inspect_time"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="createPer" column="create_per"/>
        <result property="createTime" column="create_time"/>
        <result property="updatePer" column="update_per"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <sql id="selectTBusiInspectRecordVo">
        select guid, haz_iden_guid, task_guid, start_time, end_time, quant_type, early, threshold, result, remark, inspect_per_guid, inspect_per, inspect_time, org_guid, create_per, create_time, update_per, update_time
        from t_busi_inspect_record
    </sql>
    <select id="selectTBusiInspectRecordByGuid" parameterType="String" resultMap="TBusiInspectRecordResult">
        <include refid="selectTBusiInspectRecordVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTBusiInspectRecordList" parameterType="com.goldenwater.slaj.hazard.domain.TBusiInspectRecord" resultMap="TBusiInspectRecordResult">
        <include refid="selectTBusiInspectRecordVo"/>
        <where>
            <if test="hazIdenGuid != null and hazIdenGuid != ''">AND haz_iden_guid like '%' || #{hazIdenGuid} || '%'</if>
            <if test="taskGuid != null and taskGuid != ''">AND task_guid like '%' || #{taskGuid} || '%'</if>
            <if test="startTime != null and startTime != ''">AND start_time like '%' || #{startTime} || '%'</if>
            <if test="endTime != null and endTime != ''">AND end_time = #{endTime}</if>
            <if test="quantType != null and quantType != ''">AND quant_type = #{quantType}</if>
            <if test="early != null and early != ''">AND early = #{early}</if>
            <if test="threshold != null and threshold != ''">AND threshold = #{threshold}</if>
            <if test="result != null and result != ''">AND result = #{result}</if>
            <if test="remark != null and remark != ''">AND remark = #{remark}</if>
            <if test="inspectPerGuid != null and inspectPerGuid != ''">AND inspect_per_guid = #{inspectPerGuid}</if>
            <if test="inspectPer != null and inspectPer != ''">AND inspect_per = #{inspectPer}</if>
            <if test="inspectTime != null and inspectTime != ''">AND inspect_time = #{inspectTime}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="createPer != null and createPer != ''">AND create_per = #{createPer}</if>
            <if test="createTime != null and createTime != ''">AND create_time = #{createTime}</if>
            <if test="updatePer != null and updatePer != ''">AND update_per = #{updatePer}</if>
            <if test="updateTime != null and updateTime != ''">AND update_time = #{updateTime}</if>
        </where>
    </select>
    <insert id="insertTBusiInspectRecord" parameterType="com.goldenwater.slaj.hazard.domain.TBusiInspectRecord">
        insert into t_busi_inspect_record (
            guid,
            haz_iden_guid,
            task_guid,
            start_time,
            end_time,
            quant_type,
            early,
            threshold,
            result,
            remark,
            inspect_per_guid,
            inspect_per,
            inspect_time,
            org_guid,
            create_per,
            create_time,
            update_per,
            update_time
        ) values (
            #{guid},
            #{hazIdenGuid},
            #{taskGuid},
            #{startTime},
            #{endTime},
            #{quantType},
            #{early},
            #{threshold},
            #{result},
            #{remark},
            #{inspectPerGuid},
            #{inspectPer},
            #{inspectTime},
            #{orgGuid},
            #{createPer},
            #{createTime},
            #{updatePer},
            #{updateTime}
        )
    </insert>
    <update id="updateTBusiInspectRecord" parameterType="com.goldenwater.slaj.hazard.domain.TBusiInspectRecord">
        update t_busi_inspect_record
        <set>
            <if test="hazIdenGuid != null">haz_iden_guid = #{hazIdenGuid},</if>
            <if test="taskGuid != null">task_guid = #{taskGuid},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="quantType != null">quant_type = #{quantType},</if>
            <if test="early != null">early = #{early},</if>
            <if test="threshold != null">threshold = #{threshold},</if>
            <if test="result != null">result = #{result},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="inspectPerGuid != null">inspect_per_guid = #{inspectPerGuid},</if>
            <if test="inspectPer != null">inspect_per = #{inspectPer},</if>
            <if test="inspectTime != null">inspect_time = #{inspectTime},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="createPer != null">create_per = #{createPer},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updatePer != null">update_per = #{updatePer},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTBusiInspectRecordByGuid" parameterType="String">
        delete from t_busi_inspect_record where guid = #{guid}
    </delete>
    <delete id="deleteTBusiInspectRecordByGuids" parameterType="String">
        delete from t_busi_inspect_record where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
