<?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.casic.missiles.modular.system.dao.AlarmContentTypeMapper">


    <sql id="keywords_sql" databaseId="oracle">
        '%'||#{alarmContent}||'%'
    </sql>
    <sql id="keywords_sql" databaseId="mysql">
        CONCAT('%',#{alarmContent},'%')
    </sql>
    <sql id="keywords_sql" databaseId="pgsql">
        CONCAT('%',#{alarmContent},'%')
    </sql>

    <select id="selectListPage" resultType="MAP">
        SELECT ALARM_TYPE AS "alarmType",DEVICE_TYPE AS "deviceType",
        ALARM_CONTENT AS "alarmContent",ID AS "id"
        FROM base_alarm_content_type
        WHERE 1=1
        <if test="alarmType != null and alarmType !=-1">
            AND ALARM_TYPE= #{alarmType}
        </if>
        <if test="deviceType != null and deviceType !=-1">
            AND DEVICE_TYPE = #{deviceType}
        </if>
        <if test="alarmContent != null and alarmContent !=''">
            AND ALARM_CONTENT like
            <include refid="keywords_sql"/>
        </if>
    </select>


</mapper>