Cache translation mainly uses cache to escape the fields of SQL query, so as to avoid database table associated query. Change multi table Association query into single table query。Upgrade performance。
Reference items: https://github.com/sagframe/sagacity-sqltoy
https://sagframe.github.io/sqltoy-online-doc/#/sqltoy/translate
Comment From: harawata
Hello @gang0713 ,
Let me clarify. This is a feature request that proposes MyBatis to rewrite SQL query to improve performance, is that correct? If yes, I have to tell you that MyBatis does not and will not rewrite SQLs automagically.
Comment From: gang0713
Cache translation mainly uses cache to escape the fields of SQL query, so as to avoid database table associated query。
@harawata No, we can do single table query without writing SQL by caching dictionary tables or in project development with the help of JPA and mybatis , but many times we need to associate dictionary tables and other tables to translate dictionary codes and foreign keys, and we have to write SQL, Using Cache translation, you only need to add an annotation to the translated POJO attribute to complete dictionary code / foreign key translation.
For three scenarios
- I have an ID, but I need to show the customer his title / name, but I don't want to do table Association query
2 do I have a dictionary? Sex and a dictionary value of 0. I hope it can be translated into male and shown to customers.
- I have a set of user IDs, such as 1, 2 and 3. I hope to show them to customers as Zhang San, Li Si and Wang Wu
Comment From: harawata
I'm sorry, I couldn't understand your explanation...at all. Could you try to use some concrete table, class, SQL, etc. to explain?
Comment From: harawata
No reply. Closing.