Skip to content

Commit

Permalink
[Add] merge mypages-spring-boot-starter into mypages
Browse files Browse the repository at this point in the history
  • Loading branch information
yihleego committed Aug 10, 2020
1 parent 59816c4 commit c09e875
Show file tree
Hide file tree
Showing 58 changed files with 1,174 additions and 555 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ build/
nbbuild/
nbdist/
.nb-gradle/

### custom ###
logs
*.log
7 changes: 4 additions & 3 deletions README.ZH_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ mvn clean install

```xml
<properties>
<mypages.version>0.5.0</mypages.version>
<mypages.version>0.6.0</mypages.version>
</properties>

<dependency>
Expand All @@ -31,7 +31,7 @@ $ mvn clean install
### Gradle

```xml
implementation 'io.leego:mypages:0.5.0'
implementation 'io.leego:mypages:0.6.0'
```

## 数据库
Expand All @@ -48,7 +48,8 @@ implementation 'io.leego:mypages:0.5.0'

> * [User Guide (English)](docs/USERGUIDE.md)
> * [用户指南 (中文版)](docs/USERGUIDE.ZH_CN.md)
> * [MyPages Spring Boot Starter](https://github.com/yihleego/mypages-spring-boot-starter)
> * [MyPages-Spring-Boot-Starter (English)](docs/STARTER_USERGUIDE.md)
> * [MyPages-Spring-Boot-Starter (中文版)](docs/STARTER_USERGUIDE.ZH_CN.md)
## 交流

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ mvn clean install

```xml
<properties>
<mypages.version>0.5.0</mypages.version>
<mypages.version>0.6.0</mypages.version>
</properties>

<dependency>
Expand All @@ -32,7 +32,7 @@ $ mvn clean install
### Gradle

```xml
implementation 'io.leego:mypages:0.5.0'
implementation 'io.leego:mypages:0.6.0'
```

## Supported
Expand All @@ -49,7 +49,8 @@ implementation 'io.leego:mypages:0.5.0'

> * [User Guide (English)](docs/USERGUIDE.md)
> * [用户指南 (中文版)](docs/USERGUIDE.ZH_CN.md)
> * [MyPages Spring Boot Starter](https://github.com/yihleego/mypages-spring-boot-starter)
> * [MyPages-Spring-Boot-Starter (English)](docs/STARTER_USERGUIDE.md)
> * [MyPages-Spring-Boot-Starter (中文版)](docs/STARTER_USERGUIDE.ZH_CN.md)
## Contact

Expand Down
92 changes: 92 additions & 0 deletions docs/STARTER_USERGUIDE.ZH_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 1. 简介

MyPages是Java实现基于[MyBatis](https://github.com/mybatis/mybatis-3)的开源分页插件,最大程度简化数据库分页查询操作,支持市面上大部分数据库,如:MySQL、PostgreSQL、Oracle、SQLServer等。

# 2. 准备工作

请确保您的Java版本在1.8及以上。

# 3. 依赖

## Maven

```xml
<properties>
<mypages-spring-boot-starter.version>0.6.0</mypages-spring-boot-starter.version>
</properties>

<dependency>
<groupId>io.leego</groupId>
<artifactId>mypages-spring-boot-starter</artifactId>
<version>${mypages-spring-boot-starter.version}</version>
</dependency>
```

## Gradle

```xml
implementation 'io.leego:mypages-spring-boot-starter:0.6.0'
```

# 4. 配置

使用分页参数定义一个类,并配置参数字段名。

```java
public class Pageable {
private Integer page;
private Integer size;
private Integer offset;
private Integer rows;
private String countExpr;
private String countMethodName;
private boolean enableCount;
/* getter setter */
}
```

请注意sql-dialect,它可以是任何SqlDialect且必须被配置。

## Properties

```properties
spring.mypages.enabled=true
spring.mypages.sql-dialect=MYSQL
spring.mypages.count-expr=*
spring.mypages.page-field=page
spring.mypages.size-field=size
spring.mypages.offset-field=offset
spring.mypages.rows-field=rows
spring.mypages.count-expr-field=countExpr
spring.mypages.count-method-name-field=countMethodName
spring.mypages.enable-count-field=enableCount
spring.mypages.skip-query-if-count-equals-zero=true
spring.mypages.use-generated-if-count-method-is-missing=true
spring.mypages.default-page=1
spring.mypages.default-size=10
spring.mypages.max-page=10000
spring.mypages.max-size=10000
```

## Yaml

```yaml
spring:
mypages:
enabled: true
sql-dialect: MYSQL
count-expr: '*'
page-field: page
size-field: size
offset-field: offset
rows-field: rows
count-expr-field: countExpr
count-method-name-field: countMethodName
enable-count-field: enableCount
skip-query-if-count-equals-zero: true
use-generated-if-count-method-is-missing: true
default-page: 1
default-size: 10
max-page: 10000
max-size: 10000
```
92 changes: 92 additions & 0 deletions docs/STARTER_USERGUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 1. Introduction

MyPages is a java based, open source pagination plugin for [MyBatis](https://github.com/mybatis/mybatis-3) that simplifies database paging queries.

# 2. Getting Started

Please make sure the Java version is 1.8 and above.

# 3. Dependency

## Maven

```xml
<properties>
<mypages-spring-boot-starter.version>0.6.0</mypages-spring-boot-starter.version>
</properties>

<dependency>
<groupId>io.leego</groupId>
<artifactId>mypages-spring-boot-starter</artifactId>
<version>${mypages-spring-boot-starter.version}</version>
</dependency>
```

## Gradle

```xml
implementation 'io.leego:mypages-spring-boot-starter:0.6.0'
```

# 4. Configuration

Define a class with paging parameters, and configure parameters field names.

```java
public class Pageable {
private Integer page;
private Integer size;
private Integer offset;
private Integer rows;
private String countExpr;
private String countMethodName;
private boolean enableCount;
/* getter setter */
}
```

Notice that the sql-dialect is required. It can be any SqlDialect and should be configured.

## Properties

```properties
spring.mypages.enabled=true
spring.mypages.sql-dialect=MYSQL
spring.mypages.count-expr=*
spring.mypages.page-field=page
spring.mypages.size-field=size
spring.mypages.offset-field=offset
spring.mypages.rows-field=rows
spring.mypages.count-expr-field=countExpr
spring.mypages.count-method-name-field=countMethodName
spring.mypages.enable-count-field=enableCount
spring.mypages.skip-query-if-count-equals-zero=true
spring.mypages.use-generated-if-count-method-is-missing=true
spring.mypages.default-page=1
spring.mypages.default-size=10
spring.mypages.max-page=10000
spring.mypages.max-size=10000
```

## Yaml

```yaml
spring:
mypages:
enabled: true
sql-dialect: MYSQL
count-expr: '*'
page-field: page
size-field: size
offset-field: offset
rows-field: rows
count-expr-field: countExpr
count-method-name-field: countMethodName
enable-count-field: enableCount
skip-query-if-count-equals-zero: true
use-generated-if-count-method-is-missing: true
default-page: 1
default-size: 10
max-page: 10000
max-size: 10000
```
Loading

0 comments on commit c09e875

Please sign in to comment.