删除 http 文件.

This commit is contained in:
lijiahang
2024-07-17 13:35:04 +08:00
parent 0d46d81c4e
commit f75d097d8a
45 changed files with 22 additions and 1529 deletions

View File

@@ -310,8 +310,6 @@ public class CodeGenerator implements Executable {
new String[]{"/templates/orion-server-module-entity-request-update.java.vm", "${type}UpdateRequest.java", "entity.request.${bizPackage}"},
// query request 文件
new String[]{"/templates/orion-server-module-entity-request-query.java.vm", "${type}QueryRequest.java", "entity.request.${bizPackage}"},
// export 文件
new String[]{"/templates/orion-server-module-entity-export.java.vm", "${type}Export.java", "entity.export"},
// convert 文件
new String[]{"/templates/orion-server-module-convert.java.vm", "${type}Convert.java", "convert"},
// cache dto 文件

View File

@@ -113,7 +113,6 @@ public class CodeGeneratorEngine extends VelocityTemplateEngine {
apiComment.put("deleteById", "删除" + comment);
apiComment.put("deleteAll", "根据条件删除" + comment);
apiComment.put("batchDelete", "批量删除" + comment);
apiComment.put("export", "导出" + comment);
objectMap.put("apiComment", apiComment);
}

View File

@@ -46,6 +46,10 @@ public class CustomFileFilter {
.packageName(s.getPackageName())
.build())
.collect(Collectors.toList());
// 不生成 api http 文件
if (!table.isEnableApiHttp()) {
files.removeIf(file -> isApiHttpFile(file.getTemplatePath()));
}
// 不生成对外 api 文件
if (!table.isEnableProviderApi()) {
files.removeIf(file -> isServerProviderFile(file.getTemplatePath()));
@@ -139,13 +143,13 @@ public class CustomFileFilter {
}
/**
* 是否为导出文件
* 是否为 api http 文件
*
* @param templatePath templatePath
* @return 是否为导出文件
*/
public static boolean isExportFile(String templatePath) {
return templatePath.contains("orion-server-module-entity-export");
public static boolean isApiHttpFile(String templatePath) {
return templatePath.contains("orion-server-module-controller.http");
}
/**

View File

@@ -63,6 +63,16 @@ public class ServerTemplate extends Template {
return this;
}
/**
* 是否生成 api http 文件
*
* @return this
*/
public ServerTemplate enableApiHttp() {
table.enableApiHttp = true;
return this;
}
/**
* 是否生成对外 api
*

View File

@@ -33,6 +33,11 @@ public class Table {
*/
protected String bizPackage;
/**
* 是否生成 api http 文件
*/
protected boolean enableApiHttp;
/**
* 是否生成对外 api
*/

View File

@@ -1,65 +0,0 @@
package ${currentPackage};
import com.orion.lang.utils.time.Dates;
import com.orion.office.excel.annotation.ExportField;
import com.orion.office.excel.annotation.ExportSheet;
import com.orion.office.excel.annotation.ExportTitle;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.io.Serializable;
import java.util.*;
import java.math.*;
/**
* $!{table.comment} 导出对象
*
* @author ${author}
* @version ${version}
* @since ${date}
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ExportTitle(title = ${type}Export.TITLE)
@ExportSheet(name = "$!{table.comment}", filterHeader = true, freezeHeader = true, indexToSort = true)
@Schema(name = "${type}Export", description = "$!{table.comment}导出对象")
public class ${type}Export implements Serializable {
private static final long serialVersionUID = 1L;
public static final String TITLE = "$!{table.comment}导出";
#foreach($field in ${table.fields})
#if("$!field.comment" != "")
@Schema(description = "${field.comment}")
#end
#if("$field.propertyType" == "Date")
@ExportField(index = ${foreach.index}, header = "${field.comment}", width = 16, format = Dates.YMD_HMS)
#else
@ExportField(index = ${foreach.index}, header = "${field.comment}", width = 16)
#end
private ${field.propertyType} ${field.propertyName};
#end
@ExportField(index = $table.fields.size(), header = "创建时间", width = 16, format = Dates.YMD_HMS)
@Schema(description = "创建时间")
private Date createTime;
#set($updateTimeIndex=$table.fields.size() + 1)
@Schema(description = "修改时间")
@ExportField(index = $updateTimeIndex, header = "修改时间", width = 16, format = Dates.YMD_HMS)
private Date updateTime;
#set($creatorIndex=$table.fields.size() + 2)
@Schema(description = "创建人")
@ExportField(index = $creatorIndex, header = "创建人", width = 16)
private String creator;
#set($updaterIndex=$table.fields.size() + 3)
@Schema(description = "修改人")
@ExportField(index = $updaterIndex, header = "修改人", width = 16)
private String updater;
}

View File

@@ -26,7 +26,3 @@ VALUES
(@TMP_SUB_ID, '创建$table.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20, '1', '1', 0),
(@TMP_SUB_ID, '修改$table.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30, '1', '1', 0),
(@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40, '1', '1', 0);
#if(false)
(@TMP_SUB_ID, '导出$table.comment', '${package.ModuleName}:${typeHyphen}:export', 3, 50, '1', '1', 0),
(@TMP_SUB_ID, '导入$table.comment', '${package.ModuleName}:${typeHyphen}:import', 3, 60, '1', '1', 0);
#end