<?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.stylefeng.guns.modular.system.mapper.NoticeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.system.entity.Notice">
        <id column="NOTICE_ID" property="noticeId" />
        <result column="TITLE" property="title" />
        <result column="CONTENT" property="content" />
        <result column="CREATE_TIME" property="createTime" />
        <result column="CREATE_USER" property="createUser" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="UPDATE_USER" property="updateUser" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        NOTICE_ID AS noticeId, TITLE AS title, CONTENT AS content, CREATE_TIME AS createTime, CREATE_USER AS createUser, UPDATE_TIME AS updateTime, UPDATE_USER AS updateUser
    </sql>

    <select id="list" resultType="map">
        select
        <include refid="Base_Column_List"></include>
        from sys_notice
        <if test="condition != null and condition != ''">
            where TITLE like CONCAT('%',#{condition},'%') or CONTENT like CONCAT('%',#{condition},'%')
        </if>
        order by CREATE_TIME DESC
    </select>
</mapper>
