Przeglądaj źródła

TsfPageRequest 삭제 및 TscPageRequest로 변경

gagamel 5 lat temu
rodzic
commit
f3f31cf97a

+ 0 - 120
src/main/java/com/style24/persistence/TsfPageRequest.java

@@ -1,120 +0,0 @@
-package com.style24.persistence;
-
-import java.io.Serializable;
-
-import lombok.Data;
-
-/**
- * Paging
- * @author gagamel
- * @since 2020. 2. 14
- */
-@SuppressWarnings("serial")
-@Data
-public class TsfPageRequest implements Serializable {
-
-	private final int pageNo;   // 페이지번호
-	private final int pageSize; // 조회할 row수
-	private final int pageUnit; // 그룹핑 페이지 단위
-	private int totalCount = 0; // 전체 row 건수
-
-	public TsfPageRequest(int pageNo, int pageSize) {
-		this(pageNo, pageSize, 10);
-	}
-
-	public TsfPageRequest(int pageNo, int pageSize, int pageUnit) {
-		if (pageNo < 0) {
-			throw new IllegalArgumentException("Current page index must not be less than zero!");
-		}
-
-		if (pageSize < 1) {
-			throw new IllegalArgumentException("Page size must not be less than one!");
-		}
-
-		if (pageUnit < 1) {
-			throw new IllegalArgumentException("Page unit must not be less than one!");
-		}
-
-		this.pageNo = pageNo;
-		this.pageSize = pageSize;
-		this.pageUnit = pageUnit;
-	}
-
-	public int getPageNo() {
-		return pageNo + 1;
-	}
-
-	public int getOffset() {
-		return pageNo * pageSize;
-	}
-
-	public int getStartRow() {
-		return pageNo * pageSize + 1;
-	}
-
-	public int getEndRow() {
-		return getOffset() + pageSize;
-	}
-
-	public int getPageGroup() {
-		return pageNo / pageUnit + 1;
-	}
-
-	public void setTotalCount(int totalCount) {
-		this.totalCount = totalCount;
-	}
-
-	public int getTotalPage() {
-		int totalPage = totalCount / pageSize;
-		if (totalCount % pageSize > 0) totalPage++;
-		return totalPage;
-	}
-
-	public String getGeneratedPagination() {
-		int firstCount = (getPageGroup() - 1) * pageUnit + 1;
-		int loopCount = firstCount + pageUnit;
-		if (loopCount > getTotalPage()) loopCount = getTotalPage() + 1;
-
-		StringBuffer pageTag = new StringBuffer();
-
-		if (getPageNo() == 1) {
-			pageTag.append("<a href=\"#\" class=\"icon first\" alt=\"처음 페이지\">처음 페이지</a>\n");
-		} else {
-			pageTag.append("<a href=\"#pageNo=1\" class=\"icon first\" alt=\"처음 페이지\">처음 페이지</a>\n");
-		}
-
-		if (getPageGroup() == 1) {
-			pageTag.append("<a href=\"#\" class=\"icon prev\" alt=\"이전페이지\">이전 페이지</a>\n");
-		} else {
-			pageTag.append("<a href=\"#pageNo=").append((getPageGroup() - 1) * pageUnit).append("\" class=\"icon prev\" alt=\"이전페이지\">이전 페이지</a>\n");
-		}
-
-		for (int i = firstCount; i < loopCount; i++) {
-			if (getPageNo() == i) {
-				pageTag.append("<a class=\"num on\" href=\"#\">").append(i).append("</a>\n");
-			} else {
-				pageTag.append("<a class=\"num\" href=\"#pageNo=").append(i).append("\">").append(i).append("</a>\n");
-			}
-		}
-
-		if (loopCount <= (getTotalPage() + 1)) {
-			if (getPageNo() == getTotalPage() || getTotalPage()<=(getPageGroup() * pageUnit)) {
-				//				pageTag.append("<a href=\"#\" class=\"icon next\" alt=\"다음 페이지\">다음 페이지</a>\n");
-				//				pageTag.append("<a href=\"#\" class=\"icon last\" alt=\"마지막 페이지\">마지막 페이지</a>\n");
-				pageTag.append("<a href=\"#pageNo=").append(getPageNo()).append("\" class=\"icon next\" alt=\"다음 페이지\">다음 페이지</a>\n");
-				pageTag.append("<a href=\"#pageNo=").append(getPageNo()).append("\" class=\"icon last\" alt=\"마지막 페이지\">마지막 페이지</a>\n");
-			} else {
-				pageTag.append("<a href=\"#pageNo=").append(getPageGroup() * pageUnit + 1).append("\" class=\"icon next\" alt=\"다음 페이지\">다음 페이지</a>\n");
-				pageTag.append("<a href=\"#pageNo=").append(getTotalPage()).append("\" class=\"icon last\" alt=\"마지막 페이지\">마지막 페이지</a>\n");
-			}
-		}
-
-		return pageTag.toString();
-	}
-
-	@Override
-	public String toString() {
-		return String.format("Page request [pageNo: %d, pageSize %d, pageUnit %d]", getPageNo(), pageSize, pageUnit);
-	}
-
-}

+ 2 - 2
src/main/java/com/style24/persistence/domain/Counsel.java

@@ -2,7 +2,7 @@ package com.style24.persistence.domain;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.style24.persistence.TscBaseDomain;
-import com.style24.persistence.TsfPageRequest;
+import com.style24.persistence.TscPageRequest;
 
 import lombok.Data;
 
@@ -55,7 +55,7 @@ public class Counsel extends TscBaseDomain {
 
 	// Pagination
 	@JsonInclude(JsonInclude.Include.NON_EMPTY)
-	private TsfPageRequest pageable;
+	private TscPageRequest pageable;
 
 	private int pageNo = 1;
 	private int pageSize = 10;

+ 2 - 2
src/main/java/com/style24/persistence/domain/Faq.java

@@ -2,7 +2,7 @@ package com.style24.persistence.domain;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.style24.persistence.TscBaseDomain;
-import com.style24.persistence.TsfPageRequest;
+import com.style24.persistence.TscPageRequest;
 
 import lombok.Data;
 
@@ -29,7 +29,7 @@ public class Faq extends TscBaseDomain {
 
 	// Pagination
 	@JsonInclude(JsonInclude.Include.NON_EMPTY)
-	private TsfPageRequest pageable;
+	private TscPageRequest pageable;
 
 	private int pageNo = 1;
 	private int pageSize = 10;

+ 2 - 2
src/main/java/com/style24/persistence/domain/Notice.java

@@ -2,7 +2,7 @@ package com.style24.persistence.domain;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.style24.persistence.TscBaseDomain;
-import com.style24.persistence.TsfPageRequest;
+import com.style24.persistence.TscPageRequest;
 
 import lombok.Data;
 
@@ -37,7 +37,7 @@ public class Notice extends TscBaseDomain {
 
 	// Pagination
 	@JsonInclude(JsonInclude.Include.NON_EMPTY)
-	private TsfPageRequest pageable;
+	private TscPageRequest pageable;
 
 	private int pageNo = 1;
 	private int pageSize = 10;