<?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="MobileNotice">

    <select id="selectTotalNoticeCount" parameterType="hashmap" resultType="hashmap">
        SELECT COUNT(*)  AS "totalCount"
          FROM MU_APP_NOTICE AS MN
         WHERE MN.USE_YN = 'Y'
    </select>

    <select id="selectListNotice" parameterType="hashmap" resultType="hashmap">
        SELECT MN.MU_APP_NOTICE_ID                        AS "muNoticeId"
              ,MN.TITLE                                   AS "title"
              ,DATE_FORMAT(MN.WRITE_DATE, '%Y-%m-%d')     AS "writeDate"
          FROM MU_APP_NOTICE AS MN
         WHERE MN.USE_YN = 'Y'
      ORDER BY MN.WRITE_DATE DESC
              ,MN.WRITE_TIME DESC
    </select>

    <select id="selectNotice" parameterType="hashmap" resultType="hashmap">
        SELECT MN.TITLE                               AS "title"
             , MN.CONTENT                             AS "content"
             , DATE_FORMAT(MN.WRITE_DATE, '%Y-%m-%d') AS "writeDate"
             , DATE_FORMAT(MN.WRITE_TIME, '%H:%i')    AS "writeTime"
          FROM MU_APP_NOTICE AS MN
         WHERE MN.USE_YN        = 'Y'
           AND MN.MU_APP_NOTICE_ID  = #{muNoticeId}
         LIMIT 0, 1
    </select>
</mapper>