ctx = new HashMap<>();
+ ctx.put("className", result.getClassName() == null ? "" : result.getClassName());
+ ctx.put("tableName", result.getTableName() == null ? "" : result.getTableName());
+ return ctx;
+ }
+}
diff --git a/src/main/java/com/softdev/system/generator/entity/dto/CodeGenResult.java b/src/main/java/com/softdev/system/generator/entity/dto/CodeGenResult.java
new file mode 100644
index 0000000..57a392a
--- /dev/null
+++ b/src/main/java/com/softdev/system/generator/entity/dto/CodeGenResult.java
@@ -0,0 +1,37 @@
+package com.softdev.system.generator.entity.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+/**
+ * 代码生成结果封装
+ *
+ * 携带:渲染后的代码、模板 fileName 模板、模板分组,供 ZIP 打包 / 单文件下载等场景使用。
+ *
+ * @author zhengkai.blog.csdn.net
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class CodeGenResult {
+
+ /** 表名(原始或处理后) */
+ private String tableName;
+
+ /** 类名 */
+ private String className;
+
+ /** 渲染结果:key=template.name, value=渲染后的内容 */
+ private Map generatedCode;
+
+ /** 模板 fileName 配置:key=template.name, value=fileName 模板(可含 ${className} 占位符) */
+ private Map fileNameTemplates;
+
+ /** 模板分组:key=template.name, value=group */
+ private Map groupByTemplate;
+}
diff --git a/src/main/java/com/softdev/system/generator/service/CodeGenService.java b/src/main/java/com/softdev/system/generator/service/CodeGenService.java
index 0afd73f..a8e5bf9 100644
--- a/src/main/java/com/softdev/system/generator/service/CodeGenService.java
+++ b/src/main/java/com/softdev/system/generator/service/CodeGenService.java
@@ -1,6 +1,7 @@
package com.softdev.system.generator.service;
import com.softdev.system.generator.entity.dto.ClassInfo;
+import com.softdev.system.generator.entity.dto.CodeGenResult;
import com.softdev.system.generator.entity.dto.ParamInfo;
import com.softdev.system.generator.entity.vo.ResultVo;
@@ -14,20 +15,29 @@ import java.util.Map;
public interface CodeGenService {
/**
- * 生成代码
+ * 生成代码(前端在线预览版本)
*
* @param paramInfo 参数信息
- * @return 生成的代码映射
+ * @return 生成的代码映射(key=模板名, value=渲染内容)
* @throws Exception 生成过程中的异常
*/
ResultVo generateCode(ParamInfo paramInfo) throws Exception;
/**
- * 根据参数获取结果
+ * 解析表结构(仅解析,不生成)
*
- * @param params 参数映射
- * @return 结果映射
+ * @param paramInfo 参数信息
+ * @return 类信息
+ * @throws Exception 解析异常
+ */
+ ClassInfo parseTableStructure(ParamInfo paramInfo) throws Exception;
+
+ /**
+ * 根据参数获取结果(富信息版本,包含模板分组与 fileName 配置)
+ *
+ * @param params 参数映射(含 classInfo、tableName 等)
+ * @return CodeGenResult
* @throws Exception 处理过程中的异常
*/
- Map getResultByParams(Map params) throws Exception;
-}
\ No newline at end of file
+ CodeGenResult getResultByParams(Map params) throws Exception;
+}
diff --git a/src/main/java/com/softdev/system/generator/service/ZipService.java b/src/main/java/com/softdev/system/generator/service/ZipService.java
new file mode 100644
index 0000000..84e8dcc
--- /dev/null
+++ b/src/main/java/com/softdev/system/generator/service/ZipService.java
@@ -0,0 +1,27 @@
+package com.softdev.system.generator.service;
+
+import java.util.Map;
+
+/**
+ * ZIP 打包服务接口
+ *
+ * @author zhengkai.blog.csdn.net
+ */
+public interface ZipService {
+
+ /**
+ * 将已生成的代码结果(key=模板名, value=渲染后内容)打包为 ZIP
+ *
+ * @param generatedCode 模板渲染结果(key=template.name, value=内容)
+ * @param fileNameTemplates 模板元数据(key=template.name, value=fileName 模板,可含 ${className} 占位符,可为 null)
+ * @param groupByTemplate 模板元数据(key=template.name, value=group 名称)
+ * @param zipFileName 最终 zip 文件名(不含后缀)
+ * @param context 解析占位符的上下文(至少含 className、tableName)
+ * @return zip 字节数组
+ */
+ byte[] buildZip(Map generatedCode,
+ Map fileNameTemplates,
+ Map groupByTemplate,
+ String zipFileName,
+ Map context);
+}
diff --git a/src/main/java/com/softdev/system/generator/service/impl/CodeGenServiceImpl.java b/src/main/java/com/softdev/system/generator/service/impl/CodeGenServiceImpl.java
index 3ad3e34..311d19f 100644
--- a/src/main/java/com/softdev/system/generator/service/impl/CodeGenServiceImpl.java
+++ b/src/main/java/com/softdev/system/generator/service/impl/CodeGenServiceImpl.java
@@ -3,6 +3,7 @@ package com.softdev.system.generator.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.softdev.system.generator.entity.dto.ClassInfo;
+import com.softdev.system.generator.entity.dto.CodeGenResult;
import com.softdev.system.generator.entity.dto.ParamInfo;
import com.softdev.system.generator.entity.enums.ParserTypeEnum;
import com.softdev.system.generator.entity.vo.ResultVo;
@@ -16,7 +17,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -40,18 +41,11 @@ public class CodeGenServiceImpl implements CodeGenService {
}
try {
- // 1. Parse Table Structure 表结构解析
- ClassInfo classInfo = parseTableStructure(paramInfo);
-
- // 2. Set the params 设置表格参数
- paramInfo.getOptions().put("classInfo", classInfo);
- paramInfo.getOptions().put("tableName", classInfo == null ? System.currentTimeMillis() + "" : classInfo.getTableName());
-
- // 3. generate the code by freemarker templates with parameters .
- // Freemarker根据参数和模板生成代码
- Map result = getResultByParams(paramInfo.getOptions());
- log.info("table:{} - time:{} ", MapUtil.getString(result, "tableName"), System.currentTimeMillis());
- return ResultVo.ok(result);
+ CodeGenResult result = doGenerate(paramInfo);
+ Map generatedCode = result.getGeneratedCode();
+ generatedCode.put("tableName", result.getTableName());
+ log.info("table:{} - time:{} ", result.getTableName(), System.currentTimeMillis());
+ return ResultVo.ok(generatedCode);
} catch (Exception e) {
log.error("代码生成失败", e);
return ResultVo.error("代码生成失败: " + e.getMessage());
@@ -59,65 +53,93 @@ public class CodeGenServiceImpl implements CodeGenService {
}
@Override
- public Map getResultByParams(Map params) throws Exception {
- Map result = new HashMap<>(32);
- result.put("tableName", MapUtil.getString(params, "tableName"));
+ public ClassInfo parseTableStructure(ParamInfo paramInfo) throws Exception {
+ if (paramInfo.getTableSql() == null || paramInfo.getTableSql().isEmpty()) {
+ throw new IllegalArgumentException("表结构信息为空");
+ }
+ return parseByType(paramInfo);
+ }
+
+ @Override
+ public CodeGenResult getResultByParams(Map params) throws Exception {
+ CodeGenResult.CodeGenResultBuilder builder = CodeGenResult.builder();
+
+ Map generatedCode = new LinkedHashMap<>();
+ Map fileNameTemplates = new LinkedHashMap<>();
+ Map groupByTemplate = new LinkedHashMap<>();
+
+ generatedCode.put("tableName", MapUtil.getString(params, "tableName"));
- // 处理模板生成逻辑
- // 解析模板配置并生成代码
JSONArray parentTemplates = templateService.getAllTemplates();
for (int i = 0; i < parentTemplates.size(); i++) {
JSONObject parentTemplateObj = parentTemplates.getJSONObject(i);
+ String group = parentTemplateObj.getString("group");
JSONArray childTemplates = parentTemplateObj.getJSONArray("templates");
if (childTemplates != null) {
for (int x = 0; x < childTemplates.size(); x++) {
JSONObject childTemplate = childTemplates.getJSONObject(x);
- String templatePath = parentTemplateObj.getString("group") + "/" + childTemplate.getString("name") + ".ftl";
- String generatedCode = FreemarkerUtil.processString(templatePath, params);
- result.put(childTemplate.getString("name"), generatedCode);
+ String templateName = childTemplate.getString("name");
+ String templatePath = group + "/" + templateName + ".ftl";
+ String generatedText = FreemarkerUtil.processString(templatePath, params);
+ generatedCode.put(templateName, generatedText);
+ fileNameTemplates.put(templateName, childTemplate.getString("fileName"));
+ groupByTemplate.put(templateName, group);
}
}
}
-
- return result;
+
+ Object classInfo = params.get("classInfo");
+ String className = null;
+ if (classInfo instanceof ClassInfo) {
+ className = ((ClassInfo) classInfo).getClassName();
+ }
+ if (className == null) {
+ className = MapUtil.getString(params, "tableName");
+ }
+ return builder
+ .tableName(MapUtil.getString(params, "tableName"))
+ .className(className)
+ .generatedCode(generatedCode)
+ .fileNameTemplates(fileNameTemplates)
+ .groupByTemplate(groupByTemplate)
+ .build();
+ }
+
+ /**
+ * 共享的生成逻辑:先解析,再调用 getResultByParams
+ */
+ private CodeGenResult doGenerate(ParamInfo paramInfo) throws Exception {
+ ClassInfo classInfo = parseByType(paramInfo);
+
+ paramInfo.getOptions().put("classInfo", classInfo);
+ paramInfo.getOptions().put("tableName", classInfo == null ? System.currentTimeMillis() + "" : classInfo.getTableName());
+
+ return getResultByParams(paramInfo.getOptions());
}
/**
* 根据不同的解析类型解析表结构
- *
- * @param paramInfo 参数信息
- * @return 类信息
- * @throws Exception 解析异常
*/
- private ClassInfo parseTableStructure(ParamInfo paramInfo) throws Exception {
+ private ClassInfo parseByType(ParamInfo paramInfo) throws Exception {
String dataType = MapUtil.getString(paramInfo.getOptions(), "dataType");
ParserTypeEnum parserType = ParserTypeEnum.fromValue(dataType);
-
- // 添加调试信息
log.debug("解析数据类型: {}, 解析结果: {}", dataType, parserType);
switch (parserType) {
case SQL:
- // 默认模式:parse DDL table structure from sql
return sqlParserService.processTableIntoClassInfo(paramInfo);
case JSON:
- // JSON模式:parse field from json string
return jsonParserService.processJsonToClassInfo(paramInfo);
case INSERT_SQL:
- // INSERT SQL模式:parse field from insert sql
return sqlParserService.processInsertSqlToClassInfo(paramInfo);
case SQL_REGEX:
- // 正则表达式模式(非完善版本):parse sql by regex
return sqlParserService.processTableToClassInfoByRegex(paramInfo);
case SELECT_SQL:
- // SelectSqlBySQLPraser模式:parse select sql by JSqlParser
return sqlParserService.generateSelectSqlBySQLPraser(paramInfo);
case CREATE_SQL:
- // CreateSqlBySQLPraser模式:parse create sql by JSqlParser
return sqlParserService.generateCreateSqlBySQLPraser(paramInfo);
default:
- // 默认模式:parse DDL table structure from sql
return sqlParserService.processTableIntoClassInfo(paramInfo);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/softdev/system/generator/service/impl/ZipServiceImpl.java b/src/main/java/com/softdev/system/generator/service/impl/ZipServiceImpl.java
new file mode 100644
index 0000000..08023a4
--- /dev/null
+++ b/src/main/java/com/softdev/system/generator/service/impl/ZipServiceImpl.java
@@ -0,0 +1,96 @@
+package com.softdev.system.generator.service.impl;
+
+import com.softdev.system.generator.service.ZipService;
+import com.softdev.system.generator.util.ZipFileNameResolver;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * ZIP 打包服务实现类
+ *
+ * 使用 JDK 自带 ZipOutputStream 打包,零依赖。
+ *
+ * 目录结构:{group}/{fileName},同名文件自动加序号去重。
+ *
+ * @author zhengkai.blog.csdn.net
+ */
+@Slf4j
+@Service
+public class ZipServiceImpl implements ZipService {
+
+ @Override
+ public byte[] buildZip(Map generatedCode,
+ Map fileNameTemplates,
+ Map groupByTemplate,
+ String zipFileName,
+ Map context) {
+ if (generatedCode == null || generatedCode.isEmpty()) {
+ throw new IllegalArgumentException("没有可打包的生成内容");
+ }
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(64 * 1024);
+ Set usedPaths = new HashSet<>();
+ try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+ zos.setLevel(java.util.zip.Deflater.BEST_SPEED);
+ for (Map.Entry entry : generatedCode.entrySet()) {
+ String templateName = entry.getKey();
+ String content = entry.getValue();
+ if (content == null) {
+ continue;
+ }
+ String fileNameTpl = fileNameTemplates == null ? null : fileNameTemplates.get(templateName);
+ String group = groupByTemplate == null ? "generated" : groupByTemplate.getOrDefault(templateName, "generated");
+ String fileName = ZipFileNameResolver.resolve(fileNameTpl, templateName, group, context);
+ String entryPath = uniquePath(group, fileName, usedPaths);
+ writeEntry(zos, entryPath, content);
+ }
+ } catch (IOException e) {
+ log.error("ZIP 打包失败: zipFileName={}", zipFileName, e);
+ throw new RuntimeException("ZIP 打包失败: " + e.getMessage(), e);
+ }
+ return baos.toByteArray();
+ }
+
+ private void writeEntry(ZipOutputStream zos, String entryPath, String content) throws IOException {
+ ZipEntry zipEntry = new ZipEntry(entryPath);
+ zipEntry.setSize(content.getBytes(StandardCharsets.UTF_8).length);
+ zos.putNextEntry(zipEntry);
+ zos.write(content.getBytes(StandardCharsets.UTF_8));
+ zos.closeEntry();
+ }
+
+ /**
+ * 构造 entry 路径;遇到重名时加 _1 / _2 ...
+ */
+ private String uniquePath(String group, String fileName, Set used) {
+ String base = sanitizeGroup(group) + "/" + fileName;
+ if (used.add(base)) {
+ return base;
+ }
+ int dot = fileName.lastIndexOf('.');
+ String prefix = dot < 0 ? fileName : fileName.substring(0, dot);
+ String suffix = dot < 0 ? "" : fileName.substring(dot);
+ for (int i = 1; i < 1000; i++) {
+ String candidate = sanitizeGroup(group) + "/" + prefix + "_" + i + suffix;
+ if (used.add(candidate)) {
+ return candidate;
+ }
+ }
+ return sanitizeGroup(group) + "/" + System.nanoTime() + "_" + fileName;
+ }
+
+ private String sanitizeGroup(String group) {
+ if (group == null || group.trim().isEmpty()) {
+ return "generated";
+ }
+ return group.trim().replaceAll("[\\\\/:*?\"<>|\\r\\n\\t]", "_");
+ }
+}
diff --git a/src/main/java/com/softdev/system/generator/util/ZipFileNameResolver.java b/src/main/java/com/softdev/system/generator/util/ZipFileNameResolver.java
new file mode 100644
index 0000000..d3d741b
--- /dev/null
+++ b/src/main/java/com/softdev/system/generator/util/ZipFileNameResolver.java
@@ -0,0 +1,148 @@
+package com.softdev.system.generator.util;
+
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 文件名解析器
+ *
+ * 解析模板配置中的 fileName 字段,支持 ${className}、${tableName}、${group}、${name} 占位符。
+ *
+ * 解析规则:
+ *
+ * - 若 fileName 中含 ${xxx} 占位符,则按占位符从 context 解析
+ * - 若 fileName 为空,则根据 template.name + group 自动推断(兜底策略)
+ * - 自动清理非法字符,确保可作为文件名
+ *
+ *
+ * @author zhengkai.blog.csdn.net
+ */
+public final class ZipFileNameResolver {
+
+ private static final Pattern PLACEHOLDER = Pattern.compile("\\$\\{([^}]+)\\}");
+
+ private static final Pattern INVALID_FILE_NAME_CHARS = Pattern.compile("[\\\\/:*?\"<>|\\r\\n\\t]");
+
+ private ZipFileNameResolver() {
+ }
+
+ /**
+ * 解析文件名
+ *
+ * @param fileNameTemplate 模板配置中的 fileName(可为 null/空)
+ * @param templateName 模板 name(如 controller / model / mapper)
+ * @param group 模板 group(如 mybatis / jpa / ui)
+ * @param context 占位符上下文(至少含 className、tableName)
+ * @return 最终文件名(不含路径)
+ */
+ public static String resolve(String fileNameTemplate,
+ String templateName,
+ String group,
+ Map context) {
+ String raw = (fileNameTemplate == null || fileNameTemplate.trim().isEmpty())
+ ? guessByConvention(templateName, group, context)
+ : fileNameTemplate;
+
+ String resolved = replacePlaceholders(raw, context);
+ return sanitize(resolved, templateName, group, context);
+ }
+
+ /**
+ * 兜底策略:根据模板名 + 分组推断文件名
+ */
+ private static String guessByConvention(String templateName, String group, Map context) {
+ String className = stringOf(context, "className");
+ if (className == null || className.isEmpty()) {
+ className = stringOf(context, "tableName");
+ }
+ if (className == null || className.isEmpty()) {
+ className = "Generated";
+ }
+ String ext = guessExtension(templateName, group);
+ if (ext == null || ext.isEmpty()) {
+ return className + "-" + templateName;
+ }
+ return className + ext;
+ }
+
+ /**
+ * 推断文件后缀
+ */
+ private static String guessExtension(String templateName, String group) {
+ if (group != null) {
+ switch (group.toLowerCase()) {
+ case "ui":
+ case "renren-fast":
+ return "-" + templateName + ".html";
+ case "bi":
+ case "cloud":
+ return "-" + templateName + ".txt";
+ default:
+ break;
+ }
+ }
+ if (templateName == null) {
+ return ".txt";
+ }
+ if (templateName.contains("xml") || templateName.endsWith("-xml")) {
+ return ".xml";
+ }
+ if (templateName.contains("yml") || templateName.contains("yaml")) {
+ return ".yml";
+ }
+ if (templateName.contains("sql")) {
+ return ".sql";
+ }
+ if (templateName.contains("vue")) {
+ return ".vue";
+ }
+ if (templateName.contains("json")) {
+ return ".json";
+ }
+ if (templateName.contains("md")) {
+ return ".md";
+ }
+ return ".java";
+ }
+
+ private static String replacePlaceholders(String input, Map context) {
+ if (input == null || !input.contains("${")) {
+ return input;
+ }
+ Matcher matcher = PLACEHOLDER.matcher(input);
+ StringBuilder sb = new StringBuilder();
+ while (matcher.find()) {
+ String key = matcher.group(1);
+ String value = stringOf(context, key);
+ if (value == null) {
+ value = "";
+ }
+ matcher.appendReplacement(sb, Matcher.quoteReplacement(value));
+ }
+ matcher.appendTail(sb);
+ return sb.toString();
+ }
+
+ /**
+ * 清理非法字符;如果清理后为空则使用兜底
+ */
+ private static String sanitize(String fileName, String templateName, String group, Map context) {
+ if (fileName == null) {
+ return guessByConvention(templateName, group, context);
+ }
+ String cleaned = INVALID_FILE_NAME_CHARS.matcher(fileName).replaceAll("_").trim();
+ if (cleaned.isEmpty() || ".".equals(cleaned) || "..".equals(cleaned)) {
+ return guessByConvention(templateName, group, context);
+ }
+ return cleaned;
+ }
+
+ private static String stringOf(Map map, String key) {
+ if (map == null || key == null) {
+ return null;
+ }
+ Object v = map.get(key);
+ return v == null ? null : v.toString();
+ }
+}
diff --git a/src/main/resources/statics/js/main.js b/src/main/resources/statics/js/main.js
index 3ed97be..e892845 100644
--- a/src/main/resources/statics/js/main.js
+++ b/src/main/resources/statics/js/main.js
@@ -151,6 +151,54 @@ const vm = new Vue({
},
copy : function (){
navigator.clipboard.writeText(vm.outputStr.trim()).then(r => {alert("已复制")});
+ },
+ //download all generated code as ZIP
+ downloadZip : function (){
+ //get value from codemirror
+ vm.formData.tableSql=$.inputArea.getValue();
+ if(!vm.formData.tableSql || vm.formData.tableSql.trim().length<5){
+ error("请先输入 SQL/JSON/INSERT 语句");
+ return;
+ }
+ // 用 axios 发起请求,responseType: 'blob' 让浏览器把响应当作二进制流处理
+ axios.post(basePath+"/code/generate-zip", vm.formData, {responseType: 'blob', timeout: 60000})
+ .then(function(res){
+ if(res.status !== 200){
+ error("下载失败,HTTP 状态码:"+res.status);
+ return;
+ }
+ //尝试从 Content-Disposition 中解析文件名
+ var dispo = res.headers && (res.headers['content-disposition'] || res.headers['Content-Disposition']);
+ var fileName = "code-generator.zip";
+ if(dispo){
+ var matchStar = /filename\*=UTF-8''([^;]+)/i.exec(dispo);
+ var matchQuoted = /filename="?([^";]+)"?/i.exec(dispo);
+ if(matchStar && matchStar[1]){
+ fileName = decodeURIComponent(matchStar[1]);
+ }else if(matchQuoted && matchQuoted[1]){
+ fileName = matchQuoted[1];
+ }
+ }
+ // 创建 Blob 并触发浏览器下载
+ var blob = new Blob([res.data], {type: 'application/zip'});
+ if(window.navigator && window.navigator.msSaveBlob){
+ window.navigator.msSaveBlob(blob, fileName);
+ }else{
+ var url = window.URL.createObjectURL(blob);
+ var a = document.createElement('a');
+ a.href = url;
+ a.download = fileName;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ }
+ alert("已下载:"+fileName);
+ })
+ .catch(function(err){
+ console.error(err);
+ error("下载失败:"+(err && err.message ? err.message : '未知错误'));
+ });
}
},
created: function () {
diff --git a/src/main/resources/template.json b/src/main/resources/template.json
index 54ff69e..84d6667 100644
--- a/src/main/resources/template.json
+++ b/src/main/resources/template.json
@@ -3,27 +3,32 @@
"templates": [{
"id": "10",
"name": "swagger-ui",
- "description": "swagger-ui"
+ "description": "swagger-ui",
+ "fileName": "swagger-ui.json"
},
{
"id": "11",
"name": "element-ui",
- "description": "element-ui"
+ "description": "element-ui",
+ "fileName": "${className}-element-ui.html"
},
{
"id": "12",
"name": "bootstrap-ui",
- "description": "bootstrap-ui"
+ "description": "bootstrap-ui",
+ "fileName": "${className}-bootstrap-ui.html"
},
{
"id": "13",
"name": "layui-edit",
- "description": "layui-edit"
+ "description": "layui-edit",
+ "fileName": "${className}-layui-edit.html"
},
{
"id": "14",
"name": "layui-list",
- "description": "layui-list"
+ "description": "layui-list",
+ "fileName": "${className}-layui-list.html"
}
]
},
@@ -32,37 +37,44 @@
"templates": [{
"id": "20",
"name": "controller",
- "description": "controller"
+ "description": "controller",
+ "fileName": "${className}Controller.java"
},
{
"id": "21",
"name": "service",
- "description": "service"
+ "description": "service",
+ "fileName": "${className}Service.java"
},
{
"id": "22",
"name": "service_impl",
- "description": "service_impl"
+ "description": "service_impl",
+ "fileName": "${className}ServiceImpl.java"
},
{
"id": "23",
"name": "mapper",
- "description": "mapper"
+ "description": "mapper",
+ "fileName": "${className}Mapper.java"
},
{
"id": "24",
"name": "mybatis",
- "description": "mybatis"
+ "description": "mybatis",
+ "fileName": "${className}Mapper.xml"
},
{
"id": "25",
"name": "model",
- "description": "model"
+ "description": "model",
+ "fileName": "${className}.java"
},
{
"id": "26",
"name": "mapper2",
- "description": "mapper annotation"
+ "description": "mapper annotation",
+ "fileName": "${className}Mapper2.java"
}
]
},
@@ -71,17 +83,20 @@
"templates": [{
"id": "30",
"name": "entity",
- "description": "entity"
+ "description": "entity",
+ "fileName": "${className}.java"
},
{
"id": "31",
"name": "repository",
- "description": "repository"
+ "description": "repository",
+ "fileName": "${className}Repository.java"
},
{
"id": "32",
"name": "jpacontroller",
- "description": "jpacontroller"
+ "description": "jpacontroller",
+ "fileName": "${className}Controller.java"
}
]
},
@@ -91,12 +106,14 @@
"templates": [{
"id": "40",
"name": "jtdao",
- "description": "jtdao"
+ "description": "jtdao",
+ "fileName": "${className}Dao.java"
},
{
"id": "41",
"name": "jtdaoimpl",
- "description": "jtdaoimpl"
+ "description": "jtdaoimpl",
+ "fileName": "${className}DaoImpl.java"
}
]
},
@@ -106,17 +123,20 @@
"templates": [{
"id": "50",
"name": "beetlmd",
- "description": "beetlmd"
+ "description": "beetlmd",
+ "fileName": "${className}.md"
},
{
"id": "51",
"name": "beetlentity",
- "description": "beetlentity"
+ "description": "beetlentity",
+ "fileName": "${className}.java"
},
{
"id": "52",
"name": "beetlcontroller",
- "description": "beetlcontroller"
+ "description": "beetlcontroller",
+ "fileName": "${className}Controller.java"
}
]
},
@@ -126,22 +146,26 @@
"templates": [{
"id": "60",
"name": "pluscontroller",
- "description": "pluscontroller"
+ "description": "pluscontroller",
+ "fileName": "${className}Controller.java"
},
{
"id": "61",
"name": "plusservice",
- "description": "plusservice"
+ "description": "plusservice",
+ "fileName": "${className}Service.java"
},
{
"id": "62",
"name": "plusmapper",
- "description": "plusmapper"
+ "description": "plusmapper",
+ "fileName": "${className}Mapper.java"
},
{
"id": "63",
"name": "plusentity",
- "description": "plusentity"
+ "description": "plusentity",
+ "fileName": "${className}.java"
}
]
},
@@ -151,27 +175,32 @@
"templates": [{
"id": "70",
"name": "beanutil",
- "description": "beanutil"
+ "description": "beanutil",
+ "fileName": "${className}BeanUtil.txt"
},
{
"id": "71",
"name": "json",
- "description": "json"
+ "description": "json",
+ "fileName": "${className}.json"
},
{
"id": "72",
"name": "xml",
- "description": "xml"
+ "description": "xml",
+ "fileName": "${className}.xml"
},
{
"id": "73",
"name": "sql",
- "description": "sql"
+ "description": "sql",
+ "fileName": "${className}.sql"
},
{
"id": "74",
"name": "swagger-yml",
- "description": "swagger-yml"
+ "description": "swagger-yml",
+ "fileName": "swagger.yml"
}
]
},
@@ -181,12 +210,14 @@
"templates": [{
"id": "81",
"name": "tkentity",
- "description": "tkentity"
+ "description": "tkentity",
+ "fileName": "${className}.java"
},
{
"id": "82",
"name": "tkmapper",
- "description": "tkmapper"
+ "description": "tkmapper",
+ "fileName": "${className}Mapper.java"
}
]
},
@@ -196,37 +227,50 @@
"templates": [{
"id": "91",
"name": "menu-sql",
- "description": "menu-sql"
+ "description": "menu-sql",
+ "fileName": "menu.sql"
},
{
"id": "92",
"name": "vue-list",
- "description": "vue-list"
+ "description": "vue-list",
+ "fileName": "${className}-list.vue"
},
{
"id": "93",
"name": "vue-edit",
- "description": "vue-edit"
+ "description": "vue-edit",
+ "fileName": "${className}-edit.vue"
},
{
"id": "94",
"name": "rr-controller",
- "description": "rr-controller"
+ "description": "rr-controller",
+ "fileName": "${className}Controller.java"
},
{
"id": "95",
"name": "rr-dao",
- "description": "rr-dao"
+ "description": "rr-dao",
+ "fileName": "${className}Dao.java"
},
{
"id": "96",
"name": "rr-daoxml",
- "description": "rr-daoxml"
+ "description": "rr-daoxml",
+ "fileName": "${className}Dao.xml"
},
{
"id": "97",
"name": "rr-service",
- "description": "rr-service"
+ "description": "rr-service",
+ "fileName": "${className}Service.java"
+ },
+ {
+ "id": "98",
+ "name": "rr-entity",
+ "description": "rr-entity",
+ "fileName": "${className}.java"
}
]
},
@@ -235,17 +279,20 @@
"templates": [{
"id": "101",
"name": "starp-entity",
- "description": "entity"
+ "description": "entity",
+ "fileName": "${className}.java"
},
{
"id": "102",
"name": "starp-repository",
- "description": "repository"
+ "description": "repository",
+ "fileName": "${className}Repository.java"
},
{
"id": "103",
"name": "starp-jpa-controller",
- "description": "jpacontroller"
+ "description": "jpacontroller",
+ "fileName": "${className}Controller.java"
}
]
},
@@ -254,7 +301,8 @@
"templates": [{
"id": "201",
"name": "qliksense",
- "description": "qlik sense"
+ "description": "qlik sense",
+ "fileName": "qliksense.txt"
}]
},
{
@@ -263,12 +311,14 @@
{
"id": "301",
"name": "bigquery",
- "description": "GCP BigQuery"
+ "description": "GCP BigQuery",
+ "fileName": "bigquery.sql"
},
{
"id": "302",
"name": "dataflowjjs",
- "description": "GCP Dataflow JJS"
+ "description": "GCP Dataflow JJS",
+ "fileName": "dataflow.jjs"
}
]
},
@@ -278,18 +328,21 @@
{
"id": "401",
"name": "tk-entity",
- "description": "tk-entity"
+ "description": "tk-entity",
+ "fileName": "${className}.java"
},
{
"id": "402",
"name": "tk-mapper",
- "description": "tk-mapper"
+ "description": "tk-mapper",
+ "fileName": "${className}Mapper.java"
},
{
"id": "403",
"name": "tk-controller",
- "description": "tk-controller"
+ "description": "tk-controller",
+ "fileName": "${className}Controller.java"
}
]
}
-]
\ No newline at end of file
+]
diff --git a/src/main/resources/templates/newui2.html b/src/main/resources/templates/newui2.html
index 93f5ee7..6d3c92f 100644
--- a/src/main/resources/templates/newui2.html
+++ b/src/main/resources/templates/newui2.html
@@ -178,6 +178,7 @@