提交 | 用户 | age
|
9e1c8d
|
1 |
package com.hx.other.service; |
G |
2 |
|
|
3 |
import com.hx.auto.GeneratorUtil; |
|
4 |
import com.hx.auto.common.UrlData; |
|
5 |
import com.hx.other.service.model.*; |
|
6 |
|
|
7 |
/** |
|
8 |
* 代码自动生成工具 |
|
9 |
* @Author: cmg |
|
10 |
* @Date: 2023/4/19 17:00 |
|
11 |
*/ |
|
12 |
public class AutoDomeUtil { |
|
13 |
|
|
14 |
public static void main(String[] args) throws Exception { |
|
15 |
|
|
16 |
String packageName = AutoDomeUtil.class.getPackage().getName(); |
|
17 |
String packRoot = "src.main.java"; |
|
18 |
String commonPackRootResourse = "src.main.resources"; |
|
19 |
|
|
20 |
UrlData urlData = new UrlData(); |
|
21 |
// 替换此处名字 |
|
22 |
urlData.setTotalUrl(packageName); |
|
23 |
urlData.actionUrlData(packRoot,packageName + ".controller"); |
|
24 |
urlData.daoUrlData(packRoot,packageName + ".dao.mapper"); |
|
25 |
urlData.serviceUrlData(packRoot,packageName + ".service" ); |
|
26 |
urlData.serviceImplUrlData(packRoot,packageName +".service"+".impl"); |
|
27 |
urlData.mapperUrlData(commonPackRootResourse, "mapper"); |
|
28 |
|
|
29 |
Class<?>[] arr = new Class[]{ |
|
30 |
PerformanceInfo.class, User.class, OrdersTotal.class, Employee.class, QueryRecord.class, SqlQueryTemp.class |
|
31 |
}; |
|
32 |
|
|
33 |
for(Class clas : arr) { |
|
34 |
//dao |
|
35 |
GeneratorUtil.generatorDao(clas, urlData); |
|
36 |
//mapper |
|
37 |
GeneratorUtil.generatorMapper(clas, urlData); |
|
38 |
// 生成service |
|
39 |
GeneratorUtil.generatorService(clas, urlData); |
|
40 |
GeneratorUtil.generatorService(clas, urlData); |
|
41 |
} |
|
42 |
} |
|
43 |
} |