生成效果
mybatis3代码生成
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>
<classPathEntry
location="F:\软件\mysql-jar\mysql-connector-java-5.1.45\mysql-connector-java-5.1.45-bin.jar" />
<context id="context1" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/ht-oa?useSSL=false" userId="root" password="123456">
</jdbcConnection>
<javaModelGenerator targetPackage="com.liuyang.domain"
targetProject="src/main/java" />
<sqlMapGenerator targetPackage="sqlmapper"
targetProject="src/main/resources" />
<javaClientGenerator targetPackage="com.liuyang.repository"
targetProject="src/main/java" type="XMLMAPPER" />
<!-- shema 数据库 tableName表明 -->
<table schema="oa_product" tableName="staff" />
<table schema="hjy_pom" tableName="benefits_formula" />
<table schema="hjy_pom" tableName="benefits_share" />
<table schema="hjy_pom" tableName="business_tree" />
<table schema="hjy_pom" tableName="company" />
<table schema="hjy_pom" tableName="dictionary_type" />
<table schema="hjy_pom" tableName="dictionary_data" />
<table schema="hjy_pom" tableName="entrust_company" />
<table schema="hjy_pom" tableName="entrust_contract" />
<table schema="hjy_pom" tableName="entrust_contract_company_ref" />
<table schema="hjy_pom" tableName="entrust_cooperate" />
<table schema="hjy_pom" tableName="entrust_pay" />
<table schema="hjy_pom" tableName="flow" />
<table schema="hjy_pom" tableName="expert" />
<table schema="hjy_pom" tableName="flow_record" />
<table schema="hjy_pom" tableName="invoice_record" />
<table schema="hjy_pom" tableName="main_contract" />
<table schema="hjy_pom" tableName="main_contract_plan" />
<table schema="hjy_pom" tableName="mian_contract_company" />
<table schema="hjy_pom" tableName="pay_record" />
<table schema="hjy_pom" tableName="project" />
<table schema="hjy_pom" tableName="receivable_record" />
<table schema="hjy_pom" tableName="tendering_bid" />
<table schema="hjy_pom" tableName="permission" />
<table schema="hjy_pom" tableName="role" />
<table schema="hjy_pom" tableName="role_permission_ref" />
<table schema="hjy_pom" tableName="user_role" />
<table schema="hjy_pom" tableName="user_role_ref" />
<table schema="hjy_pom" tableName="company_people" />
<table schema="hjy_pom" tableName="company_equipment" />
<table schema="gza_srms" tableName="user_copy" />
</context>
</generatorConfiguration>
需要下载mysql驱动:https://downloads.mysql.com/archives/c-j/
pom 依赖和插件
<build>
<finalName>gza-srms</finalName>
<plugins>
<!-- Srping Boot 打包工具 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 没有该配置,devtools 不生效 -->
<fork>true</fork>
<addResources>true</addResources>
</configuration>