mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
style: 调整代码风格 null == xx => xx == null(更符合大众风格)
This commit is contained in:
@@ -59,7 +59,7 @@ public class ExcelDictConverter implements Converter<Object> {
|
||||
public WriteCellData<String> convertToExcelData(Object data,
|
||||
ExcelContentProperty contentProperty,
|
||||
GlobalConfiguration globalConfiguration) {
|
||||
if (null == data) {
|
||||
if (data == null) {
|
||||
return new WriteCellData<>(StringConstants.EMPTY);
|
||||
}
|
||||
// 获取字典项数据
|
||||
@@ -83,7 +83,7 @@ public class ExcelDictConverter implements Converter<Object> {
|
||||
*/
|
||||
private List<LabelValueResp> getDictCode(ExcelContentProperty contentProperty) {
|
||||
DictExcelProperty dictExcelProperty = contentProperty.getField().getAnnotation(DictExcelProperty.class);
|
||||
if (null == dictExcelProperty) {
|
||||
if (dictExcelProperty == null) {
|
||||
throw new IllegalArgumentException("Excel 字典转换器异常:请为字段添加 @DictExcelProperty 注解");
|
||||
}
|
||||
CommonDictItemService dictItemService = SpringUtil.getBean(CommonDictItemService.class);
|
||||
|
@@ -56,7 +56,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||
*/
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
if (null == metaObject) {
|
||||
if (metaObject == null) {
|
||||
return;
|
||||
}
|
||||
Long createUser = UserContextHolder.getUserId();
|
||||
@@ -79,7 +79,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||
*/
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
if (null == metaObject) {
|
||||
if (metaObject == null) {
|
||||
return;
|
||||
}
|
||||
Long updateUser = UserContextHolder.getUserId();
|
||||
|
@@ -36,7 +36,7 @@ public class WebSocketClientServiceImpl implements WebSocketClientService {
|
||||
public String getClientId(ServletServerHttpRequest request) {
|
||||
HttpServletRequest servletRequest = request.getServletRequest();
|
||||
String token = servletRequest.getParameter("token");
|
||||
if (null == StpUtil.getLoginIdByToken(token)) {
|
||||
if (StpUtil.getLoginIdByToken(token) == null) {
|
||||
throw new BusinessException("登录已过期,请重新登录");
|
||||
}
|
||||
return token;
|
||||
|
@@ -66,7 +66,7 @@ public class UserContextHolder {
|
||||
*/
|
||||
public static UserContext getContext() {
|
||||
UserContext context = CONTEXT_HOLDER.get();
|
||||
if (null == context) {
|
||||
if (context == null) {
|
||||
context = StpUtil.getSession().getModel(SaSession.USER, UserContext.class);
|
||||
CONTEXT_HOLDER.set(context);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class UserContextHolder {
|
||||
*/
|
||||
public static UserContext getContext(Long userId) {
|
||||
SaSession session = StpUtil.getSessionByLoginId(userId, false);
|
||||
if (null == session) {
|
||||
if (session == null) {
|
||||
return null;
|
||||
}
|
||||
return session.getModel(SaSession.USER, UserContext.class);
|
||||
@@ -103,7 +103,7 @@ public class UserContextHolder {
|
||||
*/
|
||||
public static UserExtraContext getExtraContext() {
|
||||
UserExtraContext context = EXTRA_CONTEXT_HOLDER.get();
|
||||
if (null == context) {
|
||||
if (context == null) {
|
||||
context = getExtraContext(StpUtil.getTokenValue());
|
||||
EXTRA_CONTEXT_HOLDER.set(context);
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ public class SocialLoginHandler extends AbstractLoginHandler<SocialLoginReq> {
|
||||
String openId = authUser.getUuid();
|
||||
UserSocialDO userSocial = userSocialService.getBySourceAndOpenId(source, openId);
|
||||
UserDO user;
|
||||
if (null == userSocial) {
|
||||
if (userSocial == null) {
|
||||
String username = authUser.getUsername();
|
||||
String nickname = authUser.getNickname();
|
||||
UserDO existsUser = userService.getByUsername(username);
|
||||
|
@@ -73,7 +73,7 @@ public class OnlineUserServiceImpl implements OnlineUserService {
|
||||
for (Map.Entry<Long, List<String>> entry : tokenMap.entrySet()) {
|
||||
Long userId = entry.getKey();
|
||||
UserContext userContext = UserContextHolder.getContext(userId);
|
||||
if (null == userContext || !this.isMatchNickname(query.getNickname(), userContext) || !this
|
||||
if (userContext == null || !this.isMatchNickname(query.getNickname(), userContext) || !this
|
||||
.isMatchClientId(query.getClientId(), userContext)) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ public class FileRecorderImpl implements FileRecorder {
|
||||
@Override
|
||||
public FileInfo getByUrl(String url) {
|
||||
FileDO file = this.getFileByUrl(url);
|
||||
if (null == file) {
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
StorageDO storageDO = storageMapper.lambdaQuery().eq(StorageDO::getId, file.getStorageId()).one();
|
||||
@@ -85,7 +85,7 @@ public class FileRecorderImpl implements FileRecorder {
|
||||
@Override
|
||||
public boolean delete(String url) {
|
||||
FileDO file = this.getFileByUrl(url);
|
||||
if (null == file) {
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
return fileMapper.lambdaUpdate().eq(FileDO::getId, file.getId()).remove();
|
||||
|
@@ -51,7 +51,7 @@ public class UserSocialServiceImpl implements UserSocialService {
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(UserSocialDO userSocial) {
|
||||
if (null == userSocial.getCreateTime()) {
|
||||
if (userSocial.getCreateTime() == null) {
|
||||
baseMapper.insert(userSocial);
|
||||
} else {
|
||||
baseMapper.lambdaUpdate()
|
||||
|
@@ -119,7 +119,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
@Override
|
||||
public GenConfigDO getGenConfig(String tableName) throws SQLException {
|
||||
GenConfigDO genConfig = genConfigMapper.selectById(tableName);
|
||||
if (null == genConfig) {
|
||||
if (genConfig == null) {
|
||||
genConfig = new GenConfigDO(tableName);
|
||||
// 默认包名(当前包名)
|
||||
String packageName = ClassUtil.getPackage(GeneratorService.class);
|
||||
|
Reference in New Issue
Block a user