fix():代码生成器接口文档生成

boot3.0
dongzeliang 2025-03-19 23:17:16 +08:00
parent cc8c8c9f80
commit f1ebbc28e4
8 changed files with 76 additions and 60 deletions

View File

@ -152,6 +152,12 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>2.2.28</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,6 +1,7 @@
package com.muyu.common.core.web.page; package com.muyu.common.core.web.page;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -21,26 +22,31 @@ public class PageReq {
/** /**
* *
*/ */
@Schema(title = "pageNum", name = "当前页", description = "当前记录起始索引", defaultValue = "1")
private Integer pageNum; private Integer pageNum;
/** /**
* *
*/ */
@Schema(title = "pageSize", name = "分页条数", description = "每页显示记录数", defaultValue = "10")
private Integer pageSize; private Integer pageSize;
/** /**
* *
*/ */
@Schema(title = "orderByColumn", name = "排序列", description = "列表查询排序列")
private String orderByColumn; private String orderByColumn;
/** /**
* descasc * descasc
*/ */
@Schema(title = "isAsc", name = "排序方向", description = "排序的方向desc或者asc", defaultValue = "asc")
private String isAsc = "asc"; private String isAsc = "asc";
/** /**
* *
*/ */
@Schema(title = "reasonable", name = "合理分页参数", description = "分页参数合理化")
private Boolean reasonable = true; private Boolean reasonable = true;
public String getOrderBy () { public String getOrderBy () {

View File

@ -26,7 +26,7 @@ import com.muyu.common.core.web.domain.TreeEntity;
#end #end
/** /**
* ${functionName}对象 ${tableName} * ${functionName}数据库映射对象 ${tableName}
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
@ -40,16 +40,17 @@ import com.muyu.common.core.web.domain.TreeEntity;
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("${tableName}") @TableName("${tableName}对数据库映射对象")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Schema(description = "${functionName}")
public class ${ClassName} extends ${Entity} { public class ${ClassName} extends ${Entity} {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */ /**
* $column.columnComment
*/
#if($column.list) #if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@ -73,12 +74,10 @@ public class ${ClassName} extends ${Entity} {
#if($column.isRequired == '1') #if($column.isRequired == '1')
#set($comment=', required = true') #set($comment=', required = true')
#end #end
@Schema(name = "${column.columnComment}")
private $column.javaType $column.javaField; private $column.javaType $column.javaField;
#end #end
#end #end
/** /**
* 添加构造器 * 添加构造器
*/ */

View File

@ -12,7 +12,7 @@ import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
/** /**
* ${functionName}对象 ${tableName} * ${functionName}修改请求对象
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
@ -26,13 +26,15 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "${functionName}") @Schema(description = "${functionName}修改请求对象")
public class ${ClassName}EditReq { public class ${ClassName}EditReq {
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
#if($column.isEdit == '1') #if($column.isEdit == '1')
/** $column.columnComment */ /**
* $column.columnComment
*/
#if($column.list) #if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@ -48,7 +50,7 @@ public class ${ClassName}EditReq {
#if($column.isRequired == '1') #if($column.isRequired == '1')
#set($isRequired=', required = true') #set($isRequired=', required = true')
#end #end
@Schema(name = "${column.columnComment}" $isRequired) @Schema(name = "${column.javaField}", title = "${column.columnComment}", description = "${column.columnComment}" $isRequired)
private $column.javaType $column.javaField; private $column.javaType $column.javaField;
#end #end

View File

@ -15,7 +15,7 @@ import lombok.experimental.SuperBuilder;
import ${packageName}.domain.model.${ClassName}QueryModel; import ${packageName}.domain.model.${ClassName}QueryModel;
/** /**
* ${functionName}对象 ${tableName} * ${functionName}查询请求对象
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
@ -29,14 +29,16 @@ import ${packageName}.domain.model.${ClassName}QueryModel;
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "${functionName}") @Schema(description = "${functionName}查询请求对象")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ${ClassName}QueryReq extends PageReq { public class ${ClassName}QueryReq extends PageReq {
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
#if($column.isQuery == '1') #if($column.isQuery == '1')
/** $column.columnComment */ /**
* $column.columnComment
*/
#if($column.list) #if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@ -51,7 +53,7 @@ public class ${ClassName}QueryReq extends PageReq {
#if($column.javaField == $pkColumn.javaField) #if($column.javaField == $pkColumn.javaField)
@TableId(value = "${pkColumn.javaField}",type = IdType.AUTO) @TableId(value = "${pkColumn.javaField}",type = IdType.AUTO)
#end #end
@Schema(name = "${column.columnComment}") @Schema(name = "${column.javaField}", title = "${column.columnComment}", description = "${column.columnComment}")
private $column.javaType $column.javaField; private $column.javaType $column.javaField;
#end #end

View File

@ -5,7 +5,6 @@ import ${import};
#end #end
import com.muyu.common.core.web.model.QueryModel; import com.muyu.common.core.web.model.QueryModel;
import com.muyu.system.domain.req.StudentInfoQueryReq; import com.muyu.system.domain.req.StudentInfoQueryReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -13,7 +12,7 @@ import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
/** /**
* ${functionName}对象 ${tableName} * ${functionName}查询请求模型对象
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
@ -27,14 +26,15 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "${functionName}")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ${ClassName}QueryModel extends QueryModel<${ClassName}QueryModel> { public class ${ClassName}QueryModel extends QueryModel<${ClassName}QueryModel> {
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
#if($column.isQuery == '1') #if($column.isQuery == '1')
/** $column.columnComment */ /**
* $column.columnComment
*/
#if($column.list) #if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@ -43,7 +43,6 @@ public class ${ClassName}QueryModel extends QueryModel<${ClassName}QueryModel> {
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#end #end
@Schema(name = "${column.columnComment}")
private $column.javaType $column.javaField; private $column.javaType $column.javaField;
#end #end

View File

@ -12,7 +12,7 @@ import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
/** /**
* ${functionName}对象 ${tableName} * ${functionName}保存请求对象
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
@ -26,14 +26,16 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "${functionName}") @Schema(description = "${functionName}保存请求对象")
public class ${ClassName}SaveReq{ public class ${ClassName}SaveReq{
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
#if($column.isInsert == '1') #if($column.isInsert == '1')
/** $column.columnComment */ /**
* $column.columnComment
*/
#if($column.list) #if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@ -50,7 +52,7 @@ public class ${ClassName}SaveReq{
#if($column.isRequired == '1') #if($column.isRequired == '1')
#set($isRequired=', required = true') #set($isRequired=', required = true')
#end #end
@Schema(name = "${column.columnComment}" $isRequired) @Schema(name = "${column.javaField}", title = "${column.columnComment}", description = "${column.columnComment}" $isRequired)
private $column.javaType $column.javaField; private $column.javaType $column.javaField;
#end #end