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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.stylefeng.guns.sys.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>

    <select id="list" resultType="map" databaseId="oracle">
        select
        <include refid="Base_Column_List"></include>
        from sys_notice
        <if test="condition != null and condition != ''">
            where title like '%' || #{condition} || '%' or content like '%' || #{condition} || '%'
        </if>
        order by create_time DESC
    </select>
</mapper>
