ApiModel-》Schema

This commit is contained in:
Moshow郑锴 2025-02-09 01:54:07 +08:00
parent 1095661355
commit dff15bcc6d
7 changed files with 21 additions and 24 deletions

View File

@ -10,7 +10,7 @@ import java.util.List;
* @date ${.now?string('yyyy-MM-dd')}
*/
@Data<#if isSwagger?exists && isSwagger==true>
@ApiModel("${classInfo.classComment}")</#if>
@Schema"${classInfo.classComment}")</#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
@ -20,7 +20,7 @@ public class ${classInfo.className} implements Serializable {
<#if isComment?exists && isComment==true>/**
* ${fieldItem.fieldComment}
*/</#if><#if isSwagger?exists && isSwagger==true>
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
@Schema(description = "${fieldItem.fieldComment}")</#if>
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
</#list>

View File

@ -7,8 +7,7 @@ import java.util.List;
import java.io.Serializable;
import javax.persistence.*;
<#if isSwagger?exists && isSwagger==true>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;</#if>
import io.swagger.v3.oas.annotations.media.Schema;</#if>
</#if>
/**
* @description ${classInfo.classComment}
@ -17,7 +16,7 @@ import io.swagger.annotations.ApiModelProperty;</#if>
*/
<#if isLombok?exists && isLombok==true>@Data</#if>
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
@ApiModel("${classInfo.classComment}")</#if>
@Schema"${classInfo.classComment}")</#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
@ -29,7 +28,7 @@ public class ${classInfo.className} implements Serializable {
<#if isComment?exists && isComment==true>/**
* ${fieldItem.fieldComment}
*/</#if><#if isSwagger?exists && isSwagger==true>
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
@Schema(description = "${fieldItem.fieldComment}")</#if>
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
private ${fieldItem.fieldClass} ${fieldItem.fieldName};

View File

@ -11,8 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
<#if isSwagger?exists && isSwagger==true>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;</#if>
import io.swagger.v3.oas.annotations.media.Schema;</#if>
</#if>
/**
* @description ${classInfo.classComment}
@ -24,13 +23,13 @@ import io.swagger.annotations.ApiModelProperty;</#if>
@AllArgsConstructor
<#if isLombok?exists && isLombok==true>@Data</#if>
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
@ApiModel("${classInfo.classComment}")</#if>
@Schema"${classInfo.classComment}")</#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@ApiModelProperty("id")
@Schema(description = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@ -39,7 +38,7 @@ public class ${classInfo.className} implements Serializable {
<#if isComment?exists && isComment==true>/**
* ${fieldItem.fieldComment}
*/</#if><#if isSwagger?exists && isSwagger==true>
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
@Schema(description = "${fieldItem.fieldComment}")</#if>
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
private ${fieldItem.fieldClass} ${fieldItem.fieldName};

View File

@ -11,8 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
<#if isSwagger?exists && isSwagger==true>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;</#if>
import io.swagger.v3.oas.annotations.media.Schema;</#if>
</#if>
/**
* @description ${classInfo.classComment}
@ -22,7 +21,7 @@ import io.swagger.annotations.ApiModelProperty;</#if>
@Entity
<#if isLombok?exists && isLombok==true>@Data</#if>
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
@ApiModel("${classInfo.classComment}")</#if>
@Schema"${classInfo.classComment}")</#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
@ -34,7 +33,7 @@ public class ${classInfo.className} implements Serializable {
<#if isComment?exists && isComment==true>/**
* ${fieldItem.fieldComment}
*/</#if><#if isSwagger?exists && isSwagger==true>
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
@Schema(description = "${fieldItem.fieldComment}")</#if>
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
private ${fieldItem.fieldClass} ${fieldItem.fieldName};

View File

@ -12,7 +12,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.servlet.ModelAndView;
<#if isSwagger?exists && isSwagger==true>import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.responses.ApiResponse;</#if>
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -25,6 +26,7 @@ import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/${classInfo.className?uncap_first}")
<#if isSwagger?exists && isSwagger==true>@Tag(name = "${classInfo.className}",description = "${classInfo.classComment}控制器")</#if>
public class ${classInfo.className}Controller {
@Autowired

View File

@ -8,8 +8,7 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
<#if isSwagger?exists && isSwagger==true>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;</#if>
import io.swagger.v3.oas.annotations.media.Schema;</#if>
</#if>
/**
* @description ${classInfo.classComment}
@ -17,7 +16,7 @@ import io.swagger.annotations.ApiModelProperty;</#if>
* @date ${.now?string('yyyy-MM-dd')}
*/
<#if isLombok?exists && isLombok==true>@Data</#if><#if isSwagger?exists && isSwagger==true>
@ApiModel("${classInfo.classComment}")</#if>
@Schema"${classInfo.classComment}")</#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
@ -28,7 +27,7 @@ public class ${classInfo.className} implements Serializable {
<#if isComment?exists && isComment==true>/**
* ${fieldItem.fieldComment}
*/</#if><#if isSwagger?exists && isSwagger==true>
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
@Schema(description = "${fieldItem.fieldComment}")</#if>
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
<#if isLombok?exists && isLombok==false>

View File

@ -7,8 +7,7 @@ import java.util.List;
import java.io.Serializable;
import io.mybatis.provider.Entity;
<#if isSwagger?exists && isSwagger==true>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;</#if>
import io.swagger.v3.oas.annotations.media.Schema;</#if>
</#if>
/**
* @description ${classInfo.classComment}
@ -17,7 +16,7 @@ import io.swagger.annotations.ApiModelProperty;</#if>
*/
<#if isLombok?exists && isLombok==true>@Data</#if>
<#if isComment?exists && isComment==true>@Entity.Table("${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
@ApiModel("${classInfo.classComment}")</#if>
@Schema"${classInfo.classComment}")</#if>
public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L;
@ -28,7 +27,7 @@ public class ${classInfo.className} implements Serializable {
<#if isComment?exists && isComment==true>/**
* ${fieldItem.fieldComment}
*/</#if><#if isSwagger?exists && isSwagger==true>
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
@Schema(description = "${fieldItem.fieldComment}")</#if>
<#if isComment?exists && isComment==true>@Entity.Column("${fieldItem.columnName}")</#if>
private ${fieldItem.fieldClass} ${fieldItem.fieldName};