<?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.model.mapper.AppExaminationInstructionsMapper">
    
    <resultMap type="AppExaminationInstructions" id="AppExaminationInstructionsResult">
        <result property="examinationInstructionsId"    column="examination_instructions_id"    />
        <result property="examinationInstructionsType"    column="examination_instructions_type"    />
        <result property="examinationInstructionsText"    column="examination_instructions_text"    />
        <result property="remark"    column="remark"    />
        <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="selectAppExaminationInstructionsVo">
        select examination_instructions_id, examination_instructions_type, examination_instructions_text, remark, create_time, create_by, update_time, update_by, del_flag from app_examination_instructions
    </sql>

    <select id="selectAppExaminationInstructionsList" parameterType="AppExaminationInstructions" resultMap="AppExaminationInstructionsResult">
        <include refid="selectAppExaminationInstructionsVo"/>
        <where>  
            <if test="examinationInstructionsId != null "> and examination_instructions_id = #{examinationInstructionsId}</if>
            <if test="examinationInstructionsType != null  and examinationInstructionsType != ''"> and examination_instructions_type = #{examinationInstructionsType}</if>
            <if test="examinationInstructionsText != null  and examinationInstructionsText != ''"> and examination_instructions_text = #{examinationInstructionsText}</if>
        </where>
    </select>
    
    <select id="selectAppExaminationInstructionsByExaminationInstructionsId" parameterType="Long" resultMap="AppExaminationInstructionsResult">
        <include refid="selectAppExaminationInstructionsVo"/>
        where examination_instructions_id = #{examinationInstructionsId}
    </select>
    <select id="getAppExaminationInstructionsList"
            resultType="com.ruoyi.model.domain.AppExaminationInstructions">
        <include refid="selectAppExaminationInstructionsVo"/>
    </select>

    <insert id="insertAppExaminationInstructions" parameterType="AppExaminationInstructions">
        insert into app_examination_instructions
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="examinationInstructionsId != null">examination_instructions_id,</if>
            <if test="examinationInstructionsType != null">examination_instructions_type,</if>
            <if test="examinationInstructionsText != null">examination_instructions_text,</if>
            <if test="remark != null">remark,</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="examinationInstructionsId != null">#{examinationInstructionsId},</if>
            <if test="examinationInstructionsType != null">#{examination_instructions_type},</if>
            <if test="examinationInstructionsText != null">#{examinationInstructionsText},</if>
            <if test="remark != null">#{remark},</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="updateAppExaminationInstructions" parameterType="AppExaminationInstructions">
        update app_examination_instructions
        <trim prefix="SET" suffixOverrides=",">
            <if test="examinationInstructionsType != null">examination_instructions_type = #{examinationInstructionsType},</if>
            <if test="examinationInstructionsText != null">examination_instructions_text = #{examinationInstructionsText},</if>
            <if test="remark != null">remark = #{remark},</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 examination_instructions_id = #{examinationInstructionsId}
    </update>

    <delete id="deleteAppExaminationInstructionsByExaminationInstructionsId" parameterType="Long">
        delete from app_examination_instructions where examination_instructions_id = #{examinationInstructionsId}
    </delete>

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