mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
2.0
This commit is contained in:
@@ -13,7 +13,7 @@ import org.springframework.cloud.netflix.zuul.filters.Route;
|
||||
public class ZuulRouteCache extends BaseRouteCache<ZuulTargetRoute> {
|
||||
|
||||
/** 路由重试 */
|
||||
public static final boolean RETRYABLE = true;
|
||||
private static final boolean RETRYABLE = true;
|
||||
|
||||
public ZuulRouteCache(RouteRepository<ZuulTargetRoute> routeRepository) {
|
||||
super(routeRepository);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# 服务示例
|
||||
|
||||
- sop-auth:应用授权示例
|
||||
- sop-springmvc:springmvc工程实例
|
||||
- sop-story:微服务示例,story服务,同时作为Provider提供服务。本地文档:http://localhost:2222/doc.html
|
||||
- sop-book:微服务示例,book服务,也是Consumer,调用story提供的服务
|
||||
- sop-auth:应用授权示例
|
||||
- sop-springmvc:springmvc工程实例
|
||||
- sop-easyopen:整合easyopen示例
|
||||
|
@@ -6,12 +6,15 @@ import com.gitee.sop.servercommon.annotation.ApiMapping;
|
||||
import com.gitee.sop.servercommon.bean.OpenContext;
|
||||
import com.gitee.sop.servercommon.bean.ServiceContext;
|
||||
import com.gitee.sop.story.api.domain.Story;
|
||||
import com.gitee.sop.storyweb.controller.param.CategoryParam;
|
||||
import com.gitee.sop.storyweb.controller.param.StoryParam;
|
||||
import com.gitee.sop.storyweb.controller.result.CategoryResult;
|
||||
import com.gitee.sop.storyweb.controller.result.StoryResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -24,6 +27,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付宝服务端,假设签名验证通过后,到达这里进行具体的业务处理。
|
||||
*
|
||||
* @author tanghc
|
||||
*/
|
||||
@RestController
|
||||
@@ -34,52 +38,56 @@ public class AlipayController {
|
||||
// http://localhost:2222/story_get
|
||||
// 原生的接口,可正常调用
|
||||
@RequestMapping("story_get")
|
||||
public Story story_get() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队(原生)");
|
||||
return story;
|
||||
public StoryResult story_get() {
|
||||
StoryResult result = new StoryResult();
|
||||
result.setId(1L);
|
||||
result.setName("海底小纵队(原生)");
|
||||
return result;
|
||||
}
|
||||
|
||||
// http://localhost:2222/story.get/
|
||||
// 接口名,使用默认版本号
|
||||
@ApiMapping(value = "story.get")
|
||||
public Story storyget() {
|
||||
public StoryResult storyget() {
|
||||
// 获取开放平台参数
|
||||
OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext();
|
||||
String appId = openContext.getAppId();
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队(默认版本号), app_id:" + appId);
|
||||
return story;
|
||||
StoryResult result = new StoryResult();
|
||||
result.setId(1L);
|
||||
result.setName("海底小纵队(默认版本号), app_id:" + appId);
|
||||
return result;
|
||||
}
|
||||
|
||||
// http://localhost:2222/story.get/?version=1.1
|
||||
// 接口名 + 版本号
|
||||
@ApiMapping(value = "story.get", version = "1.1")
|
||||
public Story getStory2() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队1.0");
|
||||
return story;
|
||||
public StoryResult getStory2() {
|
||||
StoryResult result = new StoryResult();
|
||||
result.setId(1L);
|
||||
result.setName("海底小纵队1.0");
|
||||
return result;
|
||||
}
|
||||
|
||||
// http://localhost:2222/story.get/?name=111&version=2.0
|
||||
// 接口名 + 版本号
|
||||
// StoryParam对应biz_content内容
|
||||
@ApiMapping(value = "story.get", version = "2.0")
|
||||
public Story getStory20(Story story) {
|
||||
return story;
|
||||
public StoryResult getStory20(StoryParam param) {
|
||||
StoryResult result = new StoryResult();
|
||||
BeanUtils.copyProperties(param, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 忽略验证
|
||||
@ApiMapping(value = "story.get", version = "2.1", ignoreValidate = true)
|
||||
public Story getStory21(Story story) {
|
||||
public StoryResult getStory21(StoryParam story) {
|
||||
OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext();
|
||||
// 此处的param和story参数是一样的
|
||||
Story param = openContext.getBizObject(Story.class);
|
||||
StoryParam param = openContext.getBizObject(StoryParam.class);
|
||||
boolean isSame = story == param;
|
||||
story.setName(story.getName() + ", story.get2.1, ignoreValidate = true, story==param:" + isSame);
|
||||
return story;
|
||||
StoryResult result = new StoryResult();
|
||||
result.setName(story.getName() + ", story.get2.1, ignoreValidate = true, story==param:" + isSame);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,23 +103,26 @@ public class AlipayController {
|
||||
* return bizObject;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param openContext
|
||||
* @return
|
||||
*/
|
||||
@ApiMapping(value = "story.get", version = "2.2")
|
||||
public Story getStory22(OpenContext<Story> openContext) {
|
||||
Story bizObject = openContext.getBizObject();
|
||||
public StoryResult getStory22(OpenContext<StoryParam> openContext) {
|
||||
StoryParam bizObject = openContext.getBizObject();
|
||||
// 获取appid,更多方法查看OpenContext类
|
||||
String appId = openContext.getAppId();
|
||||
bizObject.setName("appId:" + appId + ", " + bizObject.getName());
|
||||
return bizObject;
|
||||
StoryResult result = new StoryResult();
|
||||
result.setName("appId:" + appId + ", " + bizObject.getName());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiMapping(value = "story.get", version = "2.3")
|
||||
public Story getStory23(Story story, HttpServletRequest request) {
|
||||
public StoryResult getStory23(StoryParam param, HttpServletRequest request) {
|
||||
OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext();
|
||||
String appId = openContext.getAppId();
|
||||
System.out.println(appId);
|
||||
StoryResult story = new StoryResult();
|
||||
story.setName("appId:" + appId + ", " + story.getName() + ",ip:" + request.getLocalAddr());
|
||||
return story;
|
||||
}
|
||||
@@ -120,9 +131,9 @@ public class AlipayController {
|
||||
// 遗留接口具备开放平台能力
|
||||
@ApiAbility
|
||||
@GetMapping("getStory2")
|
||||
public Story getStory2_0() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
public StoryResult getStory2_0() {
|
||||
StoryResult story = new StoryResult();
|
||||
story.setId(1L);
|
||||
story.setName("海底小纵队(默认版本号)");
|
||||
return story;
|
||||
}
|
||||
@@ -131,118 +142,117 @@ public class AlipayController {
|
||||
// 遗留接口具备开放平台能力,在原来的基础上加版本号
|
||||
@ApiAbility(version = "2.1")
|
||||
@GetMapping("getStory2")
|
||||
public Story getStory2_1() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
public StoryResult getStory2_1() {
|
||||
StoryResult story = new StoryResult();
|
||||
story.setId(1L);
|
||||
story.setName("海底小纵队2.1");
|
||||
return story;
|
||||
}
|
||||
|
||||
// http://localhost:2222/alipay.story.get/
|
||||
@ApiOperation(value="获取故事信息2", notes = "获取故事信息2的详细信息")
|
||||
@ApiMapping(value = "alipay.story.get")
|
||||
public Story getStory(Story param) {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
public StoryResult getStory(StoryParam param) {
|
||||
StoryResult story = new StoryResult();
|
||||
story.setId(1L);
|
||||
story.setName("海底小纵队(alipay.story.get1.0), param:" + param);
|
||||
return story;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param 对应biz_content中的内容,并自动JSR-303校验
|
||||
* @return
|
||||
*/
|
||||
@ApiMapping(value = "alipay.story.get", version = "1.2")
|
||||
public Story getStory11(Story param) {
|
||||
Story story2 = new Story();
|
||||
story2.setId(1);
|
||||
public StoryResult getStory11(StoryParam param) {
|
||||
StoryResult story2 = new StoryResult();
|
||||
story2.setId(1L);
|
||||
story2.setName("海底小纵队(alipay.story.get1.2), param:" + param);
|
||||
return story2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证字符串乱码问题
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@ApiMapping(value = "story.string.get", version = "1.0")
|
||||
public String string(Story param) {
|
||||
Story story2 = new Story();
|
||||
story2.setId(1);
|
||||
public String string(StoryParam param) {
|
||||
StoryResult story2 = new StoryResult();
|
||||
story2.setId(1L);
|
||||
story2.setName("海底小纵队");
|
||||
return JSON.toJSONString(story2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数绑定
|
||||
*
|
||||
* @param story 对应biz_content中的内容,并自动JSR-303校验
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取故事信息", notes = "说明接口的详细信息,介绍,用途,注意事项等。")
|
||||
@ApiMapping(value = "alipay.story.find")
|
||||
public StoryVO getStory2(StoryParam story) {
|
||||
public StoryResult getStory2(StoryParam story) {
|
||||
log.info("获取故事信息参数, story: {}", story);
|
||||
// 获取其它参数
|
||||
OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext();
|
||||
String app_id = openContext.getAppId();
|
||||
StoryVO storyVO = new StoryVO();
|
||||
storyVO.id = 1L;
|
||||
storyVO.name = "白雪公主, app_id:" + app_id;
|
||||
storyVO.gmt_create = new Date();
|
||||
StoryResult storyVO = new StoryResult();
|
||||
storyVO.setName("白雪公主, app_id:" + app_id);
|
||||
storyVO.setGmt_create(new Date());
|
||||
return storyVO;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "返回数组结果", notes = "返回数组结果")
|
||||
@ApiMapping(value = "alipay.story.find2")
|
||||
public List<StoryVO> getStory3(StoryParam story) {
|
||||
public List<StoryResult> getStory3(StoryParam story) {
|
||||
int index = 0;
|
||||
StoryVO storyVO = new StoryVO();
|
||||
storyVO.id = 1L;
|
||||
storyVO.name = "白雪公主, index:" + index++;
|
||||
storyVO.gmt_create = new Date();
|
||||
StoryResult storyVO = new StoryResult();
|
||||
storyVO.setId(1L);
|
||||
storyVO.setName("白雪公主, index:" + index++);
|
||||
storyVO.setGmt_create(new Date());
|
||||
|
||||
StoryVO storyVO2 = new StoryVO();
|
||||
storyVO2.id = 1L;
|
||||
storyVO2.name = "白雪公主, index:" + index++;
|
||||
storyVO2.gmt_create = new Date();
|
||||
StoryResult storyVO2 = new StoryResult();
|
||||
storyVO2.setId(1L);
|
||||
storyVO2.setName("白雪公主, index:" + index++);
|
||||
storyVO2.setGmt_create(new Date());
|
||||
|
||||
return Arrays.asList(storyVO, storyVO2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示文档表格树
|
||||
* @param story
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取分类信息", notes = "演示表格树")
|
||||
@ApiMapping(value = "alipay.category.get", method = RequestMethod.POST)
|
||||
public Category getCategory(Category story) {
|
||||
StoryVO storyVO = new StoryVO();
|
||||
storyVO.id = 1L;
|
||||
storyVO.name = "白雪公主";
|
||||
storyVO.gmt_create = new Date();
|
||||
Category category = new Category();
|
||||
category.setCategoryName("娱乐");
|
||||
category.setStory(storyVO);
|
||||
return category;
|
||||
public CategoryResult getCategory(CategoryParam param) {
|
||||
StoryResult result = new StoryResult();
|
||||
result.setId(1L);
|
||||
result.setName("白雪公主");
|
||||
result.setGmt_create(new Date());
|
||||
CategoryResult categoryResult = new CategoryResult();
|
||||
categoryResult.setCategoryName("娱乐");
|
||||
categoryResult.setStoryResult(result);
|
||||
return categoryResult;
|
||||
}
|
||||
|
||||
// 测试参数绑定,http://localhost:2222/story/getStory4?biz_content=%7b%22id%22%3a1%2c%22name%22%3a%22aaaa%22%7d
|
||||
@ApiAbility
|
||||
@GetMapping("getStory4")
|
||||
public StoryResult getStory4(Story param, P p2) {
|
||||
System.out.println(param + ", p2=" + p2);
|
||||
StoryResult result = new StoryResult();
|
||||
result.setId(1L);
|
||||
result.setName("海底小纵队(默认版本号)" + param + ", p2=" + p2);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class StoryVO {
|
||||
@ApiModelProperty(value = "故事ID", example = "1")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "故事名称", example = "海底小纵队")
|
||||
public static class P {
|
||||
private String name;
|
||||
@ApiModelProperty(value = "创建时间", example = "2019-04-14 19:02:12")
|
||||
private Date gmt_create;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Category {
|
||||
@ApiModelProperty(value = "分类名称", example = "娱乐")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty(value = "分类故事")
|
||||
private StoryVO story;
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import com.gitee.sop.servercommon.annotation.ApiMapping;
|
||||
import com.gitee.sop.servercommon.util.UploadUtil;
|
||||
import com.gitee.sop.storyweb.controller.param.FileUploadParam;
|
||||
import com.gitee.sop.storyweb.controller.param.FileUploadParam2;
|
||||
import com.gitee.sop.storyweb.vo.FileUploadVO;
|
||||
import com.gitee.sop.storyweb.controller.result.FileUploadResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.Extension;
|
||||
@@ -33,19 +33,19 @@ public class FileUploadDemoController {
|
||||
*/
|
||||
@ApiOperation(value = "文件上传例1", notes = "上传文件demo")
|
||||
@ApiMapping(value = "demo.file.upload")
|
||||
public FileUploadVO file1(FileUploadParam param) {
|
||||
public FileUploadResult file1(FileUploadParam param) {
|
||||
System.out.println(param.getRemark());
|
||||
// 获取上传的文件
|
||||
MultipartFile file1 = param.getFile1();
|
||||
MultipartFile file2 = param.getFile2();
|
||||
|
||||
FileUploadVO vo = new FileUploadVO();
|
||||
FileUploadVO.FileMeta fileMeta1 = buildFileMeta(file1);
|
||||
FileUploadVO.FileMeta fileMeta2 = buildFileMeta(file2);
|
||||
FileUploadResult result = new FileUploadResult();
|
||||
FileUploadResult.FileMeta fileMeta1 = buildFileMeta(file1);
|
||||
FileUploadResult.FileMeta fileMeta2 = buildFileMeta(file2);
|
||||
|
||||
vo.getFiles().add(fileMeta1);
|
||||
vo.getFiles().add(fileMeta2);
|
||||
return vo;
|
||||
result.getFiles().add(fileMeta1);
|
||||
result.getFiles().add(fileMeta2);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,19 +58,19 @@ public class FileUploadDemoController {
|
||||
// 多文件上传、不确定文件数量上传,必须申明下面这句,否则沙盒界面不会出现上传控件
|
||||
, extensions = @Extension(properties = @ExtensionProperty(name = "multiple", value = "multiple")))
|
||||
@ApiMapping(value = "demo.file.upload2")
|
||||
public FileUploadVO file2(FileUploadParam2 param, HttpServletRequest request) {
|
||||
public FileUploadResult file2(FileUploadParam2 param, HttpServletRequest request) {
|
||||
System.out.println(param.getRemark());
|
||||
FileUploadVO vo = new FileUploadVO();
|
||||
FileUploadResult result = new FileUploadResult();
|
||||
// 获取上传的文件
|
||||
Collection<MultipartFile> uploadFiles = UploadUtil.getUploadFiles(request);
|
||||
for (MultipartFile multipartFile : uploadFiles) {
|
||||
FileUploadVO.FileMeta fileMeta = buildFileMeta(multipartFile);
|
||||
vo.getFiles().add(fileMeta);
|
||||
FileUploadResult.FileMeta fileMeta = buildFileMeta(multipartFile);
|
||||
result.getFiles().add(fileMeta);
|
||||
}
|
||||
return vo;
|
||||
return result;
|
||||
}
|
||||
|
||||
private FileUploadVO.FileMeta buildFileMeta(MultipartFile multipartFile) {
|
||||
private FileUploadResult.FileMeta buildFileMeta(MultipartFile multipartFile) {
|
||||
// 文件名
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
// 文件大小
|
||||
@@ -82,6 +82,6 @@ public class FileUploadDemoController {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new FileUploadVO.FileMeta(fileName, size, fileContent);
|
||||
return new FileUploadResult.FileMeta(fileName, size, fileContent);
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.gitee.sop.storyweb.controller;
|
||||
|
||||
import com.gitee.sop.servercommon.annotation.ApiMapping;
|
||||
import com.gitee.sop.story.api.domain.Story;
|
||||
import com.gitee.sop.storyweb.controller.result.StoryResult;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
@@ -13,9 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class PermissionDemoController {
|
||||
|
||||
@ApiMapping(value = "permission.story.get", permission = true)
|
||||
public Story getStory() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
public StoryResult getStory() {
|
||||
StoryResult story = new StoryResult();
|
||||
story.setId(1L);
|
||||
story.setName("海底小纵队(permission.story.get)");
|
||||
return story;
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import com.gitee.sop.servercommon.bean.ServiceContext;
|
||||
import com.gitee.sop.servercommon.bean.OpenContext;
|
||||
import com.gitee.sop.story.api.domain.Story;
|
||||
import com.gitee.sop.storyweb.controller.param.StoryParam;
|
||||
import com.gitee.sop.storyweb.controller.result.StoryResult;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -24,7 +25,7 @@ public class PostJsonController {
|
||||
* @return
|
||||
*/
|
||||
@ApiMapping("demo.post.json")
|
||||
public Story postJson(@RequestBody StoryParam param) {
|
||||
public StoryResult postJson(@RequestBody StoryParam param) {
|
||||
// 获取开放平台请求参数
|
||||
OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext();
|
||||
List<Object> params = Arrays.asList(
|
||||
@@ -32,10 +33,10 @@ public class PostJsonController {
|
||||
openContext.getMethod(),
|
||||
openContext.getVersion()
|
||||
);
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("参数:" + param.getName() + ", openParams:" + StringUtils.join(params));
|
||||
return story;
|
||||
StoryResult result = new StoryResult();
|
||||
result.setId(1L);
|
||||
result.setName("参数:" + param.getName() + ", openParams:" + StringUtils.join(params));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,49 +0,0 @@
|
||||
package com.gitee.sop.storyweb.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;
|
||||
|
||||
/**
|
||||
* @author tanghc
|
||||
*/
|
||||
@ApiAbility // 放在这里,下面所有的接口都具备接口提供能力
|
||||
@RestController
|
||||
@RequestMapping("story2")
|
||||
@Api(tags = "故事接口2")
|
||||
public class Story2Controller{
|
||||
|
||||
@RequestMapping("getStory4")
|
||||
public Story getStory4() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队(getStory4)");
|
||||
return story;
|
||||
}
|
||||
|
||||
// 优先使用方法上@ApiAbility
|
||||
@ApiOperation(value="获取故事信息2", notes = "获取故事信息2的详细信息")
|
||||
@ApiAbility(version = "1.4")
|
||||
@RequestMapping("getStory4")
|
||||
public Story storyget() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队(1.4)");
|
||||
return story;
|
||||
}
|
||||
|
||||
// 优先使用@ApiMapping
|
||||
@ApiMapping(value = "story.get2")
|
||||
public Story getStory2() {
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队story.get2");
|
||||
return story;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,10 +1,7 @@
|
||||
package com.gitee.sop.storyweb.controller;
|
||||
|
||||
import com.gitee.sop.servercommon.annotation.ApiAbility;
|
||||
import com.gitee.sop.story.api.domain.Story;
|
||||
import com.gitee.sop.story.api.service.StoryService;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
@@ -22,31 +19,5 @@ public class StoryController implements StoryService {
|
||||
return story;
|
||||
}
|
||||
|
||||
// 测试参数绑定
|
||||
@ApiAbility
|
||||
@GetMapping("getStory3")
|
||||
public Story getStory3(String id) {
|
||||
System.out.println(id);
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队(默认版本号)");
|
||||
return story;
|
||||
}
|
||||
|
||||
// 测试参数绑定,http://localhost:2222/story/getStory4?biz_content={"id":1, "name":"aaaa"}
|
||||
@ApiAbility
|
||||
@GetMapping("getStory4")
|
||||
public Story getStory4(Story param, P p2) {
|
||||
System.out.println(param + ", p2=" + p2);
|
||||
Story story = new Story();
|
||||
story.setId(1);
|
||||
story.setName("海底小纵队(默认版本号)");
|
||||
return story;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class P {
|
||||
private String name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package com.gitee.sop.storyweb.controller.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CategoryParam {
|
||||
@ApiModelProperty(value = "分类名称", example = "娱乐")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty(value = "分类故事")
|
||||
private StoryParam storyParam;
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.gitee.sop.storyweb.controller.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CategoryResult {
|
||||
@ApiModelProperty(value = "分类名称", example = "娱乐")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty(value = "分类故事")
|
||||
private StoryResult storyResult;
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.gitee.sop.storyweb.vo;
|
||||
package com.gitee.sop.storyweb.controller.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
* @author tanghc
|
||||
*/
|
||||
@Data
|
||||
public class FileUploadVO {
|
||||
public class FileUploadResult {
|
||||
|
||||
private List<FileMeta> files = new ArrayList();
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package com.gitee.sop.storyweb.controller.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author tanghc
|
||||
*/
|
||||
@Data
|
||||
public class StoryResult {
|
||||
@ApiModelProperty(value = "故事ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "故事名称", example = "海底小纵队")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", example = "2019-04-14 19:02:12")
|
||||
private Date gmt_create;
|
||||
}
|
Reference in New Issue
Block a user