Files
korea-research/admin/src/main/resources/mappers/notice/GetNoticeMapper.xml
2025-06-18 20:52:21 +09:00

49 lines
1.7 KiB
XML

<?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="app.module.admin.usecase.communication.notice.getNotice.adapters.persistence.GetNoticeMapper">
<select id="getNotice"
resultType="app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNotice">
/* getNotice 상세 게시글 조회 */
<if test="id != null">
SELECT
a.id AS id,
a.title AS title,
a.content AS content,
a.visible AS visible,
a.start_date AS startDate,
a.end_date AS endDate,
a.created_at AS createdAt,
a.created_by AS createdBy,
a.updated_at AS updatedAt,
a.updated_by AS updatedBy
FROM notice a
WHERE a.id = #{id}
AND a.is_deleted = false
</if>
</select>
<select id="getUploadFiles"
resultType="app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeUploadFile">
/* getUploadFiles 상세 게시글 조회 시, 첨부파일 조회 */
SELECT
awuf.notice_id AS noticeId,
awuf.upload_files_id AS uploadfileId,
uf.id AS id,
uf.created_at AS createdAt,
uf.created_by AS createdBy,
uf.updated_at AS updatedAt,
uf.updated_by AS updatedBy,
uf.file_length AS fileLength,
uf.name AS name,
uf.origin_name AS originName,
uf.path AS path,
uf.type AS type
FROM notice_has_upload_file awuf
INNER JOIN upload_file uf
ON awuf.upload_files_id = uf.id
WHERE awuf.notice_id = #{id} AND awuf.is_deleted = false
</select>
</mapper>