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

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

@@ -3,7 +3,14 @@ package app.module.front.usecase.info;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn;
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd;
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -14,8 +21,24 @@ class GetInfoUIController {
private final GetHouseholdPortIn getHouseholdPortIn;
private final GetNoticesPortIn getNoticesPortIn;
@GetMapping(path = "/info")
String operate(Model model) {
String operate(Model model
,@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC, page = 0, size = 5) Pageable pageable) {
//공지사항
Page<GetNotices> notices =
getNoticesPortIn.operate(
pageable,
new GetNoticesCmd(null, null, "true"));
model.addAttribute("notice", notices.hasContent()
? notices.getContent().get(0)
: null);
//TODO 일계부를 등록하지 않은 날짜 처리 필요
boolean isUnregisteredDate = false;

View File

@@ -0,0 +1,36 @@
package app.module.front.usecase.info.notice.getNoticeUI.adapters.web;
import app.module.core.usecase.notice.getNotice.ports.GetNoticePortIn;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO;
import app.module.front.usecase.info.notice.getNoticeUI.adapters.web.model.GetNoticeUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
@RequiredArgsConstructor
class GetNoticeUIController {
private final GetNoticePortIn getNoticePortIn;
@GetMapping(path = "/info/notice/{id}")
String operate(@PathVariable Long id, Model model, GetNoticeUIReqVO reqVO) {
reqVO.setId(id);
model.addAttribute("notice", getNoticePortIn.operate(
new GetNoticeCmd(
reqVO.getId(),"true")).orElse(null));
return "info/notice/{id}";
}
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.info.notice.getNoticeUI.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetNoticeUIReqVO {
private long id;
}

View File

@@ -1,9 +1,20 @@
package app.module.front.usecase.info.notice.getNoticesUI.adapters.web;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticles;
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticlesCmd;
import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn;
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd;
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO;
import app.module.front.usecase.info.notice.getNoticesUI.adapters.web.model.GetNoticesReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -12,13 +23,21 @@ import org.springframework.web.bind.annotation.GetMapping;
@RequiredArgsConstructor
class GetNoticesUIController {
private final GetHouseholdPortIn getHouseholdPortIn;
private final GetNoticesPortIn getNoticesPortIn;
@GetMapping(path = "/info/notice")
String operate(Model model) {
String operate(Model model, @PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC, page = 0, size = 5) Pageable pageable, GetNoticesReqVO reqVO) {
reqVO.setSearchOpen("true");
Page<GetNotices> notices =
getNoticesPortIn.operate(
pageable,
new GetNoticesCmd(
reqVO.getSearchField(), reqVO.getSearchValue(), reqVO.getSearchOpen()));
model.addAttribute("notices", notices);
model.addAttribute("userInfo",
getHouseholdPortIn.operate(new GetHouseholdCmd(CommonUtil.getLoginUsername())).orElseThrow());
return "info/notice/notices";
}

View File

@@ -0,0 +1,17 @@
package app.module.front.usecase.info.notice.getNoticesUI.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetNoticesReqVO {
private String searchField;
private String searchValue;
private String searchOpen;
}