<?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.lantone.security.mapper.NoticeMapper">

    <select id="listPage" resultType="com.lantone.security.dto.ListManagePageDTO">
        SELECT
        n.id,
        n.title,
        n.type,
        (
        CASE
        WHEN n.type = 0 THEN
        "公告"
        WHEN n.type = 1 THEN
        "其他"
        ELSE
        "未知类型"
        END
        ) typeName,
        n.creatorName sender,
        n.gmt_create gmtCreate
        FROM
        sys_notice n
        WHERE
        n.is_deleted = 'N'
        <if test="listManagePageVO.type !=null and listManagePageVO.type != ''">
            AND n.type = #{listManagePageVO.type}
        </if>
        <if test="listManagePageVO.id !=null">
            AND n.creator = #{listManagePageVO.id}
        </if>

    </select>
</mapper>