Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7f4e691e
authored
Jun 12, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
1 parent
704c2e2c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
19 deletions
project-interface/src/main/java/com/alibaba/cloud/integration/common/IResult.java
project-interface/src/main/java/com/alibaba/cloud/integration/common/Result.java
project-interface/src/main/java/com/alibaba/cloud/integration/common/ResultEnum.java
project-interface/src/main/java/com/alibaba/cloud/integration/common/IResult.java
View file @
7f4e691
...
@@ -22,7 +22,7 @@ public interface IResult {
...
@@ -22,7 +22,7 @@ public interface IResult {
* Get result code.
* Get result code.
* @return result code
* @return result code
*/
*/
Integer
getCode
();
String
getCode
();
/**
/**
* Get result message.
* Get result message.
...
...
project-interface/src/main/java/com/alibaba/cloud/integration/common/Result.java
View file @
7f4e691
...
@@ -21,15 +21,14 @@ package com.alibaba.cloud.integration.common;
...
@@ -21,15 +21,14 @@ package com.alibaba.cloud.integration.common;
*/
*/
public
class
Result
<
T
>
{
public
class
Result
<
T
>
{
private
Integer
code
;
private
String
code
;
private
String
message
;
private
String
message
;
private
T
data
;
private
T
result
;
public
static
<
T
>
Result
<
T
>
success
(
T
data
)
{
public
static
<
T
>
Result
<
T
>
success
(
T
data
)
{
return
new
Result
<>(
ResultEnum
.
SUCCESS
.
getCode
(),
ResultEnum
.
SUCCESS
.
getMessage
(),
return
new
Result
<>(
ResultEnum
.
SUCCESS
.
getCode
(),
ResultEnum
.
SUCCESS
.
getMessage
(),
data
);
data
);
}
}
public
static
<
T
>
Result
<
T
>
success
(
String
message
,
T
data
)
{
public
static
<
T
>
Result
<
T
>
success
(
String
message
,
T
data
)
{
...
@@ -52,17 +51,17 @@ public class Result<T> {
...
@@ -52,17 +51,17 @@ public class Result<T> {
public
Result
()
{
public
Result
()
{
}
}
public
Result
(
Integer
code
,
String
message
,
T
data
)
{
public
Result
(
String
code
,
String
message
,
T
data
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
message
=
message
;
this
.
message
=
message
;
this
.
data
=
data
;
this
.
result
=
data
;
}
}
public
Integer
getCode
()
{
public
String
getCode
()
{
return
code
;
return
code
;
}
}
public
void
setCode
(
Integer
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
...
@@ -75,19 +74,18 @@ public class Result<T> {
...
@@ -75,19 +74,18 @@ public class Result<T> {
}
}
public
T
getData
()
{
public
T
getData
()
{
return
data
;
return
result
;
}
}
public
void
setData
(
T
data
)
{
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
this
.
result
=
data
;
}
}
public
static
<
T
>
Result
<
T
>
instance
(
Integer
code
,
String
message
,
T
data
)
{
public
static
<
T
>
Result
<
T
>
instance
(
String
code
,
String
message
,
T
data
)
{
Result
<
T
>
result
=
new
Result
<>();
Result
<
T
>
result
=
new
Result
<>();
result
.
setCode
(
code
);
result
.
setCode
(
code
);
result
.
setMessage
(
message
);
result
.
setMessage
(
message
);
result
.
setData
(
data
);
result
.
setData
(
data
);
return
result
;
return
result
;
}
}
}
}
project-interface/src/main/java/com/alibaba/cloud/integration/common/ResultEnum.java
View file @
7f4e691
...
@@ -25,30 +25,30 @@ public enum ResultEnum implements IResult {
...
@@ -25,30 +25,30 @@ public enum ResultEnum implements IResult {
/**
/**
* return success result.
* return success result.
*/
*/
SUCCESS
(
2001
,
"接口调用成功"
),
SUCCESS
(
"S001"
,
"接口调用成功"
),
/**
/**
* return business common failed.
* return business common failed.
*/
*/
COMMON_FAILED
(
2003
,
"接口调用失败"
);
COMMON_FAILED
(
"F001"
,
"接口调用失败"
);
private
Integer
code
;
private
String
code
;
private
String
message
;
private
String
message
;
ResultEnum
()
{
ResultEnum
()
{
}
}
ResultEnum
(
Integer
code
,
String
message
)
{
ResultEnum
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
message
=
message
;
this
.
message
=
message
;
}
}
@Override
@Override
public
Integer
getCode
()
{
public
String
getCode
()
{
return
code
;
return
code
;
}
}
public
void
setCode
(
Integer
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment