Skip to content

Commit 3850858

Browse files
committed
style: 调整代码风格 null == xx => xx == null(更符合大众风格)
1 parent 5f9f3e1 commit 3850858

9 files changed

Lines changed: 14 additions & 14 deletions

File tree

continew-common/src/main/java/top/continew/admin/common/config/excel/ExcelDictConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public Object convertToJavaData(ReadCellData<?> cellData,
5959
public WriteCellData<String> convertToExcelData(Object data,
6060
ExcelContentProperty contentProperty,
6161
GlobalConfiguration globalConfiguration) {
62-
if (null == data) {
62+
if (data == null) {
6363
return new WriteCellData<>(StringConstants.EMPTY);
6464
}
6565
// 获取字典项数据
@@ -83,7 +83,7 @@ public WriteCellData<String> convertToExcelData(Object data,
8383
*/
8484
private List<LabelValueResp> getDictCode(ExcelContentProperty contentProperty) {
8585
DictExcelProperty dictExcelProperty = contentProperty.getField().getAnnotation(DictExcelProperty.class);
86-
if (null == dictExcelProperty) {
86+
if (dictExcelProperty == null) {
8787
throw new IllegalArgumentException("Excel 字典转换器异常:请为字段添加 @DictExcelProperty 注解");
8888
}
8989
CommonDictItemService dictItemService = SpringUtil.getBean(CommonDictItemService.class);

continew-common/src/main/java/top/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
5656
*/
5757
@Override
5858
public void insertFill(MetaObject metaObject) {
59-
if (null == metaObject) {
59+
if (metaObject == null) {
6060
return;
6161
}
6262
Long createUser = UserContextHolder.getUserId();
@@ -79,7 +79,7 @@ public void insertFill(MetaObject metaObject) {
7979
*/
8080
@Override
8181
public void updateFill(MetaObject metaObject) {
82-
if (null == metaObject) {
82+
if (metaObject == null) {
8383
return;
8484
}
8585
Long updateUser = UserContextHolder.getUserId();

continew-common/src/main/java/top/continew/admin/common/config/websocket/WebSocketClientServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class WebSocketClientServiceImpl implements WebSocketClientService {
3636
public String getClientId(ServletServerHttpRequest request) {
3737
HttpServletRequest servletRequest = request.getServletRequest();
3838
String token = servletRequest.getParameter("token");
39-
if (null == StpUtil.getLoginIdByToken(token)) {
39+
if (StpUtil.getLoginIdByToken(token) == null) {
4040
throw new BusinessException("登录已过期,请重新登录");
4141
}
4242
return token;

continew-common/src/main/java/top/continew/admin/common/context/UserContextHolder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static void setContext(UserContext context, boolean isUpdate) {
6666
*/
6767
public static UserContext getContext() {
6868
UserContext context = CONTEXT_HOLDER.get();
69-
if (null == context) {
69+
if (context == null) {
7070
context = StpUtil.getSession().getModel(SaSession.USER, UserContext.class);
7171
CONTEXT_HOLDER.set(context);
7272
}
@@ -81,7 +81,7 @@ public static UserContext getContext() {
8181
*/
8282
public static UserContext getContext(Long userId) {
8383
SaSession session = StpUtil.getSessionByLoginId(userId, false);
84-
if (null == session) {
84+
if (session == null) {
8585
return null;
8686
}
8787
return session.getModel(SaSession.USER, UserContext.class);
@@ -103,7 +103,7 @@ public static void setExtraContext(UserExtraContext context) {
103103
*/
104104
public static UserExtraContext getExtraContext() {
105105
UserExtraContext context = EXTRA_CONTEXT_HOLDER.get();
106-
if (null == context) {
106+
if (context == null) {
107107
context = getExtraContext(StpUtil.getTokenValue());
108108
EXTRA_CONTEXT_HOLDER.set(context);
109109
}

continew-module-system/src/main/java/top/continew/admin/auth/handler/SocialLoginHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public LoginResp login(SocialLoginReq req, ClientResp client, HttpServletRequest
8989
String openId = authUser.getUuid();
9090
UserSocialDO userSocial = userSocialService.getBySourceAndOpenId(source, openId);
9191
UserDO user;
92-
if (null == userSocial) {
92+
if (userSocial == null) {
9393
String username = authUser.getUsername();
9494
String nickname = authUser.getNickname();
9595
UserDO existsUser = userService.getByUsername(username);

continew-module-system/src/main/java/top/continew/admin/auth/service/impl/OnlineUserServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public List<OnlineUserResp> list(OnlineUserQuery query) {
7373
for (Map.Entry<Long, List<String>> entry : tokenMap.entrySet()) {
7474
Long userId = entry.getKey();
7575
UserContext userContext = UserContextHolder.getContext(userId);
76-
if (null == userContext || !this.isMatchNickname(query.getNickname(), userContext) || !this
76+
if (userContext == null || !this.isMatchNickname(query.getNickname(), userContext) || !this
7777
.isMatchClientId(query.getClientId(), userContext)) {
7878
continue;
7979
}

continew-module-system/src/main/java/top/continew/admin/system/config/file/FileRecorderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public boolean save(FileInfo fileInfo) {
7575
@Override
7676
public FileInfo getByUrl(String url) {
7777
FileDO file = this.getFileByUrl(url);
78-
if (null == file) {
78+
if (file == null) {
7979
return null;
8080
}
8181
StorageDO storageDO = storageMapper.lambdaQuery().eq(StorageDO::getId, file.getStorageId()).one();
@@ -85,7 +85,7 @@ public FileInfo getByUrl(String url) {
8585
@Override
8686
public boolean delete(String url) {
8787
FileDO file = this.getFileByUrl(url);
88-
if (null == file) {
88+
if (file == null) {
8989
return false;
9090
}
9191
return fileMapper.lambdaUpdate().eq(FileDO::getId, file.getId()).remove();

continew-module-system/src/main/java/top/continew/admin/system/service/impl/UserSocialServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public UserSocialDO getBySourceAndOpenId(String source, String openId) {
5151

5252
@Override
5353
public void saveOrUpdate(UserSocialDO userSocial) {
54-
if (null == userSocial.getCreateTime()) {
54+
if (userSocial.getCreateTime() == null) {
5555
baseMapper.insert(userSocial);
5656
} else {
5757
baseMapper.lambdaUpdate()

continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/service/impl/GeneratorServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public PageResp<GenConfigDO> pageGenConfig(GenConfigQuery query, PageQuery pageQ
119119
@Override
120120
public GenConfigDO getGenConfig(String tableName) throws SQLException {
121121
GenConfigDO genConfig = genConfigMapper.selectById(tableName);
122-
if (null == genConfig) {
122+
if (genConfig == null) {
123123
genConfig = new GenConfigDO(tableName);
124124
// 默认包名(当前包名)
125125
String packageName = ClassUtil.getPackage(GeneratorService.class);

0 commit comments

Comments
 (0)