cm-cloud/cloud-common/src/main/java/com/cm/common/controller/ApiDocController.java

48 lines
1.5 KiB
Java

package com.cm.common.controller;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.service.IApiDocService;
import freemarker.template.TemplateException;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候,想想当初你为何开始
*
* @ClassName: ApiDocController
* @Description: api文档
* @Author: WangGeng
* @Date: 2021/8/14 10:58
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "api文档")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/api-doc")
public class ApiDocController extends AbstractController {
@Autowired
private IApiDocService apiDocService;
@GetMapping("get-api")
public Map<String, Object> getApi() {
return apiDocService.getApi();
}
@GetMapping("get")
public void get(HttpServletRequest request, HttpServletResponse response) throws IOException, TemplateException {
apiDocService.get(request, response);
}
}