Skip to content

Commit 9d173bb

Browse files
committed
mybatis_pagehelper
1 parent f765da3 commit 9d173bb

File tree

25 files changed

+291
-20
lines changed

25 files changed

+291
-20
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package pojo;
2+
3+
import java.util.List;
4+
5+
/**
6+
* Created by wistbean on 2019/1/8.
7+
*/
8+
public class EasyGrid {
9+
10+
private int total;
11+
private List<?> rows;
12+
13+
public int getTotal() {
14+
return total;
15+
}
16+
17+
public void setTotal(int total) {
18+
this.total = total;
19+
}
20+
21+
public List<?> getRows() {
22+
return rows;
23+
}
24+
25+
public void setRows(List<?> rows) {
26+
this.rows = rows;
27+
}
28+
}
855 Bytes
Binary file not shown.
540 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven
2-
#Mon Oct 15 18:16:26 CST 2018
2+
#Tue Jan 08 20:52:07 CST 2019
33
version=1.0-SNAPSHOT
44
groupId=com.kendinghui
55
artifactId=manong_common
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pojo\EasyUITree.class
2+
pojo\EasyGrid.class
23
pojo\ResponseJsonResult.class
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
G:\manong\manong_common\src\main\java\pojo\ResponseJsonResult.java
2-
G:\manong\manong_common\src\main\java\pojo\EasyUITree.java
1+
F:\githubproject\manong\manong_common\src\main\java\pojo\ResponseJsonResult.java
2+
F:\githubproject\manong\manong_common\src\main\java\pojo\EasyGrid.java
3+
F:\githubproject\manong\manong_common\src\main\java\pojo\EasyUITree.java

manong_manager/manong_manager_service/manong_manager_service.iml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.1.3.RELEASE" level="project" />
4242
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.1.3.RELEASE" level="project" />
4343
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
44-
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.1.3.RELEASE" level="project" />
4544
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.1.3.RELEASE" level="project" />
4645
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
4746
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.1.3.RELEASE" level="project" />
@@ -51,6 +50,9 @@
5150
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.4" level="project" />
5251
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.1.3.RELEASE" level="project" />
5352
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.1.3.RELEASE" level="project" />
53+
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.1.3.RELEASE" level="project" />
5454
<orderEntry type="module" module-name="manong_common" />
55+
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:4.1.1" level="project" />
56+
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:0.9.4" level="project" />
5557
</component>
5658
</module>

manong_manager/manong_manager_service/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,18 @@
4242
<groupId>org.springframework</groupId>
4343
<artifactId>spring-beans</artifactId>
4444
</dependency>
45+
4546
<dependency>
4647
<groupId>com.kendinghui</groupId>
4748
<artifactId>manong_common</artifactId>
4849
<version>1.0-SNAPSHOT</version>
4950
</dependency>
51+
52+
<dependency>
53+
<groupId>com.github.pagehelper</groupId>
54+
<artifactId>pagehelper</artifactId>
55+
</dependency>
56+
5057
</dependencies>
5158

5259
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.manong.service;
22

33
import com.manong.pojo.Product;
4+
import pojo.EasyGrid;
45
import pojo.ResponseJsonResult;
56

67
/**
78
* Created by wistbean on 2019/1/5.
89
*/
910
public interface ProductService {
1011
ResponseJsonResult saveProduct(Product product);
12+
EasyGrid listProduct(int pages,int rows);
1113
}

manong_manager/manong_manager_service/src/main/java/com/manong/service/impl/ProductServiceImpl.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
package com.manong.service.impl;
22

3+
import com.github.pagehelper.PageHelper;
4+
import com.github.pagehelper.PageInfo;
35
import com.manong.mapper.ProductMapper;
46
import com.manong.pojo.Product;
7+
import com.manong.pojo.ProductExample;
58
import com.manong.service.ProductService;
69
import org.springframework.beans.factory.annotation.Autowired;
710
import org.springframework.stereotype.Service;
11+
import pojo.EasyGrid;
812
import pojo.ResponseJsonResult;
913

14+
import java.util.List;
15+
1016
/**
1117
* Created by wistbean on 2019/1/5.
1218
*/
@@ -27,4 +33,20 @@ public ResponseJsonResult saveProduct(Product product) {
2733

2834
return responseJsonResult;
2935
}
36+
37+
@Override
38+
public EasyGrid listProduct(int pages, int rows) {
39+
40+
ProductExample productExample = new ProductExample();
41+
PageHelper.startPage(pages,rows);
42+
List<Product> productList = productMapper.selectByExample(productExample);
43+
44+
PageInfo<Product> pageInfo = new PageInfo<>(productList);
45+
46+
EasyGrid easyGrid = new EasyGrid();
47+
easyGrid.setTotal((int) pageInfo.getTotal());
48+
easyGrid.setRows(productList);
49+
50+
return easyGrid;
51+
}
3052
}

0 commit comments

Comments
 (0)