<?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.tofly.xrtygis.mapper.TfMsgPushManageMapper">

  <resultMap id="tfMsgPushManageMap" type="com.tofly.xrtygis.entity.TfMsgPushManage">
                <id property="id" column="ID"/>
                      <result property="content" column="CONTENT"/>
                      <result property="contentType" column="CONTENT_TYPE"/>
                      <result property="editPerson" column="EDIT_PERSON"/>
                      <result property="msgType" column="MSG_TYPE"/>
                      <result property="isSendNow" column="IS_SEND_NOW"/>
                      <result property="sendTime" column="SEND_TIME"/>
                      <result property="sendStatus" column="SEND_STATUS"/>
      <association property="sendStatusName"  column="SEND_STATUS" select="getSendStatusName" ></association>
      <association property="msgTypeName"  column="MSG_TYPE" select="getMsgTypeName" ></association>
      <association property="isSendNowName"  column="IS_SEND_NOW" select="getIsSendNowName" ></association>
      <association property="contentTypeName"  column="CONTENT_TYPE" select="getContentTypeName" ></association>
      <association property="msgPersonManages"  column="ID" select="getMsgPersonManages" ></association>
      <association property="editPersonName"  column="EDIT_PERSON" select="com.tofly.xrtygis.mapper.IFileMapper.getUserName" ></association>
  </resultMap>

    <select id="getMsgTypeName" resultType="string">
        SELECT decode(#{msgType},'1','语音','2','短信') as msgTypeName FROM dual
    </select>

    <select id="getIsSendNowName" resultType="string">
        SELECT decode(#{isSendNow},'0','否','1','是') as isSendNowName FROM dual
    </select>

    <select id="getSendStatusName" resultType="string">
        SELECT decode(#{sendStatus},'0','未发送','1','已发送') as sendStatusName FROM dual
    </select>

    <select id="getContentTypeName" resultType="string">
        SELECT CNAME
        FROM
            TF_YWPN_SYSCHILDCODE_D
        WHERE
            PCID =60055
          AND
            CCODE = #{contentType}
    </select>

    <select id="getMsgPersonManages" resultType="com.tofly.xrtygis.entity.TfMsgPersonManage">
        SELECT * FROM TF_MSG_PERSON_MANAGE WHERE MSG_PUSH_ID = #{id}
    </select>


                                            
</mapper>
