From d3d4376b4c69a1fb7cfa71a8f5162242a20bdd53 Mon Sep 17 00:00:00 2001 From: blinkfox Date: Mon, 14 Oct 2019 16:47:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=90=AF=E4=BA=86=20v1.1.1=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=8C=E9=BB=98=E8=AE=A4=E6=B1=82=E6=80=BB?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=95=B0=20`count(*)`=20=E6=97=B6=E7=9A=84?= =?UTF-8?q?=20SQL=20=E5=A2=9E=E5=8A=A0=E4=BA=86=20as=20=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/CHANGELOG.md | 4 ++++ docs/_coverpage.md | 2 +- docs/quick-install.md | 8 ++++---- pom.xml | 2 +- .../com/blinkfox/fenix/config/FenixConfigManager.java | 2 +- src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java | 8 ++++---- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ca98dd3..c67eabe 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.1.1 求分页 count 小调整 (2018-10-10) + +- **修改**了默认求总记录数 `count(*)` 时的 SQL 为 `count(*) as count`,即增加了 `as` 列; + ## v1.1.0 新增返回任意实体对象或集合 (2018-10-10) - **新增**了**返回任意实体对象**或集合的功能,相比使用投影的方式更为简单和自然; diff --git a/docs/_coverpage.md b/docs/_coverpage.md index ab7ed7c..10e0349 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ ![logo](assets/images/logo.png) -# Fenix 1.1.0 +# Fenix 1.1.1 > 为解决复杂动态 SQL 而生的 Spring Data JPA 扩展库 diff --git a/docs/quick-install.md b/docs/quick-install.md index cbaee5a..efb873f 100644 --- a/docs/quick-install.md +++ b/docs/quick-install.md @@ -14,14 +14,14 @@ com.blinkfox fenix-spring-boot-starter - 1.1.0 + 1.1.1 ``` ### Gradle ```bash -compile 'com.blinkfox:fenix-spring-boot-starter:1.1.0' +compile 'com.blinkfox:fenix-spring-boot-starter:1.1.1' ``` ### 激活 Fenix FactoryBean @@ -90,14 +90,14 @@ fenix: com.blinkfox fenix - 1.1.0 + 1.1.1 ``` ### Gradle ```bash -compile 'com.blinkfox:fenix:1.1.0' +compile 'com.blinkfox:fenix:1.1.1' ``` ### 激活 Fenix FactoryBean diff --git a/pom.xml b/pom.xml index afb4293..a880595 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.blinkfox fenix - 1.1.0 + 1.1.1-SNAPSHOT jar fenix diff --git a/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java b/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java index e93638b..8bd03fd 100644 --- a/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java +++ b/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java @@ -42,7 +42,7 @@ public final class FenixConfigManager { + " | __)/ __ \\ / \\| \\ \\/ /\n" + " | \\\\ ___/| | \\ |> < \n" + " \\___ / \\___ >___| /__/__/\\_ \\\n" - + " \\/ \\/ \\/ \\/\n"; + + " \\/ \\/ \\/ \\/ v1.1.1\n"; /** * Fenix 配置信息实例. diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java index f338e54..de86c9c 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java @@ -36,14 +36,14 @@ public class FenixJpaQuery extends AbstractJpaQuery { /** - * 用来替换 'select ... from' 为 'select count(*) from ' 的正则表达式. + * 用来替换 'select ... from' 为 'select count(*) as count from ' 的正则表达式. */ private static final String REGX_SELECT_FROM = "((?i)select)([\\s\\S]*?)((?i)from)"; /** - * 用来替换 'select ... from' 为 'select count(*) from ' 的求 count(*) 的常量. + * 用来替换 'select ... from' 为 'select count(*) as count from ' 的求 count(*) 的常量. */ - private static final String SELECT_COUNT = "select count(*) from "; + private static final String SELECT_COUNT = "select count(*) as count from "; /** * JPA 参数对象. @@ -264,7 +264,7 @@ private Pageable buildPagableAndSortSql(Object[] values) { @Override protected Query doCreateCountQuery(Object[] values) { // 如果计数查询的 SQL 不为空(区分 Java和 Xml 两者方式),就重新构建 SqlInfo 信息, - // 否则就替换查询字符串中的字段值为 'count(*)'. + // 否则就替换查询字符串中的字段值为 'count(*) as count'. String countSql = this.getCountSql(); // 创建 Query,并循环设置命名绑定参数.