Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow custom mapper methods to initiate dynamic injection #3243

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

Open
qmdx wants to merge 1 commit into mybatis:master
base: master
Choose a base branch
Loading
from baomidou:master

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

Copy link
Member

@harawata Thoughts? Looks ok to me.

Copy link

Coverage Status

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

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.

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

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /