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

Allow custom mapper methods to initiate dynamic injection #3243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qmdx
Copy link

@qmdx qmdx commented Sep 21, 2024

This dynamic injection method is the core principle of mybatis-plus, and we hope that the official mybatis can adopt it, Thank you for checking

@hazendaz
Copy link
Member

@harawata Thoughts? Looks ok to me.

@coveralls
Copy link

Coverage Status

coverage: 87.178% (+0.03%) from 87.153%
when pulling 0e883d6 on baomidou:master
into c3fd28c on mybatis:master.

@harawata
Copy link
Member

Adding a mapper method at runtime is not a good idea.
If you want to generate SQL dynamically, please use SQL provider.

@qmdx
Copy link
Author

qmdx commented Sep 29, 2024

Adding a mapper method at runtime is not a good idea. If you want to generate SQL dynamically, please use SQL provider.

hi @harawata The injection method provided by PR is an XML simulation injection method, which has more secure SQL protection, Performance may be better in ordinary simple crud situations,Every time the SQL Provider method is called, the SQL statement is regenerated, which may result in additional parsing time, especially for complex SQL generation logic. I hope to carefully consider my suggestion and provide an additional injection solution, which is not a bad thing for MyBatis itself.
Thank you for your reply

@harawata
Copy link
Member

I'm sorry, but I still think this is a bad idea.

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

Successfully merging this pull request may close these issues.

4 participants