In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use MyBatis Generator in mybatis", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use MyBatis Generator in mybatis" this article.
Code generation
In the process of enterprise software development, most of the time is oriented to the development of database tables. Through the general addition, deletion, modification and search code generator, it can effectively improve the efficiency, reduce the cost, let the regular repetitive work be completed by the machine, and liberate the developers.
MyBatis Generator
MyBatis Generator is a code generation tool provided by MyBatis
It can help us to generate the persistence object (po) corresponding to the table, the interface to operate the database (dao), and the xml of CRUD sql (mapper).
Org.mybatis.generator mybatis-generator-maven-plugin ${last.version} mybatis-generator-config.xml
Configure the policy file mybatis-generator-config.xml related to code generation
.........
Shortcoming
Each code generation needs to configure the corresponding mybatis-generator-config to configure the relevant generation properties and rules in the form of XML
Unable to generate general Controller, Service classes, custom templates, etc.
To sum up two points: mybatis-generator is very inconvenient to use.
EasyCode
EasyCode is a code generation plug-in based on the IntelliJ IDEA Ultimate version, mainly through custom templates (based on velocity) to generate all kinds of code you want. Commonly used to generate Entity, Dao, Service, Controller. If you have strong hands-on ability, you can also be used to generate HTML, JS, PHP and other code. In theory, as long as it is data-related code can be generated.
Get started quickly
Install the IDEA EasyCode plug-in. Support online installation, plug-in market search installation can be.
Connect to the target data source using IDEA
Select the target table for code generation
Advanced configuration
As above, you can complete the addition, deletion, modification and search methods based on a single table, including Controller, Service, Mapper and Entity. However, the default generation is a generic file based on native MyBatis, which is not suitable for Mybatis extensions such as MyBatisPlus and generic Mapper. We can add our generation rules dynamically by editing the template file of EasyCode, and we can export them to others.
You can even configure new templates to generate front-end pages, such as Element-based additions, deletions, modifications and queries.
Summary
Of course, many scaffolding have built-in code generation capabilities. For example, the development platform module of pig, which realizes code generation in the form of custom template engine, can better integrate existing business and improve development efficiency.
The above is all the contents of the article "how to use MyBatis Generator in mybatis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.