Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多数据库方言就有问题,假如我第一次使用了mysql,然后使用sqlserver查询就还是用的limit分页;代码逻辑有问题具体看详情 #793

Closed
yeeevip opened this issue Jan 3, 2024 · 9 comments

Comments

@yeeevip
Copy link

yeeevip commented Jan 3, 2024

使用环境

  • PageHelper 版本: 5.3.0

问题

image
这段代码硬是看不懂,第一次初始化了mysqldialect,之后我用sqlserver还是mysqldialect,即使调用了using("sqlserver")无作用,
作者可以自行测试:测试用例,不要用我自己实现的方言 https://github.com/yeeevip/yeee-memo/blob/master/learn-example/spring-boot-example/src/test/java/vip/yeee/memo/demo/springboot/PageHelperTests.java

自己解决了

image
image

自己改了一下代码临时用用,重写了PageHelper和PageAutoDialect这个类,修改了三处见下图
代码在:https://github.com/yeeevip/yeee-memo/tree/master/learn-example/spring-boot-example/src/main/java/vip/yeee/memo/demo/springboot/pagehelper

image
image
image

@abel533
Copy link
Collaborator

abel533 commented Jan 3, 2024

有没有试过6.0版本?

@yeeevip
Copy link
Author

yeeevip commented Jan 3, 2024

有没有试过6.0版本?

没有 版本太高会不会不兼容,我们项目中都是5.3

@yeeevip
Copy link
Author

yeeevip commented Jan 3, 2024

有没有试过6.0版本?

有没有试过6.0版本?

我现在给你测一下6.0吧

@yeeevip
Copy link
Author

yeeevip commented Jan 3, 2024

@yeeevip
Copy link
Author

yeeevip commented Jan 3, 2024

@abel533 大佬 我简单改了一下,第一次pr 希望合并留个名,谢谢_

@yeeevip
Copy link
Author

yeeevip commented Jan 3, 2024

@abel533 pr测试过了, 我的改动部分觉得合适帮我合一呗,我的改动大致这样:autoDialect=true就从上下文拿自动获取到的方言,否则就固定用this.delegate这个

@yeeevip
Copy link
Author

yeeevip commented Jan 3, 2024

搞了半天autoRuntimeDialect 配置参数只能这样啊,不能下划线方式啊

@yeeevip yeeevip closed this as completed Jan 3, 2024
@abel533
Copy link
Collaborator

abel533 commented Jan 4, 2024

@yeeevip 你看看starter项目中的属性定义,应该有额外支持中线的(烤串)。。下划线不是标准方式,spring boot也不支持。

@abel533
Copy link
Collaborator

abel533 commented Jan 4, 2024

如果有qq,可以加群:912339468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants