Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
knowledge-graph
Commits
7a001bed
Commit
7a001bed
authored
Feb 25, 2026
by
wujipeng
Browse files
响应体优化
parent
e6351ce8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/knowledgegraph/result/Response.java
View file @
7a001bed
...
@@ -2,41 +2,35 @@ package com.ruzhoukj.knowledgegraph.result;
...
@@ -2,41 +2,35 @@ package com.ruzhoukj.knowledgegraph.result;
public
class
Response
<
T
>
{
public
class
Response
<
T
>
{
private
boolean
success
;
private
Integer
code
;
private
String
message
;
private
String
message
;
private
T
data
;
private
T
data
;
private
Integer
total
;
public
Response
()
{
public
Response
()
{
}
}
public
Response
(
boolean
success
,
String
message
,
T
data
)
{
public
Response
(
Integer
code
,
String
message
,
T
data
)
{
this
.
success
=
success
;
this
.
code
=
code
;
this
.
message
=
message
;
this
.
message
=
message
;
this
.
data
=
data
;
this
.
data
=
data
;
}
}
public
static
<
T
>
Response
<
T
>
success
(
T
data
)
{
public
static
<
T
>
Response
<
T
>
success
(
T
data
)
{
return
new
Response
<>(
true
,
"操作成功"
,
data
);
return
new
Response
<>(
200
,
"操作成功"
,
data
);
}
public
static
<
T
>
Response
<
T
>
success
(
T
data
,
int
total
)
{
Response
<
T
>
response
=
new
Response
<>(
true
,
"操作成功"
,
data
);
response
.
setTotal
(
total
);
return
response
;
}
}
public
static
<
T
>
Response
error
(
String
message
)
{
public
static
<
T
>
Response
error
(
String
message
)
{
return
new
Response
<>(
false
,
message
,
null
);
return
new
Response
<>(
400
,
message
,
null
);
}
}
// Getters and Setters
// Getters and Setters
public
boolean
isSuccess
()
{
public
Integer
getCode
()
{
return
success
;
return
code
;
}
}
public
void
set
Success
(
boolean
success
)
{
public
void
set
Code
(
Integer
code
)
{
this
.
success
=
success
;
this
.
code
=
code
;
}
}
public
String
getMessage
()
{
public
String
getMessage
()
{
...
@@ -55,11 +49,5 @@ public class Response<T> {
...
@@ -55,11 +49,5 @@ public class Response<T> {
this
.
data
=
data
;
this
.
data
=
data
;
}
}
public
Integer
getTotal
()
{
return
total
;
}
public
void
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment