티스토리 뷰
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package com.lambda.web.proxy;
import com.lambda.web.mappers.MovieMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Pager {
@Autowired MovieMapper movieMapper;
private int rowCount, pageCount, blockCount,
rowStart, pageStart, prevBlock,
rowEnd, pageEnd, nextBlock,
pageSize, blockSize,
pageNow, blockNow;
public void paging(){
rowCount = 50;
rowStart = pageNow * pageSize; // 0
rowEnd = rowStart + (pageSize-1); // 4
pageCount = rowCount / pageSize ; // 10
pageStart = blockNow * blockSize; // 0
pageEnd = pageStart + (blockSize - 1); // 4
pageSize = 5;
pageNow = 0;
blockCount = pageCount / blockSize ; // 2
prevBlock = pageStart - blockSize; // 0
nextBlock = pageStart + blockSize; // 1
blockSize = 5;
blockNow = pageNow / blockSize; // 0
}
}
|
cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package com.lambda.web.proxy;
import com.lambda.web.mappers.MovieMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Pager {
@Autowired MovieMapper movieMapper;
private int rowCount, pageCount, blockCount,
rowStart, pageStart, prevBlock,
rowEnd, pageEnd, nextBlock,
pageSize, blockSize,
pageNow, blockNow;
public void paging(){
rowCount = 52;
rowStart = pageNow * pageSize; // 0
rowEnd = () ? :rowStart + (pageSize-1); // 4
pageCount = () ? :rowCount / pageSize ; // 10
pageStart = blockNow * blockSize; // 0
pageEnd = () ? :pageStart + (blockSize - 1); // 4
pageSize = 5;
pageNow = 0;
blockCount = () ? :pageCount / blockSize ; // 2
prevBlock = pageStart - blockSize; // 0
nextBlock = pageStart + blockSize; // 1
blockSize = 5;
blockNow = pageNow / blockSize; // 0
}
}
|
cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package com.lambda.web.proxy;
import com.lambda.web.mappers.MovieMapper;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Data
@Component
public class Pager {
@Autowired MovieMapper movieMapper;
private int rowCount, pageCount, blockCount,
rowStart, pageStart, prevBlock,
rowEnd, pageEnd, nextBlock,
pageSize, blockSize,
pageNow, blockNow;
public void paging(){
rowCount = movieMapper.count();
rowStart = pageNow * pageSize;
rowEnd = (pageNow != (pageCount -1)) ? rowStart + (pageSize-1): rowCount - 1;
pageCount = (rowCount % pageSize != 0) ? rowCount / pageSize +1 :rowCount / pageSize ;
pageStart = blockNow * blockSize;
pageEnd = (blockNow != (blockCount -1)) ? pageStart + (blockSize - 1): pageCount - 1;
// pageSize = 5;
// pageNow = 0;
blockCount = (pageCount % blockSize != 0) ? pageCount / blockSize +1:pageCount / blockSize ;
prevBlock = pageStart - blockSize;
nextBlock = pageStart + blockSize;
// blockSize = 5;
blockNow = pageNow / blockSize;
}
}
|
cs |
'1. 자바' 카테고리의 다른 글
자바/스프링/2020-06-25/ 타일즈 설정 (0) | 2020.06.25 |
---|---|
(토쿄) 조세핀> JSP 에서 JSTL 과 EL (0) | 2020.06.25 |
자바/인텔리제이/2020-05-28/ 선택한 부분 일괄 변경시키기 CTRL + SHIFT + R (replace) (0) | 2020.05.28 |
중고차 판매웹 JPA Entities (0) | 2020.05.27 |
자바/이클립스/2020-05-24/ 톰캣 깨끗이 삭제 하기 (0) | 2020.05.24 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- vscode
- tensorflow
- SQLAlchemy
- mariadb
- COLAB
- SpringBoot
- JUnit
- intellij
- React
- Mlearn
- Django
- springMVC
- Java
- FLASK
- Oracle
- Mongo
- nodejs
- KAFKA
- jQuery
- Git
- ERD
- Python
- Algorithm
- docker
- AWS
- maven
- terms
- Eclipse
- JPA
- database
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함