package com.evelyn.template.web.controller;

import com.evelyn.template.web.base.ResultObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


@Api(value="TestController",tags={"测试接口"})
@RequestMapping("/api/test")
@RestController
public class TestController {

    @ApiOperation(value = "输出msg")
    @RequestMapping(value = "/printMsg", method = {RequestMethod.POST})
    public ResultObject printMsg(@RequestParam String msg) {
        return ResultObject.SUCCESS().message(msg).build();
    }

    @ApiOperation(value = "获取msg")
    @RequestMapping(value = "/getMsg", method = {RequestMethod.GET})
    public String getMsg(@RequestParam String msg) {
        return msg;
    }

    @ApiOperation(value = "再次输出msg")
    @PostMapping("/printMsg2")
    public ResponseEntity<ResultObject<?>> printMsg2(@RequestParam String msg) {
        return ResponseEntity.ok(ResultObject.SUCCESS().message(msg).build());
    }

}
