<?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="org.springblade.modules.warn.mapper.WarnResponseInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="entityResultMap" type="org.springblade.modules.warn.entity.WarnResponseInfoEntity">
        <result column="WARN_ID" property="warnId"/>
        <result column="REAC_TM" property="reacTm"/>
        <result column="REPLY_TM" property="replyTm"/>
        <result column="PCA_ID" property="pcaId"/>
        <result column="REAC_TIMES" property="reacTimes"/>
        <result column="REPLT_STATUS" property="repltStatus"/>
        <result column="RESPON_TM" property="responTm"/>
        <result column="IS_RECEIVE" property="isReceive"/>
        <result column="IS_FLOOD_BOOT" property="isFloodBoot"/>
        <result column="IS_RAIN_CONTU" property="isRainContu"/>
        <result column="IS_TRANS" property="isTrans"/>
        <result column="IS_DEADY" property="isDeady"/>
        <result column="IS_FLOOD_OUT" property="isFloodOut"/>
    </resultMap>

    <!--SELECT_ZHSL_USER-->
    <select id="selectList" resultMap="entityResultMap">
            SELECT R.WARN_ID,
            to_char(R.REAC_TM, 'yyyy-mm-dd hh24:mi:ss') REAC_TM,
            to_char(R.REPLY_TM, 'yyyy-mm-dd hh24:mi:ss') REPLY_TM,
            PCA_ID,N.NAME PCA_NAME,REAC_TIMES,
            (SELECT DICT_NAME FROM SELECT_ZHSL_USER.ST_DICT WHERE DICT_TYPE='repltStatus' AND
            DICT_VALUE=R.REPLT_STATUS) REPLT_STATUS,
            (SELECT DICT_NAME FROM SELECT_ZHSL_USER.ST_DICT WHERE DICT_TYPE='commtype' AND
            DICT_VALUE=N.COMMTYPE) COMMTYPE,
            to_char(R.RESPON_TM, 'yyyy-mm-dd hh24:mi:ss') RESPON_TM,
            (case when IS_RECEIVE='0' then '是' else '否' end) IS_RECEIVE,
            (case when IS_FLOOD_BOOT='0' then '是' else '否' end) IS_FLOOD_BOOT,
            (case when IS_RAIN_CONTU='0' then '是' else '否' end) IS_RAIN_CONTU,
            (case when IS_TRANS='0' then '是' else '否' end) IS_TRANS,
            (case when IS_DEADY='0' then '是' else '否' end) IS_DEADY,
            (case when IS_FLOOD_OUT='0' then '是' else '否' end) IS_FLOOD_OUT
            from SELECT_ZHSL_USER.ST_WARN_CFNR_R R
            LEFT JOIN SELECT_ZHSL_USER.ST_COMMUNICATION N ON R.PCA_ID=N.ID
            where R.WARN_ID=#{dto.warnId}
            order by REPLY_TM desc,RESPON_TM desc,REAC_TM desc
    </select>

</mapper>
