Commit 0dd7b201bb1c4ae999a692643cab2723bcd98916
1 parent
f5484570
Exists in
master
and in
2 other branches
rows 在mysql 8.0是关键字,不能使用简写别名
Showing
2 changed files
with
5 additions
and
5 deletions
Show diff stats
build.gradle
| @@ -55,7 +55,7 @@ uploadArchives { | @@ -55,7 +55,7 @@ uploadArchives { | ||
| 55 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) | 55 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) |
| 56 | } | 56 | } |
| 57 | pom.project { | 57 | pom.project { |
| 58 | - version '2.1.30' | 58 | + version '2.1.32' |
| 59 | artifactId ARTIFACT_Id | 59 | artifactId ARTIFACT_Id |
| 60 | groupId GROUP_ID | 60 | groupId GROUP_ID |
| 61 | packaging TYPE | 61 | packaging TYPE |
src/main/java/com/taover/repository/CustomJdbcTemplate.java
| @@ -668,14 +668,14 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { | @@ -668,14 +668,14 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { | ||
| 668 | String querySql = selectSql+" "+fromAndWhereSql+" "+orderByPartSql+" "+UtilsSql.getLimitCondition(page, pageSize); | 668 | String querySql = selectSql+" "+fromAndWhereSql+" "+orderByPartSql+" "+UtilsSql.getLimitCondition(page, pageSize); |
| 669 | 669 | ||
| 670 | //构造统计计数语句 | 670 | //构造统计计数语句 |
| 671 | - String countSql = "select count(*) rows from ( select 1 "+fromAndWhereSql+" ) t "; | 671 | + String countSql = "select count(*) rowsCount from ( select 1 "+fromAndWhereSql+" ) t "; |
| 672 | 672 | ||
| 673 | //执行查询 | 673 | //执行查询 |
| 674 | List<Map<String, Object>> queryData = new ArrayList<Map<String, Object>>(); | 674 | List<Map<String, Object>> queryData = new ArrayList<Map<String, Object>>(); |
| 675 | Map<String, Object> countData = new HashMap<String, Object>(); | 675 | Map<String, Object> countData = new HashMap<String, Object>(); |
| 676 | queryData = this.jdbcTemplateRead.queryForList(querySql); | 676 | queryData = this.jdbcTemplateRead.queryForList(querySql); |
| 677 | countData = this.jdbcTemplateRead.queryForMap(countSql); | 677 | countData = this.jdbcTemplateRead.queryForMap(countSql); |
| 678 | - return UtilsSql.createPage(page, pageSize, Integer.valueOf(countData.get("rows").toString()), queryData); | 678 | + return UtilsSql.createPage(page, pageSize, Integer.valueOf(countData.get("rowsCount").toString()), queryData); |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | public <E> Map<String, Object> getBeanPageData(String coreSql, String orderByPartSql, Integer page, Integer pageSize, Class<E> beanClass){ | 681 | public <E> Map<String, Object> getBeanPageData(String coreSql, String orderByPartSql, Integer page, Integer pageSize, Class<E> beanClass){ |
| @@ -692,14 +692,14 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { | @@ -692,14 +692,14 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { | ||
| 692 | String querySql = selectSql+" "+fromAndWhereSql+" "+orderByPartSql+" "+UtilsSql.getLimitCondition(page, pageSize); | 692 | String querySql = selectSql+" "+fromAndWhereSql+" "+orderByPartSql+" "+UtilsSql.getLimitCondition(page, pageSize); |
| 693 | 693 | ||
| 694 | //构造统计计数语句 | 694 | //构造统计计数语句 |
| 695 | - String countSql = "select count(*) rows from ( select 1 "+fromAndWhereSql+" ) t "; | 695 | + String countSql = "select count(*) rowsCount from ( select 1 "+fromAndWhereSql+" ) t "; |
| 696 | 696 | ||
| 697 | //执行查询 | 697 | //执行查询 |
| 698 | List<E> queryData = new ArrayList<E>(); | 698 | List<E> queryData = new ArrayList<E>(); |
| 699 | Map<String, Object> countData = new HashMap<String, Object>(); | 699 | Map<String, Object> countData = new HashMap<String, Object>(); |
| 700 | queryData = this.jdbcTemplateRead.queryForList(querySql, beanClass); | 700 | queryData = this.jdbcTemplateRead.queryForList(querySql, beanClass); |
| 701 | countData = this.jdbcTemplateRead.queryForMap(countSql); | 701 | countData = this.jdbcTemplateRead.queryForMap(countSql); |
| 702 | - return UtilsSql.createPage(page, pageSize, Integer.valueOf(countData.get("rows").toString()), queryData); | 702 | + return UtilsSql.createPage(page, pageSize, Integer.valueOf(countData.get("rowsCount").toString()), queryData); |
| 703 | } | 703 | } |
| 704 | 704 | ||
| 705 | /** | 705 | /** |