Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of Mybatis Plus reverse Engineering

Shulou Source: shulou.com Published: 2022-06-02 02:39:57 09月25日 Update

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!

Tags: Projects projects examples reverse engineering analysis content data databases files articles values interests peers guys partners situations methods more catalogs knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MariaDB Shulou Tech Info MySQL Huawei