내정보 공지사항 : 검색 제외

This commit is contained in:
DESKTOP-E9DJS27\etribe
2025-06-14 15:45:37 +09:00
parent 75f1d1eb23
commit 966cca98cf
20 changed files with 329 additions and 123 deletions

View File

@@ -23,7 +23,7 @@ class GetNoticeDao implements GetNoticePortOut {
@Override
@Transactional
public Optional<GetNotice> operate(GetNoticeCmd command) {
GetNotice secArticle = mapper.getNotice(command.getId());
GetNotice secArticle = mapper.getNotice(command);
List<GetNoticeUploadFile> setArticleUploadFile =
mapper.getUploadFiles(command.getId());

View File

@@ -1,6 +1,7 @@
package app.module.core.usecase.notice.getNotice.adapters.persistence;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNotice;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
import org.apache.ibatis.annotations.Mapper;
@@ -8,6 +9,8 @@ import java.util.List;
@Mapper
public interface GetNoticeMapper {
GetNotice getNotice(Long id);
GetNotice getNotice(GetNoticeCmd command);
List<GetNoticeUploadFile> getUploadFiles(Long id);
}

View File

@@ -24,4 +24,8 @@ public class GetNotice {
private LocalDateTime updatedAt;
private String updatedBy;
private List<GetNoticeUploadFile> uploadFiles;
public boolean getNewDate() {
LocalDateTime now = LocalDateTime.now();
return now.toLocalDate().isEqual(createdAt.toLocalDate());
}
}

View File

@@ -10,6 +10,6 @@ import lombok.Setter;
@AllArgsConstructor
@EqualsAndHashCode
public class GetNoticeCmd {
private Long id;
private String searchOpen;
}

View File

@@ -39,7 +39,7 @@ class GetNoticesDao implements GetNoticesPortOut {
mapper.getUploadFiles(
contents.stream().map(GetNoticesDto::getId)
.collect(Collectors.toList()),
FileUploadType.EXAMPLE_REP));
FileUploadType.NOTICE));
return new PageImpl<>(
contents.stream()
@@ -49,6 +49,8 @@ class GetNoticesDao implements GetNoticesPortOut {
article.getId(),
article.getUpdatedBy(),
article.getUpdatedAt(),
article.getCreatedBy(),
article.getCreatedAt(),
article.getTitle(),
article.getContent(),
article.getVisible(),

View File

@@ -13,6 +13,8 @@ public class GetNoticesDto {
private Long id;
private String updatedBy;
private LocalDateTime updatedAt;
private String createdBy;
private LocalDateTime createdAt;
private String title;
private String content;
private Boolean visible;

View File

@@ -15,10 +15,17 @@ public class GetNotices {
private Long id;
private String updatedBy;
private LocalDateTime updatedAt;
private String createdBy;
private LocalDateTime createdAt;
private String title;
private String content;
private Boolean visible;
private LocalDateTime startDate;
private LocalDateTime endDate;
private GetNoticeFiles uploadFile;
public boolean getNewDate() {
LocalDateTime now = LocalDateTime.now();
return now.toLocalDate().isEqual(createdAt.toLocalDate());
}
}

View File

@@ -21,6 +21,17 @@
FROM notice a
WHERE a.id = #{id}
AND a.is_deleted = false
<if test="searchOpen != null and searchOpen != ''">
<choose>
<when test="searchOpen eq 'true'">
AND a.visible = true
</when>
<when test="searchOpen eq 'false'">
AND a.visible = false
</when>
</choose>
</if>
</if>
</select>

View File

@@ -11,6 +11,8 @@
a.id,
a.updated_by,
a.updated_at,
a.created_by,
a.created_at,
a.title,
a.content,
a.visible,
@@ -52,6 +54,9 @@
<when test="order.property eq 'endDate'">a.end_date</when>
<when test="order.property eq 'updatedBy'">a.updated_by</when>
<when test="order.property eq 'updatedAt'">a.updated_at</when>
<when test="order.property eq 'createdBy'">a.created_by</when>
<when test="order.property eq 'createdAt'">a.created_at</when>
<otherwise>a.id</otherwise>
</choose>
<choose>
<when test="order.direction.toString() eq 'DESC'">DESC</when>