commit | author | age
|
9bcb19
|
1 |
/* |
I |
2 |
Copyright [2020] [https://www.xiaonuo.vip] |
|
3 |
|
|
4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
you may not use this file except in compliance with the License. |
|
6 |
You may obtain a copy of the License at |
|
7 |
|
|
8 |
http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
|
|
10 |
Unless required by applicable law or agreed to in writing, software |
|
11 |
distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
See the License for the specific language governing permissions and |
|
14 |
limitations under the License. |
|
15 |
|
|
16 |
Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
|
17 |
|
|
18 |
1.请不要删除和修改根目录下的LICENSE文件。 |
|
19 |
2.请不要删除和修改Snowy源码头部的版权声明。 |
|
20 |
3.请保留源码和相关描述文件的项目出处,作者声明等。 |
|
21 |
4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
|
22 |
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
|
23 |
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
|
24 |
*/ |
|
25 |
package vip.xiaonuo.generate.core.consts; |
|
26 |
|
|
27 |
|
|
28 |
import java.io.File; |
|
29 |
|
|
30 |
/** |
|
31 |
* 代码生成配置 |
|
32 |
* |
|
33 |
* @author yubaoshan |
|
34 |
* @date 2020-12-19 02:30:56 |
|
35 |
*/ |
|
36 |
public class GenConstant { |
|
37 |
|
|
38 |
/** |
|
39 |
* 路径分离(不通的机器,取不同的路径) |
|
40 |
*/ |
|
41 |
public static String FILE_SEP = File.separator; |
|
42 |
|
|
43 |
/** |
|
44 |
* 存放vm模板位置 |
|
45 |
*/ |
|
46 |
public static String templatePath = "template" + FILE_SEP; |
|
47 |
|
|
48 |
/** |
|
49 |
* 主键标识 |
|
50 |
*/ |
|
51 |
public static String DB_TABLE_COM_KRY = "PRI"; |
|
52 |
|
|
53 |
/** |
|
54 |
* 模块名(一般为modular,无特殊要求一般不改) |
|
55 |
*/ |
|
56 |
public static String MODULAR_NAME = "modular"; |
|
57 |
|
|
58 |
/** |
|
59 |
* 本项目生成时是否覆盖 |
|
60 |
*/ |
|
61 |
public static final boolean FLAG = false; |
|
62 |
|
|
63 |
/** |
|
64 |
* 大模块名称(生成到代码中哪个模块下) |
|
65 |
*/ |
|
66 |
public static String BASE_MODULAR_NAME = "snowy-main"; |
|
67 |
|
|
68 |
/** |
|
69 |
* java文件夹 |
|
70 |
*/ |
|
71 |
public static String BASE_JAVA_PATH = FILE_SEP + "src" + FILE_SEP + "main" + FILE_SEP + "java" + FILE_SEP; |
|
72 |
|
|
73 |
/** |
|
74 |
* vue文件夹 |
|
75 |
*/ |
|
76 |
public static String BASE_VUE_PATH = FILE_SEP + "_web" + FILE_SEP + "src" + FILE_SEP; |
|
77 |
|
|
78 |
/** |
|
79 |
* sql文件夹 |
|
80 |
*/ |
|
81 |
public static String BASE_SQL_PATH = FILE_SEP + "_sql" + FILE_SEP; |
|
82 |
|
|
83 |
/** |
|
84 |
* 代码生成路径 |
|
85 |
*/ |
|
86 |
public static String controllerPath; |
|
87 |
public static String entityPath; |
|
88 |
public static String enumsPath; |
|
89 |
public static String mapperPath; |
|
90 |
public static String mappingPath; |
|
91 |
public static String paramPath; |
|
92 |
public static String servicePath; |
|
93 |
public static String serviceImplPath; |
|
94 |
public static String manageJsPath; |
|
95 |
public static String vueIndexPath; |
|
96 |
public static String vueAddFromPath; |
|
97 |
public static String vueEditFromPath; |
|
98 |
public static String mysqlSqlPath; |
|
99 |
public static String oracleSqlPath; |
|
100 |
|
|
101 |
/** |
|
102 |
* 各个代码存放路径文件夹 |
|
103 |
*/ |
|
104 |
public static String[] xnCodeGenFilePath (String busName, String packageName) { |
|
105 |
String packageNameString = packageName.replace(".",FILE_SEP) + FILE_SEP; |
|
106 |
controllerPath = BASE_JAVA_PATH + packageNameString + MODULAR_NAME + FILE_SEP + busName + FILE_SEP + "controller" + FILE_SEP; |
|
107 |
entityPath = BASE_JAVA_PATH + packageNameString + MODULAR_NAME + FILE_SEP + busName + FILE_SEP + "entity" + FILE_SEP; |
|
108 |
enumsPath = BASE_JAVA_PATH+ packageNameString + MODULAR_NAME + FILE_SEP + busName + FILE_SEP + "enums" + FILE_SEP; |
|
109 |
mapperPath = BASE_JAVA_PATH + packageNameString + MODULAR_NAME + FILE_SEP + busName + FILE_SEP + "mapper" + FILE_SEP; |
|
110 |
mappingPath = mapperPath + FILE_SEP + "mapping" + FILE_SEP; |
|
111 |
paramPath = BASE_JAVA_PATH+ FILE_SEP + packageNameString + MODULAR_NAME + FILE_SEP + busName + FILE_SEP + "param" + FILE_SEP; |
|
112 |
servicePath = BASE_JAVA_PATH+ FILE_SEP + packageNameString + MODULAR_NAME + FILE_SEP + busName + FILE_SEP + "service" + FILE_SEP; |
|
113 |
serviceImplPath = servicePath + FILE_SEP + "impl" + FILE_SEP; |
|
114 |
manageJsPath = BASE_VUE_PATH + FILE_SEP + "api" + FILE_SEP + MODULAR_NAME + FILE_SEP + "main" + FILE_SEP + busName + FILE_SEP; |
|
115 |
vueIndexPath = BASE_VUE_PATH + FILE_SEP + "views" + FILE_SEP + "main" + FILE_SEP + busName + FILE_SEP; |
|
116 |
vueAddFromPath = BASE_VUE_PATH + FILE_SEP + "views" + FILE_SEP + "main" + FILE_SEP + busName + FILE_SEP; |
|
117 |
vueEditFromPath = BASE_VUE_PATH + FILE_SEP + "views" + FILE_SEP + "main" + FILE_SEP + busName + FILE_SEP; |
|
118 |
mysqlSqlPath = BASE_SQL_PATH; |
|
119 |
oracleSqlPath = BASE_SQL_PATH; |
|
120 |
return new String[] { |
|
121 |
controllerPath, entityPath, enumsPath, mapperPath, mappingPath, paramPath, servicePath, serviceImplPath, manageJsPath, vueIndexPath, vueAddFromPath, vueEditFromPath, mysqlSqlPath, oracleSqlPath |
|
122 |
}; |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* 模板文件 |
|
127 |
*/ |
|
128 |
public static String[] xnCodeGenTempFile = { |
|
129 |
"Controller.java.vm", |
|
130 |
"entity.java.vm", |
|
131 |
"ExceptionEnum.java.vm", |
|
132 |
"Mapper.java.vm", |
|
133 |
"Mapper.xml.vm", |
|
134 |
"Param.java.vm", |
|
135 |
"Service.java.vm", |
|
136 |
"ServiceImpl.java.vm", |
|
137 |
"Manage.js.vm", |
|
138 |
"index.vue.vm", |
|
139 |
"addForm.vue.vm", |
|
140 |
"editForm.vue.vm", |
|
141 |
"XnMysql.sql.vm", |
|
142 |
"XnOracle.sql.vm", |
|
143 |
}; |
|
144 |
|
|
145 |
/** |
|
146 |
* 本地项目根目录 |
|
147 |
*/ |
|
148 |
public static String getLocalPath () { |
|
149 |
return System.getProperty("user.dir") + FILE_SEP + BASE_MODULAR_NAME + FILE_SEP; |
|
150 |
} |
|
151 |
|
|
152 |
/** |
|
153 |
* vue前端 |
|
154 |
*/ |
|
155 |
public static String getLocalFrontPath () { |
|
156 |
return System.getProperty("user.dir") + FILE_SEP ; |
|
157 |
} |
|
158 |
} |