swagger 返回参数注解

 第一种

@ApiOperation(value = "取消/流失列表")
@GetMapping("/getStudentLoseList")
@ApiImplicitParams({
    @ApiImplicitParam(paramType = "query", name = "type", value = "类型(0:取消分班 1:流失)",required = true,dataType = "int"),
    @ApiImplicitParam(paramType = "query", name = "studentId", value = "学生id",required = true, dataType = "Long")
})
@ApiResponses({
        @ApiResponse(code=100,message = "操作成功",response = StudentLoseVo.class)
})
public R getStudentLoseList(Long studentId, Integer type){
    return R.ok(studentLoseFollowService.getStudentLoseList( studentId,  type));
}
package com.skyedu.crm.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author 
 * @Description: 
 */
@Data
public class StudentLoseVo {
    @ApiModelProperty(value = "学生班级id")
    private Long studentCourseId;

    @ApiModelProperty(value = "学期")
    private String periodName;

    @ApiModelProperty(value = "学科")
    private String subjectName;

    @ApiModelProperty(value = "年级")
    private String gradeName;

    @ApiModelProperty(value = "层次")
    private String gradationName;

    @ApiModelProperty(value = "课程属性")
    private String classTypeName;

    @ApiModelProperty(value = "校区")
    private String campusName;

    @ApiModelProperty(value = "班级名称")
    private String courseName;

    @ApiModelProperty(value = "教师")
    private String teacherNames;

    @ApiModelProperty(value = "开课日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date beginDate;

    @ApiModelProperty(value = "结课日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endDate;

    @ApiModelProperty(value = "上课时间")
    private String classTime;

    @ApiModelProperty(value = "取消分班时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date cancelDate;
}

 

 

第二种

@ApiOperation(value = "学生跟进",response =StudentLoseFollow.class)

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Swagger3中,可以通过自定义注解来进一步定制和扩展API文档的展示和功能。自定义注解允许开发者添加额外的信息,以便更好地描述和解释API接口。以下是Swagger3中常用的自定义注解: 1. @Api:用于描述整个Controller或接口的基本信息,包括接口的名称、描述等。 2. @ApiOperation:用于描述具体的API接口,包括接口的名称、描述、请求方法等。 3. @ApiParam:用于描述接口的参数,包括参数名称、描述、是否必须等信息。 4. @ApiModel:用于描述实体类或DTO的基本信息,包括类的名称、描述等。 5. @ApiModelProperty:用于描述实体类或DTO的属性,包括属性的名称、描述、示例值等。 通过使用这些自定义注解,开发者可以清晰地定义和展示API接口的各种信息,方便其他开发人员理解和使用接口。同时,Swagger3还提供了丰富的UI界面,可以直观地展示接口的参数返回结果,并提供接口测试的功能,类似于Postman工具。这样开发人员可以方便地测试和调试接口,提高开发效率。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Springboot整合Swagger3全注解配置(springdoc-openapi-ui)](https://blog.csdn.net/weixin_44768189/article/details/115055784)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Swagger2注解的介绍](https://blog.csdn.net/weixin_33883178/article/details/92424879)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值