package com.example.demo.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author FXF
 * @date 2018-09-05
 */
@Controller
@RequestMapping("/")
@Api("测试controller的API")
public class TestController {

    @ApiOperation(value = "测试无参", notes = "无参")
    @GetMapping("/test")
    @ResponseBody
    public String test(){
        return "ok====";
    }

    @ApiOperation(value = "测试restful接口", notes = "测试接口")
    @ApiImplicitParam(name = "id", value = "测试ID", paramType = "path", required = true, dataType = "String")
    @GetMapping("/test/{id}")
    @ResponseBody
    public String testSwagger(@PathVariable String id){
        return id;
    }

}
