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
src/main/java/com/taover/repository/CustomJdbcTemplate.java
| ... | ... | @@ -668,14 +668,14 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { |
| 668 | 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 | 674 | List<Map<String, Object>> queryData = new ArrayList<Map<String, Object>>(); |
| 675 | 675 | Map<String, Object> countData = new HashMap<String, Object>(); |
| 676 | 676 | queryData = this.jdbcTemplateRead.queryForList(querySql); |
| 677 | 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 | 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 | 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 | 698 | List<E> queryData = new ArrayList<E>(); |
| 699 | 699 | Map<String, Object> countData = new HashMap<String, Object>(); |
| 700 | 700 | queryData = this.jdbcTemplateRead.queryForList(querySql, beanClass); |
| 701 | 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 | /** | ... | ... |