<?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="cn.cecep.talroad.mapper.BEnterpriseIrNotifierproNoticeMapper">

    <resultMap type="cn.cecep.talroad.domain.BEnterpriseIrNotifierproNotice" id="BEnterpriseIrNotifierproNoticeResult">
        <result property="noticeId"    column="notice_id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="announcementType"    column="announcement_type"    />
        <result property="announcementTitle"    column="announcement_title"    />
        <result property="announcementDetails"    column="announcement_details"    />
        <result property="announcementTime"    column="announcement_time"    />
        <result property="status"    column="status"    />
    </resultMap>


    <sql id="selectBEnterpriseIrNotifierproNoticeVo">
        select notice_id, factory_id, announcement_type, announcement_title, announcement_details, announcement_time, status from b_enterprise_ir_notifierpro_notice
    </sql>

    <select id="selectBEnterpriseIrNotifierproNoticeList" parameterType="cn.cecep.talroad.domain.BEnterpriseIrNotifierproNotice" resultMap="BEnterpriseIrNotifierproNoticeResult">
        <include refid="selectBEnterpriseIrNotifierproNoticeVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="announcementType != null  and announcementType != ''"> and announcement_type = #{announcementType}</if>
            <if test="announcementTitle != null  and announcementTitle != ''"> and announcement_title = #{announcementTitle}</if>
            <if test="announcementDetails != null  and announcementDetails != ''"> and announcement_details = #{announcementDetails}</if>
            <if test="announcementTime != null  and announcementTime != ''"> and announcement_time = #{announcementTime}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="delFlag != null  and delFlag != ''"> and del_flag = #{delFlag}</if>
        </where>
    </select>

    <select id="selectOptions" resultType="java.util.Map">
        SELECT
            announcement_type AS label,
            announcement_type AS value
        FROM
            b_enterprise_ir_notifierpro_notice
        WHERE
            factory_id = #{factoryId}
          AND del_flag = '0'
        GROUP BY
            announcement_type
    </select>
</mapper>
