<?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.ruoyi.project.patrol.emergency.mapper.TEmergencyEyewashMapper">

    <resultMap type="TEmergencyEyewash" id="TEmergencyEyewashResult">
        <result property="id"    column="id"    />
        <result property="devNo"    column="dev_no"    />
        <result property="position"    column="position"    />
        <result property="identifying"    column="identifying"    />
        <result property="identifyingFile"    column="identifying_file"    />
        <result property="noObstacle"    column="no_obstacle"    />
        <result property="noOcclusion"    column="no_occlusion"    />
        <result property="noDamage"    column="no_damage"    />
        <result property="noDamageFile"    column="no_damage_file"    />
        <result property="inSafe"    column="in_safe"    />
        <result property="inSafeFile"    column="in_safe_file"    />
        <result property="exitPoint"    column="exit_point"    />
        <result property="exitPointFile"    column="exit_point_file"    />
        <result property="exitClean"    column="exit_clean"    />
        <result property="exitTemp"    column="exit_temp"    />
        <result property="keepOpen"    column="keep_open"    />
        <result property="noticed"    column="noticed"    />
        <result property="normalOperation"    column="normal_operation"    />
        <result property="feedback"    column="feedback"    />
        <result property="confirmed"    column="confirmed"    />
        <result property="checkStatus"    column="check_status"    />
        <result property="checkDate"    column="check_date"    />
        <result property="month"    column="month"    />
        <result property="year"    column="year"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="createdate"    column="createdate"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="remarks"    column="remarks"    />
        <result property="deptId"    column="dept_id"    />
        <result property="issuesStatus"    column="issues_status"    />
        <result property="issuesFlag"    column="issues_flag"    />
        <result property="planId"    column="plan_id"    />
        <result property="problemFileUrl"    column="problem_file_url"    />
        <result property="fileUrl"    column="file_url"    />
        <result property="repairFile"    column="repair_file"    />
    </resultMap>

    <sql id="selectTEmergencyEyewashVo">
        select id, dev_no, position, identifying,identifying_file, no_obstacle, no_occlusion, no_damage,no_damage_file, in_safe,in_safe_file, exit_point,exit_point_file, exit_clean, exit_temp, keep_open, noticed, normal_operation, feedback, confirmed, check_status, check_date, month, year, del_flag, creater_code, createdate, updater_code, updatedate, remarks, dept_id,issues_status,plan_id,problem_file_url,file_url,issues_flag,repair_file from t_emergency_eyewash
    </sql>

    <select id="selectTEmergencyEyewashList" parameterType="TEmergencyEyewash" resultMap="TEmergencyEyewashResult">
        <include refid="selectTEmergencyEyewashVo"/>
        <where>
            <if test="precision != null  and precision != ''"> and dev_no =#{precision}</if>
            <if test="devNo != null  and devNo != ''"> and dev_no  like concat(concat('%', #{devNo}), '%')</if>
            <if test="position != null  and position != ''"> and position  like concat(concat('%', #{position}), '%')</if>
            <if test="identifying != null  and identifying != ''"> and identifying = #{identifying}</if>
            <if test="noObstacle != null  and noObstacle != ''"> and no_obstacle = #{noObstacle}</if>
            <if test="noOcclusion != null  and noOcclusion != ''"> and no_occlusion = #{noOcclusion}</if>
            <if test="noDamage != null  and noDamage != ''"> and no_damage = #{noDamage}</if>
            <if test="inSafe != null  and inSafe != ''"> and in_safe = #{inSafe}</if>
            <if test="exitPoint != null  and exitPoint != ''"> and exit_point = #{exitPoint}</if>
            <if test="exitClean != null  and exitClean != ''"> and exit_clean = #{exitClean}</if>
            <if test="exitTemp != null  and exitTemp != ''"> and exit_temp = #{exitTemp}</if>
            <if test="keepOpen != null  and keepOpen != ''"> and keep_open = #{keepOpen}</if>
            <if test="noticed != null  and noticed != ''"> and noticed = #{noticed}</if>
            <if test="normalOperation != null  and normalOperation != ''"> and normal_operation = #{normalOperation}</if>
            <if test="feedback != null  and feedback != ''"> and feedback = #{feedback}</if>
            <if test="confirmed != null  and confirmed != ''"> and confirmed = #{confirmed}</if>
            <if test="checkStatus != null  and checkStatus != ''"> and check_status = #{checkStatus}</if>
            <if test="checkDate != null "> and check_date = #{checkDate}</if>
            <if test="month != null "> and month = #{month}</if>
            <if test="year != null "> and year = #{year}</if>
            <if test="id != null "> and id = #{id}</if>
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="issuesStatus != null "> and issues_status = #{issuesStatus}</if>
            <if test="issuesFlag != null "> and issues_flag = #{issuesFlag}</if>
            <if test="planId != null "> and plan_id = #{planId}</if>
            and del_flag=0
        </where>
        order by check_status,check_date desc
    </select>

    <select id="selectTEmergencyEyewashById" parameterType="Long" resultMap="TEmergencyEyewashResult">
        <include refid="selectTEmergencyEyewashVo"/>
        where id = #{id}
    </select>

    <insert id="insertTEmergencyEyewash" parameterType="TEmergencyEyewash">
        <selectKey keyProperty="id" resultType="long" order="BEFORE">
            SELECT seq_t_emergency_eyewash.NEXTVAL as id FROM DUAL
        </selectKey>
        insert into t_emergency_eyewash
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="devNo != null">dev_no,</if>
            <if test="position != null">position,</if>
            <if test="identifying != null">identifying,</if>
            <if test="identifyingFile != null">identifying_file,</if>
            <if test="noObstacle != null">no_obstacle,</if>
            <if test="noOcclusion != null">no_occlusion,</if>
            <if test="noDamage != null">no_damage,</if>
            <if test="noDamageFile != null">no_damage_file,</if>
            <if test="inSafe != null">in_safe,</if>
            <if test="inSafeFile != null">in_safe_file,</if>
            <if test="exitPoint != null">exit_point,</if>
            <if test="exitPointFile != null">exit_point_file,</if>
            <if test="exitClean != null">exit_clean,</if>
            <if test="exitTemp != null">exit_temp,</if>
            <if test="keepOpen != null">keep_open,</if>
            <if test="noticed != null">noticed,</if>
            <if test="normalOperation != null">normal_operation,</if>
            <if test="feedback != null">feedback,</if>
            <if test="confirmed != null">confirmed,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="checkDate != null">check_date,</if>
            <if test="month != null">month,</if>
            <if test="year != null">year,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="createdate != null">createdate,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="remarks != null">remarks,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="issuesStatus != null">issues_status,</if>
            <if test="planId != null">plan_id,</if>
            <if test="problemFileUrl != null">problem_file_url,</if>
            <if test="fileUrl != null">file_url,</if>
            <if test="issuesFlag != null">issues_flag,</if>
            <if test="repairFile != null">repair_file,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="devNo != null">#{devNo},</if>
            <if test="position != null">#{position},</if>
            <if test="identifying != null">#{identifying},</if>
            <if test="identifyingFile != null">#{identifyingFile},</if>
            <if test="noObstacle != null">#{noObstacle},</if>
            <if test="noOcclusion != null">#{noOcclusion},</if>
            <if test="noDamage != null">#{noDamage},</if>
            <if test="noDamageFile != null">#{noDamageFile},</if>
            <if test="inSafe != null">#{inSafe},</if>
            <if test="inSafeFile != null">#{inSafeFile},</if>
            <if test="exitPoint != null">#{exitPoint},</if>
            <if test="exitPointFile != null">#{exitPointFile},</if>
            <if test="exitClean != null">#{exitClean},</if>
            <if test="exitTemp != null">#{exitTemp},</if>
            <if test="keepOpen != null">#{keepOpen},</if>
            <if test="noticed != null">#{noticed},</if>
            <if test="normalOperation != null">#{normalOperation},</if>
            <if test="feedback != null">#{feedback},</if>
            <if test="confirmed != null">#{confirmed},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="checkDate != null">#{checkDate},</if>
            <if test="month != null">#{month},</if>
            <if test="year != null">#{year},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="issuesStatus != null">#{issuesStatus},</if>
            <if test="planId != null">#{planId},</if>
            <if test="problemFileUrl != null">#{problemFileUrl},</if>
            <if test="fileUrl != null">#{fileUrl},</if>
            <if test="issuesFlag != null">#{issuesFlag},</if>
            <if test="repairFile != null">#{repairFile},</if>
         </trim>
    </insert>

    <update id="updateTEmergencyEyewash" parameterType="TEmergencyEyewash">
        update t_emergency_eyewash
        <trim prefix="SET" suffixOverrides=",">
            <if test="devNo != null">dev_no = #{devNo},</if>
            <if test="position != null">position = #{position},</if>
            <if test="identifying != null">identifying = #{identifying},</if>
            <if test="identifyingFile != null">identifying_file = #{identifyingFile},</if>
            <if test="noObstacle != null">no_obstacle = #{noObstacle},</if>
            <if test="noOcclusion != null">no_occlusion = #{noOcclusion},</if>
            <if test="noDamage != null">no_damage = #{noDamage},</if>
            <if test="noDamageFile != null">no_damage_file = #{noDamageFile},</if>
            <if test="inSafe != null">in_safe = #{inSafe},</if>
            <if test="inSafeFile != null">in_safe_file = #{inSafeFile},</if>
            <if test="exitPoint != null">exit_point = #{exitPoint},</if>
            <if test="exitPointFile != null">exit_point_file = #{exitPointFile},</if>
            <if test="exitClean != null">exit_clean = #{exitClean},</if>
            <if test="exitTemp != null">exit_temp = #{exitTemp},</if>
            <if test="keepOpen != null">keep_open = #{keepOpen},</if>
            <if test="noticed != null">noticed = #{noticed},</if>
            <if test="normalOperation != null">normal_operation = #{normalOperation},</if>
            <if test="feedback != null">feedback = #{feedback},</if>
            <if test="confirmed != null">confirmed = #{confirmed},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="checkDate != null">check_date = #{checkDate},</if>
            <if test="month != null">month = #{month},</if>
            <if test="year != null">year = #{year},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="issuesStatus != null">issues_status = #{issuesStatus},</if>
            <if test="planId != null">plan_id = #{planId},</if>
            <if test="problemFileUrl != null">problem_file_url = #{problemFileUrl},</if>
            <if test="fileUrl != null">file_url = #{fileUrl},</if>
            <if test="issuesFlag != null">issues_flag = #{issuesFlag},</if>
            <if test="repairFile != null">repair_file = #{repairFile},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTEmergencyEyewashById" parameterType="Long">
        delete from t_emergency_eyewash where id = #{id}
    </delete>

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