Release of open source tool - JyEntity

    There is no project recently, and I am bored to do exercises. I found that the current tool class for generating Java Beans from database tables is a bit complicated and needs to configure a lot of XML, so I wrote a simple tool and temporarily named it JyEntity.

    Link: https://gitee.com/LKWai/JyEntity

    Features of JyEntity are:

  •         Zero XML configuration.
  •         It only takes at least 4 lines of code to generate the model class, which simplifies the configuration, and most of them can use the default configuration.
  •         Follow the naming conventions of Java classes and properties, and automatically convert the database naming conventions.
  •         The field's comment information can be automatically populated as the property's comment.
  •         Multiple encoding formats are supported.

        Instructions:

        1. Because the Model class generated by JyEntity is based on the FreeMarker template, the FreeMarker Jar package must be introduced into the project.

         2. Create any class in the Web project and enter the code in the main function.

public static void main(String[] args) {

		//注入配置信息,这四条是最基本的,如果没有会不能执行
		Jyproperties.setDriverClass("com.mysql.jdbc.Driver");
		Jyproperties.setUrl("jdbc:mysql://127.0.0.1:3306/abc?useUnicode=true&characterEncoding=utf-8");
		Jyproperties.setUsername("root");
		Jyproperties.setPassword("root");
		Jyproperties.setPath("com/rl/OutVM/model/");
		//执行构建过程
		JyMainClass.buildModelClass();
		
	}

        3. The effect is as follows, the model class is automatically generated, including attributes and Set Get methods

 

         Tool processing flow:

            First of all, the following picture illustrates the data processing flow and the function of each module

        

 

            Tool parameter description:

                      Required parameters: 

                                        Database URL

                                        Drive parameters

                                        Username and password

                       Optional parameters and default values:

                                        The encoding format of the encoding model class defaults to UTF-8

                                        dbtype database type defaults to MySQL database

                                        path The path to generate the entity class defaults to the classpath of the current project

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324430087&siteId=291194637