<?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.ehsNoticeMessageFile.mapper.EhsNoticeMessageFileMapper">

    <resultMap type="EhsNoticeMessageFile" id="EhsNoticeMessageFileResult">
            <result property="id"    column="id"    />
            <result property="noticeMessageId"    column="notice_message_id"    />
            <result property="fileName"    column="file_name"    />
            <result property="state"    column="state"    />
            <result property="originalName"    column="original_name"    />
            <result property="fileSize"    column="file_size"    />
            <result property="submitTime"    column="submit_time"    />
            <result property="createBy"    column="create_by"    />
            <result property="createTime"    column="create_time"    />
            <result property="updateBy"    column="update_by"    />
            <result property="updateTime"    column="update_time"    />
            <result property="remark"    column="remark"    />
            <result property="deptId"    column="dept_id"    />
            <result property="createUserId"    column="create_user_id"    />
            <result property="updateUserId"    column="update_user_id"    />
    </resultMap>

    <sql id="selectEhsNoticeMessageFileVo">
        select id, notice_message_id, file_name, state, original_name, file_size, submit_time, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_notice_message_file
    </sql>

    <select id="selectEhsNoticeMessageFileList" parameterType="EhsNoticeMessageFile" resultMap="EhsNoticeMessageFileResult">
        <include refid="selectEhsNoticeMessageFileVo"/>
        <where>
                        <if test="noticeMessageId != null  and noticeMessageId != ''"> and notice_message_id = #{noticeMessageId}</if>
                        <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
                        <if test="state != null "> and state = #{state}</if>
                        <if test="originalName != null  and originalName != ''"> and original_name like concat('%', #{originalName}, '%')</if>
                        <if test="fileSize != null  and fileSize != ''"> and file_size = #{fileSize}</if>
                        <if test="submitTime != null "> and submit_time = #{submitTime}</if>
                        <if test="deptId != null "> and dept_id = #{deptId}</if>
                        <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
                        <if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
        </where>
    </select>

    <select id="selectEhsNoticeMessageFileById" parameterType="String" resultMap="EhsNoticeMessageFileResult">
            <include refid="selectEhsNoticeMessageFileVo"/>
            where id = #{id}
    </select>




</mapper>