[Open Source] A code assistance plugin for data translation. One annotation does it all, reducing SQL code by 30%.
![[Open Source] A code assistance plugin for data translation. One annotation does it all, reducing SQL code by 30%.](https://yy123.ink/api/img/1782606849463-ufk9jm.jpg)
1. Project Overview

Easy Trans isA code assistance plugin for data translation. It leverages ORM frameworks such as MyBatis Plus, JPA, and BeetlSQL to automatically query database tables, allowing developers to quickly translate IDs and dictionary codes into data that needs to be displayed on the frontend.
2. Open Source License
Licensed under Apache-2.0
3. Screenshots

4. Feature Overview
Easy Trans supports five use cases
1. I have an ID, but I need to display its title/name to customers. However, I don't want to manually write table join queries.
2. I have a dictionary code called sex and a dictionary value of 0. I want to translate it into Male for display to customers.
3. I have a set of user IDs, such as 1, 2, and 3, and I want to display their corresponding names as Zhang San, Li Si, and Wang Wu to customers.
4. I have an enum with a title field, and I want to display the value of that title field to customers on the frontend.
5. I have a unique key (such as a phone number or ID card number, rather than an ID field from another table), but I need to display its title/name to customers without manually writing table join queries.
5. Tech Stack
Five Types Supported by Easy Trans
Dictionary Translation (TransType.DICTIONARY)
Users need to refresh dictionary information into DictionaryTransService for caching. When dictionary translation is performed, the cached data source is used.
Simple Translation (TransType.SIMPLE)
For example, when you have a userId and need to retrieve the userName or userPo for the frontend, the component uses the MyBatisPlus/JPA API to automatically query the database and stores the results in TransMap.
Cross-Microservice Translation (TransType.RPC)
For example, orders and users are handled by two separate microservices. However, you need to display the username of the person who created an order in the order details. RPC translation is required in this case. The order microservice uses restTemplate to call a unified interface provided by the user service and passes the ID that needs translation. The user microservice then uses the MyBatisPlus/JPA API to automatically query the database and return the result to the order microservice. After receiving the data, the order microservice performs the translation. Of course, users only need to add an annotation; all these operations are handled automatically by the component.
AutoTrans(TransType.AUTO)
This is still an ID-to-name translation scenario. However, if users want the component to call their own custom methods instead of querying data through the MyBatis Plus/JPA API, they can use AutoTrans.
Enum Translation (TransType.ENUM)
For example, if you want to translate SEX.BOY into Male, you can use enum translation.
