首页>代码>SpringBoot整合Swagger基本实现>/swagger-first/src/main/java/com/vip/swaggerfirst/controller/SwaggerDemoController.java
package com.vip.swaggerfirst.controller;

import com.vip.swaggerfirst.common.dto.UserDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author vip
 * @Description:
 * @Date 2019/6/15
 */
@RestController
@RequestMapping("/swagger/")
@Api("swaggerDemoController相关的api")
public class SwaggerDemoController {

    @ApiOperation(value = "输出参数id")
    @RequestMapping(value = "testId", method = RequestMethod.GET)
    public String testId(Integer id,String name,Integer age) {
        return id+" "+name+" "+age;
    }

    @ApiOperation(value = "get测试")
    @RequestMapping(value = "testGet", method = RequestMethod.GET)
    public String testGet() {
        return "Hello world!!!";
    }

    @ApiOperation(value = "模拟用户登录")
    @PostMapping("testLogin")
    public String testUserLogin(UserDto dto){
        if(!dto.checkParam()){
            return "参数异常!";
        }
        return dto.toString();
    }

}
最近下载更多
2410068425  LV23 1月11日
空心菜4  LV9 2023年7月16日
xiaoyuer2  LV8 2022年11月20日
MMENGDI  LV14 2022年8月29日
gaotieyou  LV5 2022年7月5日
1234mama  LV19 2022年6月7日
壹级天灾  LV14 2022年4月27日
fangen0005  LV25 2022年4月13日
denliv_hui  LV13 2022年2月9日
mengchuan6666  LV7 2022年1月7日
最近浏览更多
38735466  LV11 3月7日
Gin19960217  LV4 1月19日
2410068425  LV23 1月11日
0592lyj  LV9 1月5日
edpwyg  LV14 2023年10月21日
微信网友_6658069491355648  LV2 2023年10月15日
漫步的海星  LV4 2023年9月21日
空心菜4  LV9 2023年7月16日
guviva  LV6 2023年3月15日
xiaoyuer2  LV8 2022年11月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友