
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
<?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.takensoft.taken_bi_manager.community.dao.NoticeDAO">
<!-- 공지사항 resultMap -->
<resultMap id="noticeResult" type="NoticeVO">
<result property="noticeId" column="notice_id"/>
<result property="noticeTitle" column="notice_title"/>
<result property="noticeContent" column="notice_content"/>
<result property="noticeIsFix" column="notice_is_fix"/>
<result property="noticeIsUse" column="notice_is_use"/>
<result property="noticeHits" column="notice_hits"/>
<result property="noticeInsertUserId" column="notice_insert_user_id"/>
<result property="noticeInsertDatetime" column="notice_insert_datetime"/>
<result property="noticeUpdateUserId" column="notice_update_user_id"/>
<result property="noticeUpdateDatetime" column="notice_update_datetime"/>
<result property="fileManagerId" column="file_manager_id"/>
</resultMap>
<!-- 공지사항 목록 조회 -->
<select id="selectNoticeList" parameterType="SearchVO" resultMap="noticeResult">
SELECT notice_id
, notice_title
, notice_content
, notice_is_fix
, notice_is_use
, notice_hits
, notice_insert_user_id
, notice_insert_datetime
, notice_update_user_id
, notice_update_datetime
, file_manager_id
FROM cmmnty_notice
WHERE notice_is_use = 1
<!-- S.검색 영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<when test="item.type == 'dates'">
AND #{item.value}::timestamp <![CDATA[<=]]> ${item.key}::timestamp
AND ${item.key2}::timestamp <![CDATA[<]]> #{item.value2}::timestamp + INTERVAL '1' DAY
</when>
<when test="item.key != null and item.key !='' and item.value != null and item.value != ''">
AND ${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
<when test="item.key == null and item.value != null and item.value !=''">
AND (
notice_title LIKE CONCAT('%', #{item.value}, '%')
OR notice_content LIKE CONCAT('%', #{item.value}, '%')
)
</when>
</choose>
</foreach>
<!-- E.검색 영역 -->
ORDER BY notice_insert_datetime DESC
LIMIT #{perPage} OFFSET ((#{currentPage} - 1) * #{perPage})
</select>
<!-- 공지사항 개수 조회 -->
<select id="selectNoticeCount" parameterType="SearchVO">
SELECT COUNT(*)
FROM cmmnty_notice
WHERE notice_is_use = 1
<!-- S.검색 영역 -->
<foreach item="item" index="index" collection="searchObjectList">
<choose>
<when test="item.type == 'dates'">
AND #{item.value}::timestamp <![CDATA[<=]]> ${item.key}::timestamp
AND ${item.key2}::timestamp <![CDATA[<]]> #{item.value2}::timestamp + INTERVAL '1' DAY
</when>
<when test="item.key != null and item.key !='' and item.value != null and item.value != ''">
AND ${item.key} LIKE CONCAT('%', #{item.value}, '%')
</when>
<when test="item.key == null and item.value != null and item.value !=''">
AND (
notice_title LIKE CONCAT('%', #{item.value}, '%')
OR notice_content LIKE CONCAT('%', #{item.value}, '%')
)
</when>
</choose>
</foreach>
<!-- E.검색 영역 -->
</select>
<!-- 공지사항 상세 조회 -->
<select id="selectNoticeById" parameterType="String" resultMap="noticeResult">
SELECT notice_id
, notice_title
, notice_content
, notice_is_fix
, notice_is_use
, notice_hits
, notice_insert_user_id
, notice_insert_datetime
, notice_update_user_id
, notice_update_datetime
, file_manager_id
FROM cmmnty_notice
WHERE notice_is_use = 1
AND notice_id = #{noticeId}
</select>
<!-- 공지사항 등록 -->
<insert id="insertNotice" parameterType="NoticeVO">
INSERT INTO cmmnty_notice (
notice_id,
notice_title,
notice_content,
notice_is_fix,
notice_is_use,
notice_hits,
notice_insert_user_id,
notice_insert_datetime,
file_manager_id
) VALUES (
#{noticeId},
#{noticeTitle},
#{noticeContent},
#{noticeIsFix},
#{noticeIsUse},
#{noticeHits},
#{noticeInsertUserId},
NOW(),
#{fileManagerId}
)
</insert>
<!-- 공지사항 수정 -->
<update id="updateNotice" parameterType="NoticeVO">
UPDATE cmmnty_notice
SET notice_title = #{noticeTitle},
notice_content = #{noticeContent},
notice_is_fix = #{noticeIsFix},
notice_is_use = #{noticeIsUse},
notice_hits = #{noticeHits},
notice_update_user_id = #{noticeUpdateUserId},
notice_update_datetime = NOW(),
file_manager_id = #{fileManagerId}
WHERE notice_id = #{noticeId}
</update>
<!-- 공지사항 조회수 수정 -->
<update id="updateNoticeHits" parameterType="NoticeVO">
UPDATE cmmnty_notice
SET notice_hits = cmmnty_notice.notice_hits + 1
WHERE notice_id = #{noticeId}
</update>
<!-- 공지사항 조회수 수정 -->
<update id="deleteNotice" parameterType="NoticeVO">
UPDATE cmmnty_notice
SET notice_is_use = 0
WHERE notice_id = #{noticeId}
</update>
</mapper>