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

解决issue11,添加countSql对distinct的支持。 #24

Closed pengten closed 4 years ago

pengten commented 4 years ago

解决issue11,添加countSql对distinct的支持。

blinkfox commented 4 years ago

@yy1098029419 谢谢贡献,但有几个点需要说一下:

  1. 你的代码格式不符合我项目的 Checkstyle 规范,你可以再改改,你可以用执行 mvn compile 命令应该会报格式问题的,或者你的 Intellij idea 里面配置我项目中的 Checkstyle 文件,检查下看看 ;
  2. enableDistinct() 默认值设置为 false 吧,这样默认情况下会保持先下兼容,而且 distinct 的情况偏少,减少没必要的代码运行;
  3. 类似这样 Pattern pattern = Pattern.compile(REGX_SELECT_FROM);Pattern 应该做成 static final 的,不用每次运行都去编译,全局只需编译一次就行了,增加运行速度。
pengten commented 4 years ago

@blinkfox checkStyle文件用idea导入报错

blinkfox commented 4 years ago

@blinkfox checkStyle文件用idea导入报错

版本选 8.30

pengten commented 4 years ago

@blinkfox 按照checkstyle修正完成。

codecov-commenter commented 4 years ago

Codecov Report

Merging #24 into develop will decrease coverage by 0.44%. The diff coverage is 12.50%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #24      +/-   ##
===========================================
- Coverage    78.79%   78.35%   -0.45%     
===========================================
  Files          105      105              
  Lines         2023     2037      +14     
  Branches       289      291       +2     
===========================================
+ Hits          1594     1596       +2     
- Misses         319      331      +12     
  Partials       110      110              
Impacted Files Coverage Δ
...ain/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java 68.37% <12.50%> (-7.36%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c391e0b...4c03a71. Read the comment docs.

blinkfox commented 4 years ago

@yy1098029419 我先给你合了,不过单元测试率降低了,你抽空补一下单元测试吧,代码更靠谱点儿。

我单元测试里面使用的是 HSQLDB 内存数据库,你参考我的代码,补充一些关于这些 distinct 查询的测试用例。