docs: 完善代码生成相关接口文档信息
This commit is contained in:
parent
72399d9226
commit
9def265af6
@ -55,14 +55,14 @@ public class PageQuery extends SortQuery {
|
|||||||
/**
|
/**
|
||||||
* 页码
|
* 页码
|
||||||
*/
|
*/
|
||||||
@Schema(description = "页码")
|
@Schema(description = "页码", example = "1")
|
||||||
@Min(value = 1, message = "页码最小值为 {value}")
|
@Min(value = 1, message = "页码最小值为 {value}")
|
||||||
private Integer page = DEFAULT_PAGE;
|
private Integer page = DEFAULT_PAGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每页条数
|
* 每页条数
|
||||||
*/
|
*/
|
||||||
@Schema(description = "每页条数")
|
@Schema(description = "每页条数", example = "10")
|
||||||
@Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})")
|
@Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})")
|
||||||
private Integer size = DEFAULT_SIZE;
|
private Integer size = DEFAULT_SIZE;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class PageDataVO<V> implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 总记录数
|
* 总记录数
|
||||||
*/
|
*/
|
||||||
@Schema(description = "总记录数")
|
@Schema(description = "总记录数", example = "10")
|
||||||
private int total;
|
private int total;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,15 +40,15 @@ public class R<V> implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 是否成功 */
|
/** 是否成功 */
|
||||||
@Schema(description = "是否成功")
|
@Schema(description = "是否成功", example = "true")
|
||||||
private boolean success;
|
private boolean success;
|
||||||
|
|
||||||
/** 状态码 */
|
/** 状态码 */
|
||||||
@Schema(description = "状态码")
|
@Schema(description = "状态码", example = "200")
|
||||||
private int code;
|
private int code;
|
||||||
|
|
||||||
/** 状态信息 */
|
/** 状态信息 */
|
||||||
@Schema(description = "状态信息")
|
@Schema(description = "状态信息", example = "操作成功")
|
||||||
private String msg;
|
private String msg;
|
||||||
|
|
||||||
/** 返回数据 */
|
/** 返回数据 */
|
||||||
@ -56,7 +56,7 @@ public class R<V> implements Serializable {
|
|||||||
private V data;
|
private V data;
|
||||||
|
|
||||||
/** 时间戳 */
|
/** 时间戳 */
|
||||||
@Schema(description = "时间戳")
|
@Schema(description = "时间戳", example = "1691453288000")
|
||||||
private long timestamp = System.currentTimeMillis();
|
private long timestamp = System.currentTimeMillis();
|
||||||
|
|
||||||
/** 成功状态码 */
|
/** 成功状态码 */
|
||||||
|
@ -57,84 +57,84 @@ public class FieldConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 表名称
|
* 表名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "表名称")
|
@Schema(description = "表名称", example = "sys_user")
|
||||||
@NotBlank(message = "表名称不能为空")
|
@NotBlank(message = "表名称不能为空")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列名称
|
* 列名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "列名称")
|
@Schema(description = "列名称", example = "nickname")
|
||||||
@NotBlank(message = "列名称不能为空")
|
@NotBlank(message = "列名称不能为空")
|
||||||
private String columnName;
|
private String columnName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列类型
|
* 列类型
|
||||||
*/
|
*/
|
||||||
@Schema(description = "列类型")
|
@Schema(description = "列类型", example = "varchar")
|
||||||
@NotBlank(message = "列类型不能为空")
|
@NotBlank(message = "列类型不能为空")
|
||||||
private String columnType;
|
private String columnType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段名称
|
* 字段名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "字段名称")
|
@Schema(description = "字段名称", example = "nickname")
|
||||||
@NotBlank(message = "字段名称不能为空")
|
@NotBlank(message = "字段名称不能为空")
|
||||||
private String fieldName;
|
private String fieldName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段类型
|
* 字段类型
|
||||||
*/
|
*/
|
||||||
@Schema(description = "字段类型")
|
@Schema(description = "字段类型", example = "String")
|
||||||
@NotBlank(message = "字段类型不能为空")
|
@NotBlank(message = "字段类型不能为空")
|
||||||
private String fieldType;
|
private String fieldType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注释
|
* 注释
|
||||||
*/
|
*/
|
||||||
@Schema(description = "注释")
|
@Schema(description = "注释", example = "昵称")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否必填
|
* 是否必填
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否必填")
|
@Schema(description = "是否必填", example = "true")
|
||||||
private Boolean isRequired;
|
private Boolean isRequired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否在列表中显示
|
* 是否在列表中显示
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否在列表中显示")
|
@Schema(description = "是否在列表中显示", example = "true")
|
||||||
private Boolean showInList;
|
private Boolean showInList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否在表单中显示
|
* 是否在表单中显示
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否在表单中显示")
|
@Schema(description = "是否在表单中显示", example = "true")
|
||||||
private Boolean showInForm;
|
private Boolean showInForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否在查询中显示
|
* 是否在查询中显示
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否在查询中显示")
|
@Schema(description = "是否在查询中显示", example = "true")
|
||||||
private Boolean showInQuery;
|
private Boolean showInQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单类型
|
* 表单类型
|
||||||
*/
|
*/
|
||||||
@Schema(description = "表单类型")
|
@Schema(description = "表单类型", example = "1")
|
||||||
private FormTypeEnum formType;
|
private FormTypeEnum formType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询方式
|
* 查询方式
|
||||||
*/
|
*/
|
||||||
@Schema(description = "查询方式")
|
@Schema(description = "查询方式", example = "1")
|
||||||
private QueryTypeEnum queryType;
|
private QueryTypeEnum queryType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间", example = "2023-08-08 08:08:08")
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ -57,15 +57,15 @@ public class GenConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 表名称
|
* 表名称
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "表名称", example = "sys_user")
|
||||||
@TableId(type = IdType.INPUT)
|
@TableId(type = IdType.INPUT)
|
||||||
@Schema(description = "表名称")
|
|
||||||
@NotBlank(message = "表名称不能为空")
|
@NotBlank(message = "表名称不能为空")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模块名称
|
* 模块名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "模块名称")
|
@Schema(description = "模块名称", example = "continew-admin-system")
|
||||||
@NotBlank(message = "模块名称不能为空")
|
@NotBlank(message = "模块名称不能为空")
|
||||||
@Length(max = 60, message = "模块名称不能超过 {max} 个字符")
|
@Length(max = 60, message = "模块名称不能超过 {max} 个字符")
|
||||||
private String moduleName;
|
private String moduleName;
|
||||||
@ -73,7 +73,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 包名称
|
* 包名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "包名称")
|
@Schema(description = "包名称", example = "top.charles7c.cnadmin.system")
|
||||||
@NotBlank(message = "包名称不能为空")
|
@NotBlank(message = "包名称不能为空")
|
||||||
@Pattern(regexp = RegexConsts.PACKAGE_NAME, message = "包名称格式错误")
|
@Pattern(regexp = RegexConsts.PACKAGE_NAME, message = "包名称格式错误")
|
||||||
@Length(max = 60, message = "包名称不能超过 {max} 个字符")
|
@Length(max = 60, message = "包名称不能超过 {max} 个字符")
|
||||||
@ -82,7 +82,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 前端路径
|
* 前端路径
|
||||||
*/
|
*/
|
||||||
@Schema(description = "前端路径")
|
@Schema(description = "前端路径", example = "D:/continew-admin/continew-admin-ui/src/views/system/user")
|
||||||
@Length(max = 255, message = "前端路径不能超过 {max} 个字符")
|
@Length(max = 255, message = "前端路径不能超过 {max} 个字符")
|
||||||
@Pattern(regexp = "^(?=.*src\\/views)(?!.*\\/views\\/?$).*", message = "前端路径配置错误")
|
@Pattern(regexp = "^(?=.*src\\/views)(?!.*\\/views\\/?$).*", message = "前端路径配置错误")
|
||||||
private String frontendPath;
|
private String frontendPath;
|
||||||
@ -90,7 +90,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 业务名称
|
* 业务名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "业务名称")
|
@Schema(description = "业务名称", example = "用户")
|
||||||
@NotBlank(message = "业务名称不能为空")
|
@NotBlank(message = "业务名称不能为空")
|
||||||
@Length(max = 50, message = "业务名称不能超过 {max} 个字符")
|
@Length(max = 50, message = "业务名称不能超过 {max} 个字符")
|
||||||
private String businessName;
|
private String businessName;
|
||||||
@ -98,7 +98,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 作者
|
* 作者
|
||||||
*/
|
*/
|
||||||
@Schema(description = "作者")
|
@Schema(description = "作者", example = "Charles7c")
|
||||||
@NotBlank(message = "作者名称不能为空")
|
@NotBlank(message = "作者名称不能为空")
|
||||||
@Length(max = 100, message = "作者名称不能超过 {max} 个字符")
|
@Length(max = 100, message = "作者名称不能超过 {max} 个字符")
|
||||||
private String author;
|
private String author;
|
||||||
@ -106,27 +106,27 @@ public class GenConfigDO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 表前缀
|
* 表前缀
|
||||||
*/
|
*/
|
||||||
@Schema(description = "表前缀")
|
@Schema(description = "表前缀", example = "sys_")
|
||||||
private String tablePrefix;
|
private String tablePrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否覆盖
|
* 是否覆盖
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否覆盖")
|
@Schema(description = "是否覆盖", example = "false")
|
||||||
@NotNull(message = "是否覆盖不能为空")
|
@NotNull(message = "是否覆盖不能为空")
|
||||||
private Boolean isOverride;
|
private Boolean isOverride;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间", example = "2023-08-08 08:08:08")
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改时间
|
* 修改时间
|
||||||
*/
|
*/
|
||||||
@Schema(description = "修改时间")
|
@Schema(description = "修改时间", example = "2023-08-08 08:08:08")
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@ -37,6 +37,6 @@ public class TableQuery implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 表名称
|
* 表名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "表名称")
|
@Schema(description = "表名称", example = "sys_user")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
}
|
}
|
||||||
|
@ -38,36 +38,36 @@ public class TableVO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 表名称
|
* 表名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "表名称")
|
@Schema(description = "表名称", example = "sys_user")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
@Schema(description = "描述")
|
@Schema(description = "描述", example = "用户表")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储引擎
|
* 存储引擎
|
||||||
*/
|
*/
|
||||||
@Schema(description = "存储引擎")
|
@Schema(description = "存储引擎", example = "InnoDB")
|
||||||
private String engine;
|
private String engine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字符集
|
* 字符集
|
||||||
*/
|
*/
|
||||||
@Schema(description = "字符集")
|
@Schema(description = "字符集", example = "utf8mb4_general_ci")
|
||||||
private String charset;
|
private String charset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间", example = "2023-08-08 08:08:08")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否已配置
|
* 是否已配置
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否已配置")
|
@Schema(description = "是否已配置", example = "true")
|
||||||
private Boolean isConfiged;
|
private Boolean isConfiged;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,9 @@ import java.util.List;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -62,6 +65,11 @@ public class GeneratorController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询字段配置列表", description = "查询字段配置列表")
|
@Operation(summary = "查询字段配置列表", description = "查询字段配置列表")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user",
|
||||||
|
in = ParameterIn.PATH),
|
||||||
|
@Parameter(name = "requireSync", description = "是否需要同步", example = "true",
|
||||||
|
in = ParameterIn.QUERY)})
|
||||||
@GetMapping("/field/{tableName}")
|
@GetMapping("/field/{tableName}")
|
||||||
public R<List<FieldConfigDO>> listFieldConfig(@PathVariable String tableName,
|
public R<List<FieldConfigDO>> listFieldConfig(@PathVariable String tableName,
|
||||||
@RequestParam(required = false, defaultValue = "false") Boolean requireSync) {
|
@RequestParam(required = false, defaultValue = "false") Boolean requireSync) {
|
||||||
@ -69,12 +77,14 @@ public class GeneratorController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询生成配置信息", description = "查询生成配置信息")
|
@Operation(summary = "查询生成配置信息", description = "查询生成配置信息")
|
||||||
|
@Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH)
|
||||||
@GetMapping("/config/{tableName}")
|
@GetMapping("/config/{tableName}")
|
||||||
public R<GenConfigDO> getGenConfig(@PathVariable String tableName) throws SQLException {
|
public R<GenConfigDO> getGenConfig(@PathVariable String tableName) throws SQLException {
|
||||||
return R.ok(generatorService.getGenConfig(tableName));
|
return R.ok(generatorService.getGenConfig(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "保存配置信息", description = "保存配置信息")
|
@Operation(summary = "保存配置信息", description = "保存配置信息")
|
||||||
|
@Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH)
|
||||||
@PostMapping("/config/{tableName}")
|
@PostMapping("/config/{tableName}")
|
||||||
public R saveConfig(@Validated @RequestBody GenConfigRequest request, @PathVariable String tableName) {
|
public R saveConfig(@Validated @RequestBody GenConfigRequest request, @PathVariable String tableName) {
|
||||||
generatorService.saveConfig(request, tableName);
|
generatorService.saveConfig(request, tableName);
|
||||||
@ -82,6 +92,7 @@ public class GeneratorController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "生成代码", description = "生成代码")
|
@Operation(summary = "生成代码", description = "生成代码")
|
||||||
|
@Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH)
|
||||||
@PostMapping("/{tableName}")
|
@PostMapping("/{tableName}")
|
||||||
public R generate(@PathVariable String tableName) {
|
public R generate(@PathVariable String tableName) {
|
||||||
ValidationUtils.throwIf("prod".equals(SpringUtil.getActiveProfile()), "仅支持在开发环境生成代码");
|
ValidationUtils.throwIf("prod".equals(SpringUtil.getActiveProfile()), "仅支持在开发环境生成代码");
|
||||||
|
Loading…
Reference in New Issue
Block a user