🎨 代码格式化

This commit is contained in:
b2baccline
2021-03-08 22:56:49 +08:00
parent 7cc815f289
commit e8e45eadd1
57 changed files with 146 additions and 144 deletions

View File

@@ -19,12 +19,12 @@ public abstract class AbstractDataPermissionHandler implements DataPermissionHan
private final List<DataScope> dataScopes;
private final static Map<String, DataPermission> DATA_PERMISSION_CACHE = new ConcurrentHashMap<>();
private static final Map<String, DataPermission> DATA_PERMISSION_CACHE = new ConcurrentHashMap<>();
/**
* 提供一个默认的空值注解,用于缓存空值占位使用
*/
private final static DataPermission EMPTY_DATA_PERMISSION = AbstractDataPermissionHandler.class
private static final DataPermission EMPTY_DATA_PERMISSION = AbstractDataPermissionHandler.class
.getAnnotation(DataPermission.class);
/**
@@ -43,7 +43,7 @@ public abstract class AbstractDataPermissionHandler implements DataPermissionHan
*/
@Override
public List<DataScope> filterDataScopes(String mappedStatementId) {
if (this.dataScopes == null || this.dataScopes.size() == 0) {
if (this.dataScopes == null || this.dataScopes.isEmpty()) {
return new ArrayList<>();
}
// 获取当前方法对应的权限注解,根据注解进行数据范围控制的过滤

View File

@@ -12,7 +12,6 @@ import org.apache.ibatis.plugin.*;
import java.sql.Connection;
import java.util.List;
import java.util.Properties;
/**
* 数据权限拦截器
@@ -46,7 +45,7 @@ public class DataPermissionInterceptor implements Interceptor {
}
List<DataScope> dataScopes = dataPermissionHandler.filterDataScopes(mappedStatementId);
if (dataScopes == null || dataScopes.size() == 0) {
if (dataScopes == null || dataScopes.isEmpty()) {
return invocation.proceed();
}
@@ -69,9 +68,4 @@ public class DataPermissionInterceptor implements Interceptor {
return target;
}
@Override
public void setProperties(Properties properties) {
}
}

View File

@@ -43,7 +43,7 @@ public class DataScopeSqlProcessor extends JsqlParserSupport {
processSelectBody(select.getSelectBody(), dataScopes);
List<WithItem> withItemsList = select.getWithItemsList();
if (withItemsList != null && withItemsList.size() != 0) {
if (withItemsList != null && !withItemsList.isEmpty()) {
withItemsList.forEach(selectBody -> processSelectBody(selectBody, dataScopes));
}
}
@@ -61,7 +61,7 @@ public class DataScopeSqlProcessor extends JsqlParserSupport {
}
else {
SetOperationList operationList = (SetOperationList) selectBody;
if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
if (operationList.getSelects() != null && !operationList.getSelects().isEmpty()) {
operationList.getSelects().forEach(item -> processSelectBody(item, dataScopes));
}
}
@@ -112,7 +112,7 @@ public class DataScopeSqlProcessor extends JsqlParserSupport {
processFromItem(fromItem, dataScopes);
}
List<Join> joins = plainSelect.getJoins();
if (joins != null && joins.size() > 0) {
if (joins != null && !joins.isEmpty()) {
joins.forEach(j -> {
processJoin(j, dataScopes);
processFromItem(j.getRightItem(), dataScopes);

View File

@@ -7,7 +7,10 @@ import java.lang.reflect.Method;
* @author Hccake 2021/1/27
* @version 1.0
*/
public class AnnotationUtil {
public final class AnnotationUtil {
private AnnotationUtil() {
}
/**
* 获取数据权限注解 优先获取方法上的注解,再获取类上的注解

View File

@@ -19,10 +19,10 @@ import java.util.*;
* @author Hccake 2020/9/28
* @version 1.0
*/
public class SqlParseTest {
class SqlParseTest {
@Test
public void test() {
void test() {
DataScope dataScope = new DataScope() {
final String columnId = "order_id";

View File

@@ -30,7 +30,7 @@ public class AccessLogFilter extends OncePerRequestFilter {
/**
* 针对需忽略的Url的规则匹配器
*/
private final static AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
private static final AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
/**
* Same contract as for {@code doFilter}, but guaranteed to be just invoked once per

View File

@@ -8,7 +8,7 @@ package com.hccake.ballcat.commom.log.constant;
public final class LogConstant {
private LogConstant() {
};
}
/**
* 跟踪ID用于一次请求或执行方法时产生的各种日志间的数据关联

View File

@@ -90,7 +90,7 @@ public interface MailSender {
boolean noTo = mailDetails.getTo() == null || mailDetails.getTo().length <= 0;
boolean noCc = mailDetails.getCc() == null || mailDetails.getCc().length <= 0;
boolean noBcc = mailDetails.getBcc() == null || mailDetails.getBcc().length <= 0;
if (noTo && noCc & noBcc) {
if (noTo && noCc && noBcc) {
throw new MailSendException("The email should have at least one recipient");
}
if (!StringUtils.hasText(mailDetails.getSubject())) {

View File

@@ -37,7 +37,7 @@ public class KeyGenerator {
String joint = SpELUtil.parseValueToString(spElContext, spELExpressions);
Assert.notNull(joint, "Key joint cannot be null!");
if (StringUtils.isEmpty(key)) {
if (!StringUtils.hasText(key)) {
return joint;
}
// 拼接后返回

View File

@@ -65,7 +65,7 @@ public class TencentSenderImpl extends BaseServiceImpl implements SmsSender<SmsS
if (StrUtil.isNotEmpty(tencent.getSign())) {
json.put("Sign", tencent.getSign());
}
if (sp.getTemplateParam().size() != 0) {
if (!sp.getTemplateParam().isEmpty()) {
json.put("TemplateParamSet", sp.getTemplateParam());
}
SendSmsRequest req = SendSmsRequest.fromJsonString(om.writeValueAsString(json), SendSmsRequest.class);

View File

@@ -20,7 +20,7 @@ import org.springframework.web.filter.CorsFilter;
@ConditionalOnProperty(name = "ballcat.swagger.enabled", havingValue = "true", matchIfMissing = true)
public class SwaggerProviderAutoConfiguration {
private final static String ALL = "*";
private static final String ALL = "*";
@Bean
@ConditionalOnMissingBean

View File

@@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap;
* @author Hccake 2021/1/4
* @version 1.0
*/
public class JsonMessageHandlerHolder {
public final class JsonMessageHandlerHolder {
private JsonMessageHandlerHolder() {
}
private static final Map<String, JsonMessageHandler> MESSAGE_HANDLER_MAP = new ConcurrentHashMap<>();

View File

@@ -13,7 +13,10 @@ import java.util.concurrent.ConcurrentHashMap;
* @author Hccake 2021/1/4
* @version 1.0
*/
public class WebSocketSessionHolder {
public final class WebSocketSessionHolder {
private WebSocketSessionHolder() {
}
private static final Map<Object, WebSocketSession> USER_SESSION_MAP = new ConcurrentHashMap<>();

View File

@@ -6,7 +6,7 @@ package com.hccake.ballcat.common.websocket.message;
*/
public abstract class AbstractJsonWebSocketMessage implements JsonWebSocketMessage {
public final static String TYPE_FIELD = "type";
public static final String TYPE_FIELD = "type";
private final String type;