From 65fe60fe57b5dc40656cc414bb6813e96f875eca Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Fri, 10 May 2024 10:45:05 +0900 Subject: [PATCH] =?UTF-8?q?dateDiff(..)=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/foundation/AbstractComponent.java | 10 ++++++++++ .../cokr/xit/foundation/web/AbstractController.java | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/cokr/xit/foundation/AbstractComponent.java b/src/main/java/cokr/xit/foundation/AbstractComponent.java index 25af1e4..2d04fd9 100644 --- a/src/main/java/cokr/xit/foundation/AbstractComponent.java +++ b/src/main/java/cokr/xit/foundation/AbstractComponent.java @@ -1,5 +1,6 @@ package cokr.xit.foundation; +import java.util.Date; import java.util.function.Supplier; import javax.annotation.Resource; @@ -202,6 +203,15 @@ public class AbstractComponent { return isEmpty(logName) ? log(getClass()) : Log.get(logName); } + /**주어진 Date에 지정한 날짜수만큼의 차이의 Date를 반환한다. + * @param date 날짜 + * @param days 날짜수 + * @return 새 Date + */ + protected static Date dateDiff(Date date, int days) { + return new Date(date.getTime() + (1000L * 60L * 60L * 24L * days)); + } + /**현재 객체를 반환한다. * @param AbstractComponent 유형 * @return 현재 객체 diff --git a/src/main/java/cokr/xit/foundation/web/AbstractController.java b/src/main/java/cokr/xit/foundation/web/AbstractController.java index 6b6d49d..ec025d1 100644 --- a/src/main/java/cokr/xit/foundation/web/AbstractController.java +++ b/src/main/java/cokr/xit/foundation/web/AbstractController.java @@ -142,7 +142,6 @@ public abstract class AbstractController extends AbstractComponent { * @return ModelAndView */ protected ModelAndView setCollectionInfo(ModelAndView mav, Collection collection, String prefixKey, String prefix) { - boolean toJson = !"jsonView".equals(mav.getViewName()); mav.addObject(prefixKey, prefix) .addObject(prefix + "List", collection) .addObject(prefix + "Start", 0)