Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
87c64fc7
Commit
87c64fc7
authored
Jun 14, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
压缩视频
parent
08181534
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
1 deletion
+114
-1
ResponseResult.java
...src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
+5
-1
ResponseResultMain.java
...main/java/com/yanzuoguang/util/vo/ResponseResultMain.java
+109
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
View file @
87c64fc7
...
@@ -198,6 +198,11 @@ public class ResponseResult<T> extends BaseVo {
...
@@ -198,6 +198,11 @@ public class ResponseResult<T> extends BaseVo {
public
static
final
<
T
extends
Object
>
ResponseResult
<
T
>
result
(
T
data
,
boolean
allowNull
)
{
public
static
final
<
T
extends
Object
>
ResponseResult
<
T
>
result
(
T
data
,
boolean
allowNull
)
{
ResponseResult
<
T
>
ret
=
new
ResponseResult
<
T
>();
ResponseResult
<
T
>
ret
=
new
ResponseResult
<
T
>();
ret
.
setData
(
data
);
ret
.
setData
(
data
);
initDataStatus
(
ret
,
data
,
allowNull
);
return
ret
;
}
protected
static
void
initDataStatus
(
ResponseResult
ret
,
Object
data
,
boolean
allowNull
)
{
if
(!
allowNull
&&
StringHelper
.
isEmpty
(
data
))
{
if
(!
allowNull
&&
StringHelper
.
isEmpty
(
data
))
{
ret
.
setCode
(
ResultConstants
.
RESULT_EMPTY
);
ret
.
setCode
(
ResultConstants
.
RESULT_EMPTY
);
ret
.
setMessage
(
"结果为空"
);
ret
.
setMessage
(
"结果为空"
);
...
@@ -205,7 +210,6 @@ public class ResponseResult<T> extends BaseVo {
...
@@ -205,7 +210,6 @@ public class ResponseResult<T> extends BaseVo {
ret
.
setCode
(
ResultConstants
.
SUCCESS
);
ret
.
setCode
(
ResultConstants
.
SUCCESS
);
ret
.
setMessage
(
"处理成功"
);
ret
.
setMessage
(
"处理成功"
);
}
}
return
ret
;
}
}
/**
/**
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/ResponseResultMain.java
0 → 100755
View file @
87c64fc7
package
com
.
yanzuoguang
.
util
.
vo
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* 接口之间的通讯结果
*
* @author 颜佐光
*/
public
class
ResponseResultMain
<
T
,
M
>
extends
ResponseResult
<
T
>
{
/**
* 返回数据
*/
@ApiModelProperty
(
value
=
"返回数据"
,
notes
=
"返回的具体数据"
,
required
=
true
)
private
M
main
;
public
M
getMain
()
{
return
main
;
}
public
void
setMain
(
M
main
)
{
this
.
main
=
main
;
}
/**
* 构造函数
*/
public
ResponseResultMain
()
{
super
();
}
/**
* 构造函数
*
* @param code 结果状态
* @param message 结果消息
*/
public
ResponseResultMain
(
String
code
,
String
message
)
{
super
(
code
,
message
);
}
/**
* 构造函数
*
* @param code 结果状态
* @param message 结果熊希
* @param data 结果
*/
public
ResponseResultMain
(
String
code
,
String
message
,
T
data
)
{
super
(
code
,
message
,
data
);
}
/**
* 构造函数
*
* @param code 结果状态
* @param message 结果熊希
* @param data 结果
*/
public
ResponseResultMain
(
String
code
,
String
message
,
T
data
,
M
main
,
Object
target
)
{
super
(
code
,
message
,
data
,
target
);
this
.
main
=
main
;
}
/**
* 构造成功结果
*
* @param data 数据
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public
static
final
<
T
,
M
>
ResponseResultMain
<
T
,
M
>
result
(
T
data
,
M
main
)
{
return
result
(
data
,
main
,
false
);
}
/**
* 构造成功结果,不允许为空
*
* @param data 数据
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public
static
final
<
T
,
M
>
ResponseResultMain
<
T
,
M
>
resultAllowNull
(
T
data
,
M
main
)
{
return
result
(
data
,
main
,
true
);
}
/**
* 构造成功结果
*
* @param data 数据
* @param main 主数据
* @param allowNull 允许为空
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public
static
final
<
T
,
M
>
ResponseResultMain
<
T
,
M
>
result
(
T
data
,
M
main
,
boolean
allowNull
)
{
ResponseResultMain
<
T
,
M
>
ret
=
new
ResponseResultMain
<
T
,
M
>();
ret
.
setData
(
data
);
ret
.
setMain
(
main
);
initDataStatus
(
ret
,
data
,
allowNull
);
return
ret
;
}
}
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