首页>代码>SSM框架自动生成CRUD模块,代码基于mysql数据库,通过maven管理java jar包>/createMapper/src/main/java/com/abchina/d2sx/utils/GeneratorSqlMapXml.java
01 | package com.abchina.d2sx.utils; |
02 |
03 |
04 | import java.io.File; |
05 | import java.util.ArrayList; |
06 | import java.util.List; |
07 |
08 | import org.mybatis.generator.api.MyBatisGenerator; |
09 | import org.mybatis.generator.config.Configuration; |
10 | import org.mybatis.generator.config.xml.ConfigurationParser; |
11 | import org.mybatis.generator.internal.DefaultShellCallback; |
12 |
13 | public class GeneratorSqlMapXml { |
14 |
15 | public void generator() throws Exception { |
16 | List<String> warnings = new ArrayList<String>(); |
17 | boolean overwrite = true ; |
18 | File configFile = new File( "src/main/resource/generatorConfig.xml" ); |
19 | ConfigurationParser cp = new ConfigurationParser(warnings); |
20 | Configuration config = cp.parseConfiguration(configFile); |
21 | DefaultShellCallback callback = new DefaultShellCallback(overwrite); |
22 | MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); |
23 | myBatisGenerator.generate( null ); |
24 | } |
25 | |
26 | /** |
27 | * @param args |
28 | */ |
29 | public static void main(String[] args) { |
30 | System.out.println(System.getProperty( "user.dir" )); |
31 | try { |
32 | GeneratorSqlMapXml generatorSqlMapXml = new GeneratorSqlMapXml(); |
33 | generatorSqlMapXml.generator(); |
34 | } catch (Exception e) { |
35 | e.printStackTrace(); |
36 | } |
37 | } |
38 |
39 | } |


3312djdad LV2
2024年11月11日
lun123456
2024年6月23日
暂无贡献等级
xzg123456 LV6
2024年6月19日
不不要 LV1
2024年5月15日
denliv_hui LV13
2024年4月26日
minjing123 LV8
2024年1月4日
微信网友_6786501704093696
2023年12月20日
暂无贡献等级
3334004690 LV10
2023年11月1日
woldxy LV12
2023年8月22日
苏拉德666 LV4
2023年5月14日