This commit is contained in:
tanghc
2020-09-22 15:34:35 +08:00
parent f66d8bed59
commit 4ed9da7707
8 changed files with 90 additions and 5 deletions

View File

@@ -4,15 +4,18 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gitee.sop.servercommon.annotation.BizCode;
import com.gitee.sop.servercommon.annotation.Open;
import com.gitee.sop.servercommon.exception.ServiceException;
import com.gitee.sop.storyweb.controller.param.CategoryParam;
import com.gitee.sop.storyweb.controller.param.LargeTextParam;
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 com.gitee.sop.storyweb.controller.result.TestResult;
import com.gitee.sop.storyweb.controller.result.TreeResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -107,6 +110,16 @@ public class Example1001_BaseController {
return result;
}
// 绑定复杂对象
@Open(value = "sdt.get",version = "4.0")
@RequestMapping("/get/v4")
public TestResult getV4(@RequestBody TestResult testResult) {
if(StringUtils.isEmpty(testResult.getType())) {
throw new ServiceException("testResult.getType() 不能为null");
}
return testResult;
}
// 返回数组结果
@ApiOperation(value = "返回数组结果(第二)", notes = "返回数组结果", position = -99)
@Open("story.list")

View File

@@ -0,0 +1,20 @@
package com.gitee.sop.storyweb.controller.result;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class TestResult {
@ApiModelProperty(value = "标签", example = "学习")
private String label;
@ApiModelProperty(value = "类型", example = "1 超管 2 普管")
private String type;
@ApiModelProperty(value = "集合", example = "集合")
List<TestResult> ss;
}