Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Mybatis Plus reverse Engineering

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the example analysis of Mybatis Plus reverse engineering, which is very detailed and has certain reference value. Friends who are interested must finish it!

First, create a database

Note: create a foreign key for tbl_emp 's table

The establishment of database and table:

Second, configure the pom.xml file org.mybatis.generator mybatis-generator-core 1.3.5

Import the jar package of mybatis-generator:

Note: if there is a situation that can not be imported.

In the project-right-maven-updataproject

Third, set up mgb.xml in the project peer directory. Fourth, write the method package com.crud.text;import java.io.File;import java.util.ArrayList;import java.util.List in the test class. Import org.mybatis.generator.api.MyBatisGenerator;import org.mybatis.generator.config.Configuration;import org.mybatis.generator.config.xml.ConfigurationParser;import org.mybatis.generator.internal.DefaultShellCallback;public class MGBTest {public static void main (String [] args) throws Exception {List warnings = new ArrayList (); boolean overwrite = true; / / write the self-created xml file File configFile = new File ("mbg.xml") ConfigurationParser cp = new ConfigurationParser (warnings); Configuration config = cp.parseConfiguration (configFile); DefaultShellCallback callback = new DefaultShellCallback (overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator (config, callback, warnings); myBatisGenerator.generate (null);}}

Refresh the project (press F5)

The above is all the contents of the article "sample Analysis of Mybatis Plus reverse Engineering". Thank you for reading! Hope to share the content to help you, more related 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report