删除swagger侵入式代码 , 删除demo
This commit is contained in:
@@ -5,10 +5,6 @@ import ${jakartaPackage}.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
#if ($sceneEnum.scene == 1)import org.springframework.security.access.prepost.PreAuthorize;#end
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import ${jakartaPackage}.validation.constraints.*;
|
||||
import ${jakartaPackage}.validation.*;
|
||||
import ${jakartaPackage}.servlet.http.*;
|
||||
@@ -34,7 +30,9 @@ import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.bu
|
||||
#end
|
||||
import ${basePackage}.module.${table.moduleName}.service.${table.businessName}.${table.className}Service;
|
||||
|
||||
@Tag(name = "${sceneEnum.name} - ${table.classComment}")
|
||||
/**
|
||||
* ${sceneEnum.name} - ${table.classComment}
|
||||
*/
|
||||
@RestController
|
||||
##二级的 businessName 暂时不算在 HTTP 路径上,可以根据需要写
|
||||
@RequestMapping("/${table.moduleName}/${simpleClassName_strikeCase}")
|
||||
@@ -44,8 +42,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
@Resource
|
||||
private ${table.className}Service ${classNameVar}Service;
|
||||
|
||||
/**
|
||||
* 创建${table.classComment}
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建${table.classComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:create')")
|
||||
#end
|
||||
@@ -53,8 +53,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(${classNameVar}Service.create${simpleClassName}(createReqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新${table.classComment}
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新${table.classComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:update')")
|
||||
#end
|
||||
@@ -63,9 +65,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除${table.classComment}
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除${table.classComment}")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')")
|
||||
#end
|
||||
@@ -74,9 +77,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得${table.classComment}
|
||||
*/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得${table.classComment}")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
@@ -86,8 +90,11 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
}
|
||||
|
||||
#if ( $table.templateType != 2 )
|
||||
|
||||
/**
|
||||
* 获得${table.classComment}分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得${table.classComment}分页")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
@@ -98,8 +105,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
|
||||
## 特殊:树表专属逻辑(树不需要分页接口)
|
||||
#else
|
||||
/**
|
||||
* 获得${table.classComment}列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得${table.classComment}列表")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
@@ -109,8 +118,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
}
|
||||
|
||||
#end
|
||||
/**
|
||||
* 导出${table.classComment} Excel
|
||||
*/
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出${table.classComment} Excel")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:export')")
|
||||
#end
|
||||
@@ -149,9 +160,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
|
||||
## 情况一:MASTER_ERP 时,需要分查询页子表
|
||||
#if ( $table.templateType == 11 )
|
||||
/**
|
||||
* 获得${subTable.classComment}分页
|
||||
*/
|
||||
@GetMapping("/${subSimpleClassName_strikeCase}/page")
|
||||
@Operation(summary = "获得${subTable.classComment}分页")
|
||||
@Parameter(name = "${subJoinColumn.javaField}", description = "${subJoinColumn.columnComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
@@ -163,9 +175,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
||||
#else
|
||||
#if ( $subTable.subJoinMany )
|
||||
/**
|
||||
* 获得${subTable.classComment}列表
|
||||
*/
|
||||
@GetMapping("/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}")
|
||||
@Operation(summary = "获得${subTable.classComment}列表")
|
||||
@Parameter(name = "${subJoinColumn.javaField}", description = "${subJoinColumn.columnComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
@@ -174,9 +187,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
}
|
||||
|
||||
#else
|
||||
/**
|
||||
* 获得${subTable.classComment}
|
||||
*/
|
||||
@GetMapping("/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}")
|
||||
@Operation(summary = "获得${subTable.classComment}")
|
||||
@Parameter(name = "${subJoinColumn.javaField}", description = "${subJoinColumn.columnComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
@@ -188,8 +202,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
#end
|
||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
||||
#if ( $table.templateType == 11 )
|
||||
/**
|
||||
* 创建${subTable.classComment}
|
||||
*/
|
||||
@PostMapping("/${subSimpleClassName_strikeCase}/create")
|
||||
@Operation(summary = "创建${subTable.classComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:create')")
|
||||
#end
|
||||
@@ -197,8 +213,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(${classNameVar}Service.create${subSimpleClassName}(${subClassNameVar}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新${subTable.classComment}
|
||||
*/
|
||||
@PutMapping("/${subSimpleClassName_strikeCase}/update")
|
||||
@Operation(summary = "更新${subTable.classComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:update')")
|
||||
#end
|
||||
@@ -207,9 +225,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除${subTable.classComment}
|
||||
*/
|
||||
@DeleteMapping("/${subSimpleClassName_strikeCase}/delete")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@Operation(summary = "删除${subTable.classComment}")
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')")
|
||||
#end
|
||||
@@ -218,9 +237,10 @@ public class ${sceneEnum.prefixClass}${table.className}Controller {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得${subTable.classComment}
|
||||
*/
|
||||
@GetMapping("/${subSimpleClassName_strikeCase}/get")
|
||||
@Operation(summary = "获得${subTable.classComment}")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
#if ($sceneEnum.scene == 1)
|
||||
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')")
|
||||
#end
|
||||
|
||||
@@ -2,7 +2,7 @@ package ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePac
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import ${PageParamClassName};
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.javaType} == "BigDecimal")
|
||||
@@ -22,18 +22,24 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
#end
|
||||
## 字段模板
|
||||
#macro(columnTpl $prefix $prefixStr)
|
||||
@Schema(description = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
/**
|
||||
* ${prefixStr}${column.columnComment}"#if ("$!column.example" != "
|
||||
*/, example = "${column.example}"#end)
|
||||
private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
|
||||
#end
|
||||
|
||||
@Schema(description = "${sceneEnum.name} - ${table.classComment}列表 Request VO")
|
||||
/**
|
||||
* ${sceneEnum.name} - ${table.classComment}列表 Request VO
|
||||
*/
|
||||
@Data
|
||||
public class ${sceneEnum.prefixClass}${table.className}ListReqVO {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.listOperation})##查询操作
|
||||
#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
|
||||
@Schema(description = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
/**
|
||||
* ${column.columnComment}"#if ("$!column.example" != "
|
||||
*/, example = "${column.example}"#end)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private ${column.javaType}[] ${column.javaField};
|
||||
#else##情况二,非 Between 的时间
|
||||
|
||||
@@ -2,7 +2,7 @@ package ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePac
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import ${PageParamClassName};
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.javaType} == "BigDecimal")
|
||||
@@ -22,11 +22,15 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
#end
|
||||
## 字段模板
|
||||
#macro(columnTpl $prefix $prefixStr)
|
||||
@Schema(description = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
/**
|
||||
* ${prefixStr}${column.columnComment}"#if ("$!column.example" != "
|
||||
*/, example = "${column.example}"#end)
|
||||
private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
|
||||
#end
|
||||
|
||||
@Schema(description = "${sceneEnum.name} - ${table.classComment}分页 Request VO")
|
||||
/**
|
||||
* ${sceneEnum.name} - ${table.classComment}分页 Request VO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@@ -35,7 +39,9 @@ public class ${sceneEnum.prefixClass}${table.className}PageReqVO extends PagePar
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.listOperation})##查询操作
|
||||
#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
|
||||
@Schema(description = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
/**
|
||||
* ${column.columnComment}"#if ("$!column.example" != "
|
||||
*/, example = "${column.example}"#end)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private ${column.javaType}[] ${column.javaField};
|
||||
#else##情况二,非 Between 的时间
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
## 处理 BigDecimal 字段的引入
|
||||
@@ -28,7 +28,9 @@ import ${DictConvertClassName};
|
||||
#end
|
||||
#end
|
||||
|
||||
@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO")
|
||||
/**
|
||||
* ${sceneEnum.name} - ${table.classComment} Response VO
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ${sceneEnum.prefixClass}${table.className}RespVO {
|
||||
@@ -37,7 +39,9 @@ public class ${sceneEnum.prefixClass}${table.className}RespVO {
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.listOperationResult})
|
||||
## 1. 处理 Swagger 注解
|
||||
@Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
/**
|
||||
* ${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != "
|
||||
*/, example = "${column.example}"#end)
|
||||
## 2. 处理 Excel 导出
|
||||
#if ("$!column.dictType" != "")##处理枚举值
|
||||
@ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import ${jakartaPackage}.validation.constraints.*;
|
||||
@@ -24,7 +24,9 @@ import java.time.LocalDateTime;
|
||||
import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.businessName}.${subTable.className}DO;
|
||||
#end
|
||||
|
||||
@Schema(description = "${sceneEnum.name} - ${table.classComment}新增/修改 Request VO")
|
||||
/**
|
||||
* ${sceneEnum.name} - ${table.classComment}新增/修改 Request VO
|
||||
*/
|
||||
@Data
|
||||
public class ${sceneEnum.prefixClass}${table.className}SaveReqVO {
|
||||
|
||||
@@ -32,7 +34,9 @@ public class ${sceneEnum.prefixClass}${table.className}SaveReqVO {
|
||||
#foreach ($column in $columns)
|
||||
#if (${column.createOperation} || ${column.updateOperation})
|
||||
## 1. 处理 Swagger 注解
|
||||
@Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
/**
|
||||
* ${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != "
|
||||
*/, example = "${column.example}"#end)
|
||||
## 2. 处理 Validator 参数校验
|
||||
#if (!${column.nullable} && !${column.primaryKey})
|
||||
#if (${column.javaType} == 'String')
|
||||
@@ -51,11 +55,15 @@ public class ${sceneEnum.prefixClass}${table.className}SaveReqVO {
|
||||
#foreach ($subTable in $subTables)
|
||||
#set ($index = $foreach.count - 1)
|
||||
#if ( $subTable.subJoinMany)
|
||||
@Schema(description = "${subTable.classComment}列表")
|
||||
/**
|
||||
* ${subTable.classComment}列表
|
||||
*/
|
||||
private List<${subTable.className}DO> ${subClassNameVars.get($index)}s;
|
||||
|
||||
#else
|
||||
@Schema(description = "${subTable.classComment}")
|
||||
/**
|
||||
* ${subTable.classComment}
|
||||
*/
|
||||
private ${subTable.className}DO ${subClassNameVars.get($index)};
|
||||
|
||||
#end
|
||||
|
||||
Reference in New Issue
Block a user