mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -5,6 +5,8 @@ import com.gitee.sop.storyweb.open.resp.StoryResponse;
|
||||
import com.gitee.sop.support.annotation.Open;
|
||||
import com.gitee.sop.support.context.OpenContext;
|
||||
import com.gitee.sop.support.dto.FileData;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
@@ -15,6 +17,7 @@ import java.util.List;
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Api("故事服务")
|
||||
public interface OpenStory {
|
||||
|
||||
@Open("story.save")
|
||||
@@ -27,6 +30,7 @@ public interface OpenStory {
|
||||
@Open("story.updateError")
|
||||
Integer updateError(Integer id);
|
||||
|
||||
@ApiOperation(value = "根据id获取故事")
|
||||
@Open("story.get")
|
||||
StoryResponse getById(@NotNull(message = "id必填") Integer id);
|
||||
|
||||
@@ -46,6 +50,14 @@ public interface OpenStory {
|
||||
return storyResponse;
|
||||
}
|
||||
|
||||
// 默认方法,注解放在这里也有效
|
||||
@Open("alipay.story.find")
|
||||
default StoryResponse findByName(String name) {
|
||||
StoryResponse storyResponse = new StoryResponse();
|
||||
storyResponse.setName(name);
|
||||
return storyResponse;
|
||||
}
|
||||
|
||||
// 演示单文件上传
|
||||
@Open("story.upload")
|
||||
StoryResponse upload(StorySaveRequest storySaveRequest, FileData file);
|
||||
|
27
sop-example/example-story/src/main/resources/doc.json
Normal file
27
sop-example/example-story/src/main/resources/doc.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
// 开启推送
|
||||
"enable": true,
|
||||
// 扫描package,多个用;隔开
|
||||
"basePackage": "com.gitee.sop.storyweb.open",
|
||||
// 推送URL,IP端口对应Torna服务器
|
||||
"url": "http://localhost:7700/api",
|
||||
// 模块token
|
||||
"token": "d4f07434c9cf4a989e4c6d301684b357",
|
||||
// 推送人
|
||||
"author": "Jim",
|
||||
// 打开调试:true/false
|
||||
"debug": true,
|
||||
// 是否替换文档,true:替换,false:不替换(追加)。默认:true
|
||||
"isReplace": true,
|
||||
// 第三方jar中的class配置
|
||||
"jarClass": {
|
||||
"com.xx.Page": {
|
||||
"records": { "value": "查询数据列表", "example": "" },
|
||||
"total": { "value": "总数", "example": "100" },
|
||||
"size": { "value": "页数", "example": "10" },
|
||||
"current": { "value": "当前页", "example": "1" },
|
||||
"countId": { "hidden": true },
|
||||
"orders": { "hidden": true }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.gitee.sop.storyweb;
|
||||
|
||||
|
||||
import cn.torna.swaggerplugin.SwaggerPlugin;
|
||||
|
||||
/**
|
||||
* 推送swagger文档
|
||||
* @author thc
|
||||
*/
|
||||
public class DocPushTest {
|
||||
public static void main(String[] args) {
|
||||
SwaggerPlugin.pushDoc();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user