blinkfox / fenix

This is an extension library to the Spring Data JPA complex or dynamic SQL query. 这是一个比 MyBatis 更加强大的 Spring Data JPA 扩展库,为解决复杂动态 JPQL (或 SQL) 而生。https://blinkfox.github.io/fenix
https://blinkfox.github.io/fenix
Apache License 2.0
346 stars 72 forks source link

能支持一下修改 SELECT_COUNT = "select count(*) as count from "吗 #2

Closed masankin closed 5 years ago

masankin commented 5 years ago

sharding-sphere分库分表查询时碰到select count() from问题: Caused by: java.lang.IllegalStateException: Can't find index: AggregationSelectItem(type=COUNT, innerExpression=(), alias=Optional.absent(), derivedAggregationItems=[], index=-1), please add alias for aggregate selections

于是使用countQuery重写为 select count() as count 结果正常 考虑到 com.blinkfox.fenix.jpa.FenixJpaQuery.getCountSql 可替换 select count() SELECT_COUNT = "select count(*) as count from " 考虑看能否支持一下

blinkfox commented 5 years ago

@masankin 可以,今天或明天应该可以发一版出来。

blinkfox commented 5 years ago

@masankin 昨天改了默认求 count 时加 as 别名的功能,发了 v1.1.1版本,你试用下,没啥问题就关掉这个 issue