mybatis-3 icon indicating copy to clipboard operation
mybatis-3 copied to clipboard

Allow custom mapper methods to initiate dynamic injection

Open qmdx opened this issue 1 year ago • 5 comments
trafficstars

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

qmdx avatar Sep 21 '24 09:09 qmdx

@harawata Thoughts? Looks ok to me.

hazendaz avatar Sep 26 '24 00:09 hazendaz

Coverage Status

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

coveralls avatar Sep 26 '24 00:09 coveralls

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

harawata avatar Sep 26 '24 05:09 harawata

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

qmdx avatar Sep 29 '24 01:09 qmdx

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

harawata avatar Sep 29 '24 03:09 harawata