-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 22 additions & 8 deletions
30
ddd/multi-layers/src/main/java/org/hzz/domain/common/Result.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
package org.hzz.domain.common; | ||
|
||
import java.util.LinkedHashMap; | ||
import com.alibaba.fastjson2.annotation.JSONField; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
public class Result<T> extends LinkedHashMap<String, Object> { | ||
@Data | ||
public class Result<T> { | ||
|
||
@Schema(description = "返回码",example = "200") | ||
@JSONField(ordinal = 0) | ||
private String code; | ||
|
||
@Schema(description = "返回信息",example = "success") | ||
@JSONField(ordinal = 1) | ||
private String msg; | ||
|
||
@Schema(description = "返回数据") | ||
@JSONField(ordinal = 2) | ||
private T data; | ||
public static <T> Result<T> success(T data){ | ||
Result<T> result = new Result<>(); | ||
result.put("code", "200"); | ||
result.put("msg", "success"); | ||
result.put("data", data); | ||
result.setCode("200"); | ||
result.setMsg("success"); | ||
result.setData(data); | ||
return result; | ||
} | ||
|
||
public static <T> Result<T> error(T data, String code, String msg){ | ||
Result<T> result = new Result<>(); | ||
result.put("code", code); | ||
result.put("msg", msg); | ||
result.put("error", data); | ||
result.setCode(code); | ||
result.setMsg(msg); | ||
result.setData(data); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
package org.hzz.domain.vo; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class UserVO { | ||
|
||
@Schema(description = "用户名",example = "q10viking",title = "用户名t") | ||
private String name; | ||
|
||
@Schema(description = "密码",example = "123456") | ||
private String password; | ||
} |
24 changes: 24 additions & 0 deletions
24
ddd/multi-layers/src/main/resources/static/redoc-ui/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Redoc</title> | ||
<!-- needed for adaptive design --> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet"> | ||
|
||
<!-- | ||
Redoc doesn't change outer page styles | ||
--> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<redoc spec-url='http://localhost:8080/api/v3/api-docs'></redoc> | ||
<script src="https://cdn.redoc.ly/redoc/v2.0.0/bundles/redoc.standalone.js"> </script> | ||
</body> | ||
</html> |