<?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="jnpf.notice.mapper.FtbNoticeAnnouncementsLogMapper">

    <resultMap id="BaseResultMap" type="jnpf.model.notice.domain.FtbNoticeAnnouncementsLog">
        <id property="id" column="F_Id" jdbcType="VARCHAR"/>
        <result property="userId" column="F_UserId" jdbcType="VARCHAR"/>
        <result property="userName" column="F_UserName" jdbcType="VARCHAR"/>
        <result property="type" column="F_Type" jdbcType="TINYINT"/>
        <result property="content" column="F_Content" jdbcType="VARCHAR"/>
        <result property="enabledMark" column="F_EnabledMark" jdbcType="INTEGER"/>
        <result property="creatorUserId" column="F_CreatorUserId" jdbcType="VARCHAR"/>
        <result property="creatorTime" column="F_CreatorTime" jdbcType="TIMESTAMP"/>
        <result property="lastModifyUserId" column="F_LastModifyUserId" jdbcType="VARCHAR"/>
        <result property="lastModifyTime" column="F_LastModifyTime" jdbcType="TIMESTAMP"/>
        <result property="tenantId" column="F_TenantId" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        F_Id
        ,F_UserId,F_UserName,
        F_Type,F_Content,F_EnabledMark,
        F_CreatorUserId,F_CreatorTime,F_LastModifyUserId,
        F_LastModifyTime,F_DeleteUserId,F_DeleteTime,
        F_TenantId
    </sql>
    <!--分页查询通知公告日志-->
    <select id="pagingQuery" resultType="jnpf.model.notice.dto.FtbNoticeAnnouncementsLogDto">
        select F_Id as id,F_UserId as userId,F_UserName as userName,
        F_Type as type,F_Content as content,
        F_CreatorUserId as creatorUserId,F_CreatorTime as creatorTime from ftb_notice_announcements_log as log
        <where>
            log.F_EnabledMark = 1
            <if test="params.startDate!= null and params.endDate!= null">
                and log.F_CreatorTime between #{params.startDate} and #{params.endDate}
            </if>
            <if test="params.keyWord!= null and params.keyWord!= ''">
                and (
                log.F_UserName like CONCAT('%',#{params.keyWord},'%')
                or log.F_Content like CONCAT('%',#{params.keyWord},'%')
                )
            </if>

            <if test="params.type!= null and params.type!=0">
                and log.F_Type =#{params.type}
            </if>

        </where>
        order by F_CreatorTime desc
    </select>
</mapper>
