Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
75a88dae
提交
75a88dae
authored
3月 24, 2023
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 修改集合非空判断方法名
上级
c4eac807
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
8 行增加
和
8 行删除
+8
-8
Permissions.java
...-auth/src/main/java/com/yiring/auth/util/Permissions.java
+1
-1
ValidateUtil.java
.../main/java/com/yiring/common/validation/ValidateUtil.java
+1
-1
Commons.java
...on/util/src/main/java/com/yiring/common/util/Commons.java
+6
-6
没有找到文件。
basic-auth/src/main/java/com/yiring/auth/util/Permissions.java
浏览文件 @
75a88dae
...
@@ -91,7 +91,7 @@ public class Permissions {
...
@@ -91,7 +91,7 @@ public class Permissions {
)
)
)
)
.
peek
(
item
->
{
.
peek
(
item
->
{
if
(
Commons
.
n
otEmpty
(
item
.
getChildren
()))
{
if
(
Commons
.
isN
otEmpty
(
item
.
getChildren
()))
{
item
.
setChildren
(
sortMenuTreeVo
(
item
.
getChildren
()));
item
.
setChildren
(
sortMenuTreeVo
(
item
.
getChildren
()));
}
}
})
})
...
...
basic-common/core/src/main/java/com/yiring/common/validation/ValidateUtil.java
浏览文件 @
75a88dae
...
@@ -34,7 +34,7 @@ public class ValidateUtil {
...
@@ -34,7 +34,7 @@ public class ValidateUtil {
@Cleanup
@Cleanup
ValidatorFactory
factory
=
Validation
.
buildDefaultValidatorFactory
();
ValidatorFactory
factory
=
Validation
.
buildDefaultValidatorFactory
();
Set
<
ConstraintViolation
<
T
>>
constraintViolations
=
factory
.
getValidator
().
validate
(
t
,
groups
);
Set
<
ConstraintViolation
<
T
>>
constraintViolations
=
factory
.
getValidator
().
validate
(
t
,
groups
);
if
(
Commons
.
n
otEmpty
(
constraintViolations
))
{
if
(
Commons
.
isN
otEmpty
(
constraintViolations
))
{
throw
new
ConstraintViolationException
(
constraintViolations
);
throw
new
ConstraintViolationException
(
constraintViolations
);
}
}
}
}
...
...
basic-common/util/src/main/java/com/yiring/common/util/Commons.java
浏览文件 @
75a88dae
/* (C) 2021 YiRing, Inc. */
/* (C) 2021 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
;
package
com
.
yiring
.
common
.
util
;
import
cn.hutool.core.collection.CollUtil
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
import
java.util.*
;
import
java.util.*
;
import
lombok.NonNull
;
import
lombok.experimental.UtilityClass
;
import
lombok.experimental.UtilityClass
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -71,7 +71,7 @@ public class Commons {
...
@@ -71,7 +71,7 @@ public class Commons {
* @param collection 集合
* @param collection 集合
* @return 是否为空
* @return 是否为空
*/
*/
public
boolean
n
otEmpty
(
Collection
<?>
collection
)
{
public
boolean
isN
otEmpty
(
Collection
<?>
collection
)
{
return
collection
!=
null
&&
!
collection
.
isEmpty
();
return
collection
!=
null
&&
!
collection
.
isEmpty
();
}
}
...
@@ -96,7 +96,7 @@ public class Commons {
...
@@ -96,7 +96,7 @@ public class Commons {
*/
*/
public
<
T
>
T
transform
(
Object
source
,
Class
<
T
>
type
,
String
...
ignoreProperties
)
{
public
<
T
>
T
transform
(
Object
source
,
Class
<
T
>
type
,
String
...
ignoreProperties
)
{
try
{
try
{
if
(
source
==
null
)
{
if
(
Objects
.
isNull
(
source
)
)
{
return
null
;
return
null
;
}
}
...
@@ -121,7 +121,7 @@ public class Commons {
...
@@ -121,7 +121,7 @@ public class Commons {
* @param <S> 原类型集合
* @param <S> 原类型集合
* @return 目标集合
* @return 目标集合
*/
*/
public
<
T
,
S
>
List
<
T
>
transform
(
@NonNull
List
<
S
>
list
,
Class
<
T
>
type
,
String
...
ignoreProperties
)
{
public
<
T
,
S
>
List
<
T
>
transform
(
List
<
S
>
list
,
Class
<
T
>
type
,
String
...
ignoreProperties
)
{
return
transform
(
list
,
type
,
null
,
ignoreProperties
);
return
transform
(
list
,
type
,
null
,
ignoreProperties
);
}
}
...
@@ -137,12 +137,12 @@ public class Commons {
...
@@ -137,12 +137,12 @@ public class Commons {
* @return 目标集合
* @return 目标集合
*/
*/
public
<
T
,
S
>
List
<
T
>
transform
(
public
<
T
,
S
>
List
<
T
>
transform
(
@NonNull
List
<
S
>
list
,
List
<
S
>
list
,
Class
<
T
>
type
,
Class
<
T
>
type
,
CallbackFunction
<
S
,
T
>
fn
,
CallbackFunction
<
S
,
T
>
fn
,
String
...
ignoreProperties
String
...
ignoreProperties
)
{
)
{
if
(
!
not
Empty
(
list
))
{
if
(
CollUtil
.
is
Empty
(
list
))
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论