<?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="D:\MysqlJdbcconnector/mysql-connector-java-5.1.41-bin.jar" /> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressDate" value="true"/> <property name="suppressAllComments" value="true"/> </commentGenerator> <!--数据库链接地址账号密码--> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/pet_hospital" userId="root" password="112233"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!--生成Model类存放位置--> <javaModelGenerator targetPackage="com.qianfeng.bean" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <!--生成映射文件存放位置--> <sqlMapGenerator targetPackage="com.qianfeng.bean" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <!--生成DaoMapper类存放位置--> <javaClientGenerator type="XMLMAPPER" targetPackage="com.qiafeng.dao" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <!--生成对应表及类名,需要记住的一点是逆向工程无法生成关联关系,只能生成单表操作--> <table tableName="owners" domainObjectName="Owners" ></table> <table tableName="pets" domainObjectName="Pets" ></table> <table tableName="types" domainObjectName="Types" ></table> <table tableName="employee" domainObjectName="Employee" ></table> <table tableName="specialties" domainObjectName="Specialties" ></table> <table tableName="vets" domainObjectName="Vets" ></table> <table tableName="visits" domainObjectName="Visits" ></table> <table tableName="vet_specialties" domainObjectName="VetSpecialties" ></table> </context> </generatorConfiguration>
public static void generator() throws Exception{
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
//项目根路径不要有中文,我的有中文,所以使用绝对路径
File configFile = new File("src/main/resources/genreatorConfig.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);
}
public static void main(String[] args) {
try {
generator();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有