mybatis maven 生成器插件使用
mybatis,Generator,maven,插件
配置pom.xml插件
org.mybatis.generator
mybatis-generator-maven-plugin
1.3.5
src/main/resources/mybatisgen.xml
true
true
Generate MyBatis Artifacts
generate
mysql
mysql-connector-java
5.1.39
资源路径下配置mybatisgen.xml
/p>
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
defaultModelType="flat">
connectionURL="jdbc:mysql://localhost:3306/clouddisk" userId="root"
password="123">
targetPackage="com.clouddisk.dao" targetProject="src/main/java">
配置run configuration
enter description here
enter description here
enter description here
其他
生成后的插入sql写法是这样的
SELECT LAST_INSERT_ID()
insert into p_file_index (file_size, create_time, p_name,
p_path, file_md5)
values (#{fileSize,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{pName,jdbcType=VARBINARY},
#{pPath,jdbcType=VARBINARY}, #{fileMd5,jdbcType=VARBINARY})
相关资料