mybatis-generator是一个很好的数据库逆向生成Java实体的插件,但不能添加中文注释和注解,如果我们想生成下面这样一个实体类,那么就只能自己动手扩展一下mybatis-generator
generatorConfig.xml 配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 配置生成器 -->
<!--此文件简略清爽,另一篇注释详细,作为参考-->
<generatorConfiguration>
<properties resource="mybatis-generator/mybatisGeneratorInit.properties"/>
<context id="MysqlTables" targetRuntime="MyBatis3" defaultModelType="flat">
<!-- 自动识别数据库关键字,默认false,如果设置为true,根据SqlReservedWords中定义的关键字列表;
一般保留默认值,遇到数据库关键字(Java关键字),使用columnOverride覆盖 -->
<property name="autoDelimitKeywords" value="false"/>
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 格式化java代码 -->
<property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
<!-- 格式化XML代码 -->
<property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
<!-- beginningDelimiter和endingDelimiter:指明数据库的用于标记数据库对象名的符号,
比如ORACLE就是双引号,MYSQL默认是`反引号; -->
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!--自定义的toString方法-->
<plugin type="${my.toStringPlugin.address}"/>
<!--自定义的mapper接口-->
<plugin type="${my.baseMapperGeneratorPlugin.address}"/>
<!-- 自定义注释 -->
<commentGenerator type="${my.commentGenerator.address}">
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="false"/>
<!-- 是否生成注释代时间戳-->
<property name="suppressDate" value="true"/>
<property name="addRemarkComments" value="true"/>
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="${jdbc_driver}"
connectionURL="${jdbc_url}"
userId="${jdbc_user}"
password="${jdbc_password}"/>
<!-- 类型转换 -->
<javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
<!-- 是否使用bigDecimal
默认false:把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,
为 true时:把JDBC DECIMAL 和NUMERIC 类型解析为java.math.BigDecimal
-->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成实体类 -->
<!-- targetPackage:生成实体类的包名 -->
<!-- targetProject:生成实体类的位置 -->
<javaModelGenerator targetPackage="${model.target.package}" targetProject="${target.project}">
<!-- 是否对model添加 构造构造方法,构造方法包含了所有的field;而不是使用setter; -->
<property name="constructorBased" value="true"/>
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false -->
<!-- 是否允许子包,即targetPackage.schemaName.tableName -->
<property name="enableSubPackages" value="false"/>
<!-- 设置是否在getter方法中,对String类型字段调用trim()方法 -->
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true"/>
<property name="immutable" value="false"/>
<!--所有实体类继承BasePojo类-->
<property name="rootClass" value="com.pojo.BasePojo" />
</javaModelGenerator>
<!-- 生成mapper映射文件 XML 生成XxxMapper.xml
targetPackage:mapper映射文件生成的包名
targetProject:mapper映射文件生成的位置
-->
<sqlMapGenerator targetPackage="${mapper.target.package}" targetProject="${target.project}">
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false -->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- Dao层接口 生成XxxMapper.java文件: -->
<javaClientGenerator targetPackage="${dao.target.package}" targetProject="${target.project}" type="XMLMAPPER">
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false -->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!--指定数据库要逆向工程生成的表-->
<!--可以生成很多表,生成在本工程结构里面-->
<!--设置Example为true的话,就会生成Example文件,比较杂乱,不想生成这些内容的话,直接选择false即可
tableName:指定了表名
domainObjectName:指定了实体类的名称,可以去掉domainObjectName="False_comment"
-->
<table schema="" tableName="%"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false">
<!-- 如果设置为true,生成的model类会直接使用column本身的名字,而不会再使用驼峰命名方法,
比如BORN_DATE,生成的属性名字就是BORN_DATE,而不会是bornDate
再比如:数据库里的原本列名是:`is_show_name`(都是小写),
如果true就会生成:is_show_name(还是数据库实际的字段名字,原始名字);生成的setter/getter为:getIs_show_name()和setIs_show_name()(只是第一个字母大写)
如果false就会生成:isShowName(去掉了下划线,变成了驼峰命名方法);生成的setter/getter为:getIsShowName() 和setIsShowName() (只是第一个字母大写)
注意:如果明确的使用columnOverride元素指定了字段对应的实体的属性名,那么useActualColumnNames会被忽略。
-->
<!-- <property name="useActualColumnNames" value="false"/>-->
</table>
</context>
</generatorConfiguration>
自定义的实体注释:
package util;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.*;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.config.MergeConstants;
import org.mybatis.generator.config.PropertyRegistry;
import org.mybatis.generator.internal.DefaultCommentGenerator;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import static org.mybatis.generator.internal.util.StringUtility.isTrue;
/**
* mybatis generator 自定义comment生成器. 字段注释内容
* 基于MBG 1.3.2.
*/
public class MyCommentGenerator extends DefaultCommentGenerator {
private Properties properties;
private Properties systemPro;
private boolean suppressDate;
private boolean suppressAllComments;
private String currentDateStr;
public MyCommentGenerator() {
super();
properties = new Properties();
systemPro = System.getProperties();
suppressDate = false;
suppressAllComments = false;
currentDateStr = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
}
@Override
public void addJavaFileComment(CompilationUnit compilationUnit) {
// add no file level comments by default
return;
}
/**
* Adds a suitable comment to warn users that the element was generated, and
* when it was generated.
*/
@Override
public void addComment(XmlElement xmlElement) {
return;
}
@Override
public void addRootComment(XmlElement rootElement) {
// add no document level comments by default
return;
}
@Override
public void addConfigurationProperties(Properties properties) {
this.properties.putAll(properties);
suppressDate = isTrue(properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
suppressAllComments = isTrue(properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
}
/**
* This method adds the custom javadoc tag for. You may do nothing if you do
* not wish to include the Javadoc tag - however, if you do not include the
* Javadoc tag then the Java merge capability of the eclipse plugin will
* break.
*
* @param javaElement the java element
*/
@Override
protected void addJavadocTag(JavaElement javaElement, boolean markAsDoNotDelete) {
javaElement.addJavaDocLine(" *");
StringBuilder sb = new StringBuilder();
sb.append(" * ");
sb.append(MergeConstants.NEW_ELEMENT_TAG);
if (markAsDoNotDelete) {
sb.append(" do_not_delete_during_merge");
}
String s = getDateString();
if (s != null) {
sb.append(' ');
sb.append(s);
}
javaElement.addJavaDocLine(sb.toString());
}
/**
* This method returns a formated date string to include in the Javadoc tag
* and XML comments. You may return null if you do not want the date in
* these documentation elements.
*
* @return a string representing the current timestamp, or null
*/
@Override
protected String getDateString() {
String result = null;
if (!suppressDate) {
result = currentDateStr;
}
return result;
}
@Override
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
innerClass.addJavaDocLine("/**");
sb.append(" * ");
sb.append(introspectedTable.getFullyQualifiedTable());
sb.append(" ");
sb.append(getDateString());
innerClass.addJavaDocLine(sb.toString());
innerClass.addJavaDocLine(" */");
}
@Override
public void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
innerEnum.addJavaDocLine("/**");
// addJavadocTag(innerEnum, false);
sb.append(" * ");
sb.append(introspectedTable.getFullyQualifiedTable());
innerEnum.addJavaDocLine(sb.toString());
innerEnum.addJavaDocLine(" */");
}
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
field.addJavaDocLine("/**");
sb.append(" * ");
sb.append(introspectedColumn.getRemarks());
field.addJavaDocLine(sb.toString());
// addJavadocTag(field, false);
field.addJavaDocLine(" */");
// field.addAnnotation("@Size(min = 0, max = " +
// introspectedColumn.getLength() + " , message =
// \"长度必须在{min}和{max}之间\")");
// field.addAnnotation("@NotNull"); if
// (introspectedColumn.isStringColumn()) {
// topLevelClass.addImportedType("javax.validation.constraints.Size");
// field.addAnnotation("@Size(min = 0, max = " +
// introspectedColumn.getLength() + " , message =
// \"长度必须在{min}和{max}之间\")"); }
List<IntrospectedColumn> primaryKeyColumns = introspectedTable.getPrimaryKeyColumns();
for (IntrospectedColumn col : primaryKeyColumns) {
if (col.getActualColumnName().equals(introspectedColumn.getActualColumnName())) {
field.addAnnotation("@Id");
}
}
/*
除开id的其他字段上生成@Column注解
field.addAnnotation("@Column(name = \"" + introspectedColumn.getActualColumnName() + "\")");*/
}
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
field.addJavaDocLine("/**");
sb.append(" * ");
sb.append(introspectedTable.getFullyQualifiedTable());
field.addJavaDocLine(sb.toString());
field.addJavaDocLine(" */");
}
@Override
public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
// method.addJavaDocLine("/**");
// addJavadocTag(method, false);
// method.addJavaDocLine(" */");
}
@Override
public void addGetterComment(Method method, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (suppressAllComments) {
return;
}
method.addJavaDocLine("/**");
StringBuilder sb = new StringBuilder();
sb.append(" * ");
sb.append(introspectedColumn.getRemarks());
method.addJavaDocLine(sb.toString());
sb.setLength(0);
sb.append(" * @return ");
sb.append(introspectedColumn.getActualColumnName());
sb.append(" ");
sb.append(introspectedColumn.getRemarks());
method.addJavaDocLine(sb.toString());
// addJavadocTag(method, false);
method.addJavaDocLine(" */");
}
@Override
public void addSetterComment(Method method, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn) {
if (suppressAllComments) {
return;
}
method.addJavaDocLine("/**");
StringBuilder sb = new StringBuilder();
sb.append(" * ");
sb.append(introspectedColumn.getRemarks());
method.addJavaDocLine(sb.toString());
Parameter parm = method.getParameters().get(0);
sb.setLength(0);
sb.append(" * @param ");
sb.append(parm.getName());
sb.append(" ");
sb.append(introspectedColumn.getRemarks());
method.addJavaDocLine(sb.toString());
// addJavadocTag(method, false);
method.addJavaDocLine(" */");
}
@Override
public void addModelClassComment(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
topLevelClass.addImportedType("javax.persistence.Column");
topLevelClass.addImportedType("javax.persistence.Id");
topLevelClass.addImportedType("javax.persistence.Table");
topLevelClass.addImportedType("org.apache.ibatis.type.Alias");
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
topLevelClass.addJavaDocLine("/**");
sb.append(" * ");
sb.append(introspectedTable.getFullyQualifiedTable());
topLevelClass.addJavaDocLine(sb.toString());
sb.setLength(0);
sb.append(" * @author ");
sb.append(systemPro.getProperty("user.name"));
sb.append(" ");
sb.append(currentDateStr);
// addJavadocTag(innerClass, markAsDoNotDelete);
topLevelClass.addJavaDocLine(" */");
topLevelClass.addAnnotation("@Table(name = \"" + introspectedTable.getFullyQualifiedTable() + "\")");
}
// 首字母转小写
public static String toLowerCaseFirstOne(String s) {
if (Character.isLowerCase(s.charAt(0))) {
return s;
} else {
return (new StringBuilder()).append(Character.toLowerCase(s.charAt(0))).append(s.substring(1)).toString();
}
}
@Override
public void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable,
Set<FullyQualifiedJavaType> imports) {
System.out.println(method.getName());
}
@Override
public void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports) {
System.out.println(method.getName());
}
@Override
public void addFieldAnnotation(Field field, IntrospectedTable introspectedTable,
Set<FullyQualifiedJavaType> imports) {
System.out.println(field.getName());
}
@Override
public void addFieldAnnotation(Field field, IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports) {
System.out.println(field.getName());
field.addAnnotation("@Column(name = \"" + field.getName() + "\")");
}
@Override
public void addClassAnnotation(InnerClass innerClass, IntrospectedTable introspectedTable,
Set<FullyQualifiedJavaType> imports) {
System.out.println(innerClass);
}
}
自定义的toString方法:
package util;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.JavaVisibility;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.TopLevelClass;
import java.util.List;
/**
* mybatis generator 自定义toString插件
* 基于MBG 1.3.2
*/
public class MyToStringPlugin extends PluginAdapter {
public MyToStringPlugin() {
}
@Override
public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
this.generateToString(introspectedTable, topLevelClass);
return true;
}
@Override
public boolean modelRecordWithBLOBsClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
this.generateToString(introspectedTable, topLevelClass);
return true;
}
@Override
public boolean modelPrimaryKeyClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
this.generateToString(introspectedTable, topLevelClass);
return true;
}
private void generateToString(IntrospectedTable introspectedTable, TopLevelClass topLevelClass) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getStringInstance());
method.setName("toString");
if (introspectedTable.isJava5Targeted()) {
method.addAnnotation("@Override");
}
//添加方法注释
this.context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
//下面两句method.addBodyLine使用其中之一即可
//使用自定义toString工具类
//method.addBodyLine("return ToStringUtils.toSimpleString(this);");
//使用commons-lang3的工具类
//添加包
topLevelClass.addImportedType("org.apache.commons.lang3.builder.ToStringBuilder");
topLevelClass.addImportedType("org.apache.commons.lang3.builder.ToStringStyle");
method.addBodyLine("return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);");
//添加方法
topLevelClass.addMethod(method);
}
/*
private void generateToString(IntrospectedTable introspectedTable, TopLevelClass topLevelClass) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getStringInstance());
method.setName("toString");
if (introspectedTable.isJava5Targeted()) {
method.addAnnotation("@Override");
}
this.context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
method.addBodyLine("StringBuilder sb = new StringBuilder();");
method.addBodyLine("sb.append(getClass().getSimpleName());");
method.addBodyLine("sb.append(\" [\");");
StringBuilder sb = new StringBuilder();
Iterator i$ = topLevelClass.getFields().iterator();
while(i$.hasNext()) {
Field field = (Field)i$.next();
String property = field.getName();
sb.setLength(0);
sb.append("sb.append(\"").append(", ").append(property).append("=\")").append(".append(").append(property).append(");");
method.addBodyLine(sb.toString());
}
method.addBodyLine("sb.append(\"]\");");
method.addBodyLine("return sb.toString();");
topLevelClass.addMethod(method);
}
*/
@Override
public boolean validate(List<String> warnings) {
return true;
}
}
配置文件主要配置连接数据库的必需参数以及一些路径:
#Mybatis Generator configuration
#java的目录路径
target.project=src/main/java
#resources的目录路径
target.resources=src/main/resources
#生成实体类地址
model.target.package=com.yixunlian.pojo
#生成mapper(xml)地址
mapper.target.package=com.yixunlian.mapper.xml
#生成dao接口(mapper)地址
dao.target.package=com.yixunlian.mapper
#自定义comment生成器地址
my.commentGenerator.address=util.MyCommentGenerator
#自定义toString插件地址
my.toStringPlugin.address=util.MyToStringPlugin
#自定义toString插件地址
my.baseMapperGeneratorPlugin.address=util.BaseMapperGeneratorPlugin
#数据库信息
#需要指明mysql数据库连接器的绝对路径,比较麻烦。只是可选项。所以不写也可以
#jdbc.driverLocation=D:\gitresource\mysql\mysql-connector-java\5.1.45\mysql-connector-java-5.1.45.jar
jdbc_driver=com.mysql.jdbc.Driver
jdbc_url=jdbc:mysql://localhost:3306/yixunlian
jdbc_user=root
jdbc_password=root
通过代码的方式运行:
package util;
import org.mybatis.generator.api.ShellRunner;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* 逆向工程生成器
*/
public class MyBatisGenerator {
//根据配置文件,生成相应的model实体类,mapper接口,mapperXMl文件
public static void main(String[] args) {
/*第一种方式:
try {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
//注意:使用绝对路径 请根据自己本机的具体路径重新配置 否则运行不成功
File configFile = new File("C:\\Users\\yuanyuana\\Desktop\\易迅连\\逆向工程\\mybatis-generator\\src\\main\\resources\\mybatis-generator\\generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
org.mybatis.generator.api.MyBatisGenerator myBatisGenerator = new org.mybatis.generator.api.MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
} catch (Exception e) {
e.printStackTrace();
}
}*/
//第二种方式(我喜欢下面的这种,更简洁):
args = new String[]{"-configfile", "src\\main\\resources\\mybatis-generator\\generatorConfig.xml", "-overwrite"};
ShellRunner.main(args);
}
}
实体类要继承的基础类basePojo
package com.pojo;
import java.io.Serializable;
import java.util.Date;
public abstract class BasePojo implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private Date created;
private Date updated;
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
}
项目依赖pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mybatisgenerator</groupId>
<artifactId>mybatis-generator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mybatis-generator</name>
<description>mybatis-逆向工程</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<commons-lang3.version>3.3.2</commons-lang3.version>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--mybatis逆向工程-->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator</artifactId>
<version>1.3.7</version>
</dependency>
<!--生成代码插件 -->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.7</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- 分页助手 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>3.7.5</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>0.9.1</version>
</dependency>
<!-- 通用mapper -->
<dependency>
<groupId>com.github.abel533</groupId>
<artifactId>mapper</artifactId>
<version>2.3.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
mapper文件:
image.png
实体类结构:
网友评论