nodeList = redisProperties.getSentinel().getNodes();
- nodeList.stream().map(node -> protocol + node).forEach(sentinelServersConfig::addSentinelAddress);
+ nodeList.stream()
+ .map(node -> protocol + node)
+ .forEach(sentinelServersConfig::addSentinelAddress);
}
if (StrUtil.isBlank(sentinelServersConfig.getPassword())) {
sentinelServersConfig.setPassword(redisProperties.getPassword());
@@ -107,7 +109,8 @@ public class RedissonAutoConfiguration {
singleServerConfig.setPassword(redisProperties.getPassword());
}
if (StrUtil.isBlank(singleServerConfig.getAddress())) {
- singleServerConfig.setAddress(protocol + redisProperties.getHost() + StringConstants.COLON + redisProperties.getPort());
+ singleServerConfig.setAddress(protocol + redisProperties
+ .getHost() + StringConstants.COLON + redisProperties.getPort());
}
}
}
diff --git a/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonProperties.java b/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonProperties.java
index 8c6aa3cd..efdc1067 100644
--- a/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonProperties.java
+++ b/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonProperties.java
@@ -22,7 +22,6 @@ import org.redisson.config.SentinelServersConfig;
import org.redisson.config.SingleServerConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
-
/**
* Redisson 配置属性
*
diff --git a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java
index c384d4d4..bb5e1a89 100644
--- a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java
+++ b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java
@@ -62,8 +62,7 @@ public class BehaviorCaptchaAutoConfiguration {
*/
@Configuration
@Import({BehaviorCaptchaCacheConfiguration.Redis.class, BehaviorCaptchaCacheConfiguration.Custom.class})
- protected static class BehaviorCaptchaCacheAutoConfiguration {
- }
+ protected static class BehaviorCaptchaCacheAutoConfiguration {}
/**
* 行为验证码服务接口
@@ -94,8 +93,8 @@ public class BehaviorCaptchaAutoConfiguration {
config.put(Const.CAPTCHA_FONT_SIZE, properties.getFontSize());
config.put(Const.CAPTCHA_FONT_STYLE, properties.getFontStyle());
config.put(Const.CAPTCHA_WORD_COUNT, 4);
- if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:")
- || StrUtil.startWith(properties.getPicClickBaseMapPath(), "classpath:")) {
+ if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || StrUtil.startWith(properties
+ .getPicClickBaseMapPath(), "classpath:")) {
// 自定义 resources 目录下初始化底图
config.put(Const.CAPTCHA_INIT_ORIGINAL, true);
initializeBaseMap(properties.getJigsawBaseMapPath(), properties.getPicClickBaseMapPath());
@@ -110,9 +109,8 @@ public class BehaviorCaptchaAutoConfiguration {
* @param picClick 点选验证码底图路径
*/
private static void initializeBaseMap(String jigsaw, String picClick) {
- ImageUtils.cacheBootImage(getResourcesImagesFile(jigsaw + "/original/*.png"),
- getResourcesImagesFile(jigsaw + "/slidingBlock/*.png"),
- getResourcesImagesFile(picClick + "/*.png"));
+ ImageUtils
+ .cacheBootImage(getResourcesImagesFile(jigsaw + "/original/*.png"), getResourcesImagesFile(jigsaw + "/slidingBlock/*.png"), getResourcesImagesFile(picClick + "/*.png"));
}
/**
diff --git a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java
index 2fc127c7..08bd11d1 100644
--- a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java
+++ b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java
@@ -53,7 +53,8 @@ abstract class BehaviorCaptchaCacheConfiguration {
@ConditionalOnProperty(name = PropertiesConstants.CAPTCHA_BEHAVIOR + ".cache-type", havingValue = "redis")
static class Redis {
static {
- CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name().toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
+ CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name()
+ .toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Redis' completed initialization.");
}
}
@@ -72,7 +73,8 @@ abstract class BehaviorCaptchaCacheConfiguration {
@PostConstruct
public void postConstruct() {
- CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), SpringUtil.getBean(CaptchaCacheService.class));
+ CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), SpringUtil
+ .getBean(CaptchaCacheService.class));
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Custom' completed initialization.");
}
}
diff --git a/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/enums/GraphicCaptchaType.java b/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/enums/GraphicCaptchaType.java
index 506992c7..1afffcaf 100644
--- a/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/enums/GraphicCaptchaType.java
+++ b/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/enums/GraphicCaptchaType.java
@@ -54,8 +54,7 @@ public enum GraphicCaptchaType {
/**
* 特殊类型
*/
- SPEC(SpecCaptcha.class),
- ;
+ SPEC(SpecCaptcha.class),;
/**
* 验证码实现
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java
index 39bdebe2..2a363721 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java
@@ -81,8 +81,9 @@ public class ProjectProperties {
public static final boolean IP_ADDR_LOCAL_PARSE_ENABLED;
static {
- IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil.getProperty("project.ip-addr-local-parse-enabled", boolean.class, false)
- || SpringUtil.getProperty("project.ipAddrLocalParseEnabled", boolean.class, false);
+ IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil
+ .getProperty("project.ip-addr-local-parse-enabled", boolean.class, false) || SpringUtil
+ .getProperty("project.ipAddrLocalParseEnabled", boolean.class, false);
}
/**
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/AsyncAutoConfiguration.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/AsyncAutoConfiguration.java
index cfa09ea2..6ca95689 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/AsyncAutoConfiguration.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/AsyncAutoConfiguration.java
@@ -66,8 +66,10 @@ public class AsyncAutoConfiguration implements AsyncConfigurer {
return (throwable, method, objects) -> {
throwable.printStackTrace();
StringBuilder sb = new StringBuilder();
- sb.append("Exception message: ").append(throwable.getMessage()).append(", Method name: ")
- .append(method.getName());
+ sb.append("Exception message: ")
+ .append(throwable.getMessage())
+ .append(", Method name: ")
+ .append(method.getName());
if (ArrayUtil.isNotEmpty(objects)) {
sb.append(", Parameter value: ").append(Arrays.toString(objects));
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/ThreadPoolAutoConfiguration.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/ThreadPoolAutoConfiguration.java
index 5bbcf617..ee3f47cc 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/ThreadPoolAutoConfiguration.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/threadpool/ThreadPoolAutoConfiguration.java
@@ -78,9 +78,9 @@ public class ThreadPoolAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ScheduledExecutorService scheduledExecutorService(ThreadPoolProperties properties) {
- ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ObjectUtil.defaultIfNull(properties.getCorePoolSize(), corePoolSize),
- ThreadUtil.newNamedThreadFactory("schedule-pool-%d", true),
- new ThreadPoolExecutor.CallerRunsPolicy()) {
+ ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ObjectUtil.defaultIfNull(properties
+ .getCorePoolSize(), corePoolSize), ThreadUtil
+ .newNamedThreadFactory("schedule-pool-%d", true), new ThreadPoolExecutor.CallerRunsPolicy()) {
@Override
protected void afterExecute(Runnable runnable, Throwable throwable) {
super.afterExecute(runnable, throwable);
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java
index aa5e3d6d..506d110d 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java
@@ -27,7 +27,11 @@ import org.springframework.lang.Nullable;
import java.io.IOException;
/**
- * 通用配置文件读取工厂(DefaultPropertySourceFactory 仅支持 properties 配置文件读取,详见:YAML Shortcomings)
+ * 通用配置文件读取工厂
+ *
+ * DefaultPropertySourceFactory 仅支持 properties
+ * 配置文件读取,详见:YAMLShortcomings
+ *
*
* @author Charles7c
* @since 1.0.0
@@ -35,7 +39,8 @@ import java.io.IOException;
public class GeneralPropertySourceFactory extends DefaultPropertySourceFactory {
@Override
- public PropertySource> createPropertySource(@Nullable String name, EncodedResource encodedResource) throws IOException {
+ public PropertySource> createPropertySource(@Nullable String name,
+ EncodedResource encodedResource) throws IOException {
Resource resource = encodedResource.getResource();
String resourceName = resource.getFilename();
if (StrUtil.isNotBlank(resourceName) && StrUtil.endWithAny(resourceName, ".yml", ".yaml")) {
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java
index 86eef811..f73e320b 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java
@@ -53,8 +53,8 @@ public class FileUploadUtils {
String fileName;
if (isKeepOriginalFilename) {
- fileName = String.format("%s-%s.%s", FileNameUtil.getPrefix(originalFilename),
- DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_MS_PATTERN), extensionName);
+ fileName = String.format("%s-%s.%s", FileNameUtil.getPrefix(originalFilename), DateUtil.format(LocalDateTime
+ .now(), DatePattern.PURE_DATETIME_MS_PATTERN), extensionName);
} else {
fileName = String.format("%s.%s", IdUtil.fastSimpleUUID(), extensionName);
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java
index 9187d72a..80a7ed10 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java
@@ -120,6 +120,6 @@ public class ServletUtils {
}
private static ServletRequestAttributes getServletRequestAttributes() {
- return (ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes());
+ return (ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes());
}
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java
index d30b89b6..379d4c88 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java
@@ -49,8 +49,10 @@ public class SpringUtils {
public static void deRegisterResourceHandler(Map handlerMap) {
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
// 获取已经注册的映射
- final HandlerMapping resourceHandlerMapping = applicationContext.getBean("resourceHandlerMapping", HandlerMapping.class);
- final Map oldHandlerMap = (Map) ReflectUtil.getFieldValue(resourceHandlerMapping, "handlerMap");
+ final HandlerMapping resourceHandlerMapping = applicationContext
+ .getBean("resourceHandlerMapping", HandlerMapping.class);
+ final Map oldHandlerMap = (Map)ReflectUtil
+ .getFieldValue(resourceHandlerMapping, "handlerMap");
// 移除之前注册的映射
for (Map.Entry entry : handlerMap.entrySet()) {
String pathPattern = StrUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN);
@@ -66,11 +68,14 @@ public class SpringUtils {
public static void registerResourceHandler(Map handlerMap) {
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
// 获取已经注册的映射
- final HandlerMapping resourceHandlerMapping = applicationContext.getBean("resourceHandlerMapping", HandlerMapping.class);
- final Map oldHandlerMap = (Map) ReflectUtil.getFieldValue(resourceHandlerMapping, "handlerMap");
+ final HandlerMapping resourceHandlerMapping = applicationContext
+ .getBean("resourceHandlerMapping", HandlerMapping.class);
+ final Map oldHandlerMap = (Map)ReflectUtil
+ .getFieldValue(resourceHandlerMapping, "handlerMap");
// 重新注册映射
final ServletContext servletContext = applicationContext.getBean(ServletContext.class);
- final ContentNegotiationManager contentNegotiationManager = applicationContext.getBean("mvcContentNegotiationManager", ContentNegotiationManager.class);
+ final ContentNegotiationManager contentNegotiationManager = applicationContext
+ .getBean("mvcContentNegotiationManager", ContentNegotiationManager.class);
final UrlPathHelper urlPathHelper = applicationContext.getBean("mvcUrlPathHelper", UrlPathHelper.class);
final ResourceHandlerRegistry resourceHandlerRegistry = new ResourceHandlerRegistry(applicationContext, servletContext, contentNegotiationManager, urlPathHelper);
for (Map.Entry entry : handlerMap.entrySet()) {
@@ -81,7 +86,9 @@ public class SpringUtils {
String resourceLocations = StrUtil.appendIfMissing(entry.getValue(), StringConstants.SLASH);
resourceHandlerRegistry.addResourceHandler(pathPattern).addResourceLocations("file:" + resourceLocations);
}
- final Map additionalUrlMap = ReflectUtil.invoke(resourceHandlerRegistry, "getHandlerMapping").getUrlMap();
+ final Map additionalUrlMap = ReflectUtil
+ .invoke(resourceHandlerRegistry, "getHandlerMapping")
+ .getUrlMap();
ReflectUtil.invoke(resourceHandlerMapping, "registerHandlers", additionalUrlMap);
}
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/TemplateUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/TemplateUtils.java
index 2205bc4b..607833e6 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/TemplateUtils.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/TemplateUtils.java
@@ -56,8 +56,8 @@ public class TemplateUtils {
* @return 渲染后的内容
*/
public static String render(String parentPath, String templatePath, Map, ?> bindingMap) {
- TemplateEngine engine =
- TemplateUtil.createEngine(new TemplateConfig(parentPath, TemplateConfig.ResourceMode.CLASSPATH));
+ TemplateEngine engine = TemplateUtil
+ .createEngine(new TemplateConfig(parentPath, TemplateConfig.ResourceMode.CLASSPATH));
Template template = engine.getTemplate(templatePath);
return template.render(bindingMap);
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java
index cf153047..ae900362 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java
@@ -47,8 +47,8 @@ public class CheckUtils extends Validator {
* @param fieldValue 字段值
*/
public static void throwIfNotExists(Object obj, String entityName, String fieldName, Object fieldValue) {
- String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue,
- StrUtil.replace(entityName, "DO", StringConstants.EMPTY));
+ String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue, StrUtil
+ .replace(entityName, "DO", StringConstants.EMPTY));
throwIfNull(obj, message, EXCEPTION_TYPE);
}
@@ -175,7 +175,9 @@ public class CheckUtils extends Validator {
* @param template 异常信息模板,被替换的部分用 {} 表示,如果模板为 null,返回 "null"
* @param params 参数值
*/
- public static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String template,
+ public static void throwIfNotEqualIgnoreCase(CharSequence str1,
+ CharSequence str2,
+ String template,
Object... params) {
throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE);
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java
index b1d25811..74c20ce1 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java
@@ -147,7 +147,9 @@ public class ValidationUtils extends Validator {
* @param template 异常信息模板,被替换的部分用 {} 表示,如果模板为 null,返回 "null"
* @param params 参数值
*/
- public static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String template,
+ public static void throwIfNotEqualIgnoreCase(CharSequence str1,
+ CharSequence str2,
+ String template,
Object... params) {
throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE);
}
diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java
index ee43f605..cf986f9e 100644
--- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java
+++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java
@@ -86,7 +86,8 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIfBlank(CharSequence str, String message,
+ protected static void throwIfBlank(CharSequence str,
+ String message,
Class extends RuntimeException> exceptionType) {
throwIf(StrUtil.isBlank(str), message, exceptionType);
}
@@ -98,7 +99,8 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIfNotBlank(CharSequence str, String message,
+ protected static void throwIfNotBlank(CharSequence str,
+ String message,
Class extends RuntimeException> exceptionType) {
throwIf(StrUtil.isNotBlank(str), message, exceptionType);
}
@@ -111,7 +113,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIfEqual(Object obj1, Object obj2, String message,
+ protected static void throwIfEqual(Object obj1,
+ Object obj2,
+ String message,
Class extends RuntimeException> exceptionType) {
throwIf(ObjectUtil.equal(obj1, obj2), message, exceptionType);
}
@@ -124,7 +128,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIfNotEqual(Object obj1, Object obj2, String message,
+ protected static void throwIfNotEqual(Object obj1,
+ Object obj2,
+ String message,
Class extends RuntimeException> exceptionType) {
throwIf(ObjectUtil.notEqual(obj1, obj2), message, exceptionType);
}
@@ -137,7 +143,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIfEqualIgnoreCase(CharSequence str1, CharSequence str2, String message,
+ protected static void throwIfEqualIgnoreCase(CharSequence str1,
+ CharSequence str2,
+ String message,
Class extends RuntimeException> exceptionType) {
throwIf(StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType);
}
@@ -150,7 +158,9 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIfNotEqualIgnoreCase(CharSequence str1, CharSequence str2, String message,
+ protected static void throwIfNotEqualIgnoreCase(CharSequence str1,
+ CharSequence str2,
+ String message,
Class extends RuntimeException> exceptionType) {
throwIf(!StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType);
}
@@ -176,7 +186,8 @@ public class Validator {
* @param message 错误信息
* @param exceptionType 异常类型
*/
- protected static void throwIf(BooleanSupplier conditionSupplier, String message,
+ protected static void throwIf(BooleanSupplier conditionSupplier,
+ String message,
Class extends RuntimeException> exceptionType) {
if (null != conditionSupplier && conditionSupplier.getAsBoolean()) {
log.error(message);
diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/ConditionalOnEnabledDataPermission.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/ConditionalOnEnabledDataPermission.java
index 2e22fd18..49a4bdc7 100644
--- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/ConditionalOnEnabledDataPermission.java
+++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/ConditionalOnEnabledDataPermission.java
@@ -27,7 +27,8 @@ import java.lang.annotation.*;
* @since 1.1.0
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE, ElementType.METHOD })
+@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
@ConditionalOnProperty(prefix = "mybatis-plus.extension.data-permission", name = "enabled", havingValue = "true")
-public @interface ConditionalOnEnabledDataPermission {}
\ No newline at end of file
+public @interface ConditionalOnEnabledDataPermission {
+}
\ No newline at end of file
diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MyBatisPlusExtensionProperties.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MyBatisPlusExtensionProperties.java
index b4dcbd29..4bb73b9e 100644
--- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MyBatisPlusExtensionProperties.java
+++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MyBatisPlusExtensionProperties.java
@@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.annotation.DbType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
-
/**
* MyBatis Plus 扩展配置属性
*
diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java
index dae8830e..ce92c2c3 100644
--- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java
+++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java
@@ -39,7 +39,6 @@ import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory;
import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter;
import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionHandlerImpl;
-
/**
* MyBatis Plus 自动配置
*
@@ -63,9 +62,11 @@ public class MybatisPlusAutoConfiguration {
public MybatisPlusInterceptor mybatisPlusInterceptor(MyBatisPlusExtensionProperties properties) {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 数据权限插件
- MyBatisPlusExtensionProperties.DataPermissionProperties dataPermissionProperties = properties.getDataPermission();
+ MyBatisPlusExtensionProperties.DataPermissionProperties dataPermissionProperties = properties
+ .getDataPermission();
if (null != dataPermissionProperties && dataPermissionProperties.isEnabled()) {
- interceptor.addInnerInterceptor(new DataPermissionInterceptor(SpringUtil.getBean(DataPermissionHandler.class)));
+ interceptor.addInnerInterceptor(new DataPermissionInterceptor(SpringUtil
+ .getBean(DataPermissionHandler.class)));
}
// 分页插件
MyBatisPlusExtensionProperties.PaginationProperties paginationProperties = properties.getPagination();
@@ -105,8 +106,8 @@ public class MybatisPlusAutoConfiguration {
private PaginationInnerInterceptor paginationInnerInterceptor(MyBatisPlusExtensionProperties.PaginationProperties paginationProperties) {
// 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
PaginationInnerInterceptor paginationInnerInterceptor = null != paginationProperties.getDbType()
- ? new PaginationInnerInterceptor(paginationProperties.getDbType())
- : new PaginationInnerInterceptor();
+ ? new PaginationInnerInterceptor(paginationProperties.getDbType())
+ : new PaginationInnerInterceptor();
paginationInnerInterceptor.setOverflow(paginationProperties.isOverflow());
paginationInnerInterceptor.setMaxLimit(paginationProperties.getMaxLimit());
return paginationInnerInterceptor;
diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/base/BaseMapper.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/base/BaseMapper.java
index f97ec954..854b9a69 100644
--- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/base/BaseMapper.java
+++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/base/BaseMapper.java
@@ -107,6 +107,6 @@ public interface BaseMapper extends com.baomidou.mybatisplus.core.mapper.Base
* @return 实体类 Class 对象
*/
default Class currentEntityClass() {
- return (Class) ClassUtil.getTypeArgument(this.getClass(), 0);
+ return (Class)ClassUtil.getTypeArgument(this.getClass(), 0);
}
}
diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java
index 2fd3eb19..38664efa 100644
--- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java
+++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java
@@ -59,14 +59,14 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
@Override
public Expression getSqlSegment(Expression where, String mappedStatementId) {
try {
- Class> clazz =
- Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(StringConstants.DOT)));
+ Class> clazz = Class.forName(mappedStatementId.substring(0, mappedStatementId
+ .lastIndexOf(StringConstants.DOT)));
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringConstants.DOT) + 1);
Method[] methodArr = clazz.getMethods();
for (Method method : methodArr) {
DataPermission dataPermission = method.getAnnotation(DataPermission.class);
- if (null != dataPermission
- && (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName))) {
+ if (null != dataPermission && (method.getName().equals(methodName) || (method.getName() + "_COUNT")
+ .equals(methodName))) {
if (dataPermissionFilter.isFilter()) {
return buildDataScopeFilter(dataPermission, where);
}
@@ -81,10 +81,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
/**
* 构建数据范围过滤条件
*
- * @param dataPermission
- * 数据权限
- * @param where
- * 当前查询条件
+ * @param dataPermission 数据权限
+ * @param where 当前查询条件
* @return 构建后查询条件
*/
private Expression buildDataScopeFilter(DataPermission dataPermission, Expression where) {
@@ -112,7 +110,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
equalsTo.setRightExpression(new LongValue(currentUser.getDeptId()));
Function function = new Function();
function.setName("find_in_set");
- function.setParameters(new ExpressionList(new LongValue(currentUser.getDeptId()), new Column("ancestors")));
+ function.setParameters(new ExpressionList(new LongValue(currentUser
+ .getDeptId()), new Column("ancestors")));
select.setWhere(new OrExpression(equalsTo, function));
subSelect.setSelectBody(select);
// 构建父查询
@@ -158,10 +157,8 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler {
/**
* 构建 Column
*
- * @param tableAlias
- * 表别名
- * @param columnName
- * 字段名称
+ * @param tableAlias 表别名
+ * @param columnName 字段名称
* @return 带表别名字段
*/
private Column buildColumn(String tableAlias, String columnName) {
diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryHelper.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryHelper.java
index 8a4c1a4e..f6d51d55 100644
--- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryHelper.java
+++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryHelper.java
@@ -90,8 +90,8 @@ public class QueryHelper {
// 解析查询条件
parse(queryAnnotation, field.getName(), fieldValue, queryWrapper);
} catch (BadRequestException e) {
- log.error("Build query occurred an validation error: {}. Query: {}, Field: {}.", e.getMessage(), query,
- field, e);
+ log.error("Build query occurred an validation error: {}. Query: {}, Field: {}.", e
+ .getMessage(), query, field, e);
throw e;
} catch (Exception e) {
log.error("Build query occurred an error: {}. Query: {}, Field: {}.", e.getMessage(), query, field, e);
@@ -109,7 +109,9 @@ public class QueryHelper {
* @param queryWrapper MyBatis Plus 查询条件封装对象
* @param 查询数据类型
*/
- private static void parse(Query queryAnnotation, String fieldName, Object fieldValue,
+ private static void parse(Query queryAnnotation,
+ String fieldName,
+ Object fieldValue,
QueryWrapper queryWrapper) {
// 解析多属性模糊查询
// 如果设置了多属性模糊查询,分割属性进行条件拼接
@@ -137,7 +139,7 @@ public class QueryHelper {
case GREATER_THAN_OR_EQUAL -> queryWrapper.ge(columnName, fieldValue);
case LESS_THAN_OR_EQUAL -> queryWrapper.le(columnName, fieldValue);
case BETWEEN -> {
- List