文档分组显示

This commit is contained in:
tanghc
2019-04-16 20:39:47 +08:00
parent f9c8a859b7
commit dc00bcad2e
20 changed files with 435 additions and 162 deletions

View File

@@ -0,0 +1,31 @@
package com.gitee.easyopen.server.api;
import com.gitee.easyopen.annotation.Api;
import com.gitee.easyopen.annotation.ApiService;
import com.gitee.easyopen.doc.annotation.ApiDoc;
import com.gitee.easyopen.doc.annotation.ApiDocMethod;
import com.gitee.easyopen.server.api.param.GoodsParam;
import com.gitee.easyopen.server.api.result.Goods;
import java.math.BigDecimal;
/**
* 业务类
*
* @author tanghc
*/
@ApiService
@ApiDoc("库存接口")
public class Goods2Api {
@Api(name = "store.get")
@ApiDocMethod(description = "获取库存")
Goods getGoods(GoodsParam param) {
Goods goods = new Goods();
goods.setId(1L);
goods.setGoods_name("苹果iPhoneX");
goods.setPrice(new BigDecimal(8000));
return goods;
}
}

View File

@@ -15,7 +15,7 @@ import java.math.BigDecimal;
* @author tanghc
*/
@ApiService
@ApiDoc("商品模块")
@ApiDoc("商品接口")
public class GoodsApi {
@Api(name = "goods.get")

View File

@@ -0,0 +1,28 @@
package com.gitee.easyopen.server.config;
import com.gitee.easyopen.doc.ApiDocHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;
public abstract class BaseSopDocController {
public abstract String getDocTitle();
@RequestMapping("/v2/api-docs")
@ResponseBody
public Map<String, Object> getDocInfo() {
Map<String, Object> context = this.getContext();
context.put("easyopen", "1.16.3");
context.put("apiModules", ApiDocHolder.getApiDocBuilder().getApiModules());
context.put("title", getDocTitle());
return context;
}
public Map<String, Object> getContext() {
return new HashMap<>(8);
}
}

View File

@@ -2,10 +2,19 @@ package com.gitee.easyopen.server.config;
import com.gitee.sop.servercommon.configuration.EasyopenServiceConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
/**
* @author tanghc
*/
@Configuration
public class SopConfig extends EasyopenServiceConfiguration {
@Controller
public static class SopDocController extends BaseSopDocController {
@Override
public String getDocTitle() {
return "商品API";
}
}
}

View File

@@ -3,6 +3,7 @@ package com.gitee.sop.bookweb.controller;
import com.gitee.sop.bookweb.controller.param.StoryParam;
import com.gitee.sop.servercommon.annotation.ApiMapping;
import com.gitee.sop.story.api.domain.Story;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
@@ -16,6 +17,7 @@ import java.util.Date;
* @author tanghc
*/
@RestController
@Api(tags = "故事接口")
public class AlipayController {
@ApiMapping(value = "alipay.story.get")

View File

@@ -3,6 +3,7 @@ package com.gitee.sop.bookweb.controller;
import com.gitee.sop.servercommon.annotation.ApiAbility;
import com.gitee.sop.servercommon.annotation.ApiMapping;
import com.gitee.sop.story.api.domain.Story;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
@ApiAbility // 放在这里,下面所有的接口都具备接口提供能力
@RestController
@RequestMapping("story2")
@Api(tags = "故事接口2")
public class Story2Controller{
@RequestMapping("getStory4")