From 0e5ce5597b3d86e598bbd13ed78cf9ad235fa716 Mon Sep 17 00:00:00 2001 From: minglipro Date: Mon, 26 Oct 2026 23:22:29 +0800 Subject: [PATCH] a --- build.gradle.kts | 5 +- gradle.properties | 6 +- .../mingliqiye/utils/stream/SuperStream.java | 4 +- .../com/mingliqiye/utils/http/BaseResponse.kt | 42 + .../com/mingliqiye/utils/http/PageData.kt | 65 + .../mingliqiye/utils/http/PagedResponse.kt | 216 +++ .../com/mingliqiye/utils/http/Response.kt | 137 +- .../converters/base/JsonConverterUtils.kt | 8 +- .../utils/mybatisplus/BaseMapperQuery.kt | 124 +- .../utils/mybatisplus/FastBaseMapper.kt | 208 +++ .../com/mingliqiye/utils/pool/ObjectPool.kt | 5 +- .../Jackson3AutoConfiguration.kt | 38 +- .../Jackson3JsonApiAutoConfiguration.kt | 75 +- ....kt => JacksonJsonApiAutoConfiguration.kt} | 49 +- .../JacksonJsonAutoConfiguration.kt | 75 + .../autoconfigure/Okhttp3AutoConfiguration.kt | 101 +- .../autoconfigure/builder/OkhttpBuilder.kt | 30 + .../mingliqiye/utils/stream/SuperStream.java | 1236 ----------------- ...ot.autoconfigure.AutoConfiguration.imports | 7 +- 19 files changed, 852 insertions(+), 1579 deletions(-) create mode 100644 src/main/kotlin/com/mingliqiye/utils/http/BaseResponse.kt create mode 100644 src/main/kotlin/com/mingliqiye/utils/http/PageData.kt create mode 100644 src/main/kotlin/com/mingliqiye/utils/http/PagedResponse.kt create mode 100644 src/main/kotlin/com/mingliqiye/utils/mybatisplus/FastBaseMapper.kt rename src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/{JacksonAutoConfiguration.kt => JacksonJsonApiAutoConfiguration.kt} (62%) create mode 100644 src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonAutoConfiguration.kt create mode 100644 src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/builder/OkhttpBuilder.kt delete mode 100644 src/main/kotlin/com/mingliqiye/utils/stream/SuperStream.java diff --git a/build.gradle.kts b/build.gradle.kts index ec062b1..a8ee448 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils * CurrentFile build.gradle.kts - * LastUpdate 2026-10-11 16:44:37 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ @@ -84,6 +84,7 @@ dependencies { compileOnly("net.java.dev.jna:jna:5.17.0") compileOnly("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8") compileOnly("com.baomidou:mybatis-plus-extension:3.5.15") + compileOnly("com.baomidou:mybatis-plus-jsqlparser:3.5.15") testImplementation("org.junit.jupiter:junit-jupiter:5.7.1") testRuntimeOnly("org.junit.platform:junit-platform-launcher") testImplementation("com.mingliqiye.logger:logger-log4j2:1.0.9") diff --git a/gradle.properties b/gradle.properties index 3a9da81..9eadf51 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# ProjectName mingli-utils +# ProjectName FastBaseMapper.kt # ModuleName mingli-utils # CurrentFile gradle.properties -# LastUpdate 2026-10-22 20:26:20 +# LastUpdate 2026-10-26 23:22:18 # UpdateUser MingLiPro # JDKVERSIONS=17 GROUPSID=com.mingliqiye.utils ARTIFACTID=mingli-utils -VERSIONS=5.3.4 +VERSIONS=5.3.6 diff --git a/src/main/java/com/mingliqiye/utils/stream/SuperStream.java b/src/main/java/com/mingliqiye/utils/stream/SuperStream.java index a7fda3c..413787e 100644 --- a/src/main/java/com/mingliqiye/utils/stream/SuperStream.java +++ b/src/main/java/com/mingliqiye/utils/stream/SuperStream.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile SuperStream.java - * LastUpdate 2026-10-11 17:23:57 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ diff --git a/src/main/kotlin/com/mingliqiye/utils/http/BaseResponse.kt b/src/main/kotlin/com/mingliqiye/utils/http/BaseResponse.kt new file mode 100644 index 0000000..aea9438 --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/http/BaseResponse.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2026 mingliqiye + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ProjectName FastBaseMapper.kt + * ModuleName mingli-utils.main + * CurrentFile BaseResponse.kt + * LastUpdate 2026-10-26 23:22:18 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.http + +open class BaseResponse( + open val time: String, + open var message: String, + open var data: T, + open var statusCode: Int, + + ) { + /** + * 返回响应对象的字符串表示 + * + * 重写toString方法以提供更有意义的对象表示,便于日志记录和调试。 + * 显示时间、消息、数据类型和值以及状态码。 + * + * @return 格式化的字符串表示 + */ + override fun toString(): String = + "${javaClass.simpleName}(time=${time}, message=${message}, data=${data}, statusCode=${statusCode})" +} diff --git a/src/main/kotlin/com/mingliqiye/utils/http/PageData.kt b/src/main/kotlin/com/mingliqiye/utils/http/PageData.kt new file mode 100644 index 0000000..2896847 --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/http/PageData.kt @@ -0,0 +1,65 @@ +/* + * Copyright 2026 mingliqiye + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ProjectName FastBaseMapper.kt + * ModuleName mingli-utils.main + * CurrentFile PageData.kt + * LastUpdate 2026-10-26 23:22:18 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.http + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page + +/** + * 分页数据类 + */ +data class PageData( + /** + * 当前页的数据列表 + */ + val records: Collection = emptyList(), + + /** + * 总条数(总记录数) + */ + val totalCount: Long = 0, + + /** + * 总页数 + */ + val totalPages: Long = 0, + + /** + * 每页大小 + */ + val pageSize: Long = 0, + + /** + * 当前页码(从 1 开始) + */ + val pageIndex: Long = 0, +) { + companion object { + fun of(page: Page): PageData = PageData( + records = page.records, + totalCount = page.total, + totalPages = page.pages, + pageSize = page.size, + pageIndex = page.current, + ) + } +} diff --git a/src/main/kotlin/com/mingliqiye/utils/http/PagedResponse.kt b/src/main/kotlin/com/mingliqiye/utils/http/PagedResponse.kt new file mode 100644 index 0000000..ef7a783 --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/http/PagedResponse.kt @@ -0,0 +1,216 @@ +/* + * Copyright 2026 mingliqiye + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ProjectName FastBaseMapper.kt + * ModuleName mingli-utils.main + * CurrentFile PagedResponse.kt + * LastUpdate 2026-10-26 23:22:18 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.http + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page +import com.mingliqiye.utils.time.DateTime + +data class PagedResponse( + override val time: String, // 响应时间,一旦创建不可修改 + override var message: String, // 响应消息,可通过setter修改 + override var data: PageData, // 响应数据,可通过setter修改 + override var statusCode: Int, // HTTP状态码,可通过setter修改 +) : BaseResponse>( + time, + message, + data, + statusCode +) { + companion object { + /** + * 创建一个默认的成功响应对象 + * 使用默认消息"操作成功",无数据,状态码200 + * + * @return Response 默认的成功响应对象 + */ + fun ok() = ok("操作成功") + + + /** + * 创建一个默认的错误响应对象 + * 使用默认消息"服务器错误",无数据,状态码500 + * + * @return Response 默认的成功响应对象 + */ + fun error() = error("服务器错误") + + /** + * 创建一个成功的响应对象(仅包含消息) + * + * @param message 响应消息 + * @return Response 成功的响应对象,数据为null + */ + @JvmStatic + fun ok(message: String) = PagedResponse( + time = DateTime.now().format(), message = message, data = PageData(), statusCode = 200 + ) + + /** + * 创建一个错误的响应对象 + * + * @param message 错误消息,默认为"服务器错误" + * @param statusCode HTTP状态码,默认为500 + * @return Response 错误的响应对象 + */ + fun error(message: String = "服务器错误", statusCode: Int = 500) = ok(message).withStatusCode(statusCode) + + /** + * 创建一个成功的响应对象(仅包含数据) + * 使用默认消息"操作成功" + * + * @param T 响应数据的类型 + * @param data 响应数据 + * @return Response 成功的响应对象,包含数据 + */ + @JvmStatic + fun okData(data: PageData) = PagedResponse( + time = DateTime.now().format(), message = "操作成功", data = data, statusCode = 200 + ) + + /** + * 从mybatisplus的page构建 + */ + @JvmOverloads + fun okPgae( + page: Page, + time: String = DateTime.now().format(), + message: String = "操作成功", + statusCode: Int = 200, + ): PagedResponse { + + return PagedResponse( + time = time, message = message, data = PageData.of(page), statusCode = statusCode + ) + } + + /** + * 创建一个成功的响应对象(包含数据和消息) + * + * @param T 响应数据的类型 + * @param data 响应数据 + * @param message 响应消息 + * @return Response 成功的响应对象,包含数据和消息 + */ + @JvmStatic + fun okData(data: PageData, message: String) = PagedResponse( + time = DateTime.now().format(), message = message, data = data, statusCode = 200 + ) + + /** + * 创建一个指定状态码的响应对象(仅包含状态码) + * 使用默认消息"操作成功",无数据 + * + * @param statusCode HTTP状态码 + * @return Response 指定状态码的响应对象 + */ + @JvmStatic + fun code(statusCode: Int) = PagedResponse( + time = DateTime.now().format(), message = "操作成功", data = PageData(), statusCode = statusCode + ) + + /** + * 创建一个指定状态码的响应对象(包含状态码和消息) + * 无数据 + * + * @param statusCode HTTP状态码 + * @param message 响应消息 + * @return Response 指定状态码和消息的响应对象 + */ + @JvmStatic + fun code(statusCode: Int, message: String) = PagedResponse( + time = DateTime.now().format(), message = message, data = PageData(), statusCode = statusCode + ) + } + + /** + * 默认构造函数,创建一个默认的成功响应对象 + * 使用当前时间、默认消息"操作成功"、状态码200、无数据 + */ + constructor() : this( + time = DateTime.now().format(), message = "操作成功", statusCode = 200, data = PageData() + ) + + + /** + * 设置响应数据 + * + * 该方法允许修改响应数据,并返回当前对象以支持链式调用。 + * + * @param data 新的响应数据 + * @return Response 当前响应对象(支持链式调用) + */ + fun setData(data: PageData): PagedResponse { + this.data = data + return this + } + + /** + * 创建一个新的Response对象,使用指定的时间 + * + * 该方法用于创建具有新时间的响应对象,遵循不可变对象的设计模式。 + * 如果时间相同,则返回原对象避免不必要的对象创建。 + * + * @param time 新的响应时间 + * @return Response 新的响应对象(如果时间相同则返回原对象) + */ + fun withTime(time: String): PagedResponse = + if (this.time == time) this else PagedResponse(time, message, data, statusCode) + + /** + * 创建一个新的Response对象,使用指定的数据 + * + * 该方法允许改变响应数据的类型,创建一个新的响应对象。 + * 适用于需要在保持其他字段不变的情况下更新数据类型的场景。 + * + * @param D 新的数据类型 + * @param data 新的响应数据 + * @return Response 新的响应对象,数据类型为D + */ + fun withData(data: PageData): PagedResponse = + PagedResponse(this.time, this.message, data, this.statusCode) + + /** + * 创建一个新的Response对象,使用指定的消息 + * + * 该方法用于创建具有新消息的响应对象,遵循不可变对象的设计模式。 + * 如果消息相同,则返回原对象避免不必要的对象创建。 + * + * @param message 新的响应消息 + * @return Response 新的响应对象(如果消息相同则返回原对象) + */ + fun withMessage(message: String): PagedResponse = + if (this.message == message) this else PagedResponse(time, message, data, statusCode) + + /** + * 创建一个新的Response对象,使用指定的状态码 + * + * 该方法用于创建具有新状态码的响应对象,遵循不可变对象的设计模式。 + * 如果状态码相同,则返回原对象避免不必要的对象创建。 + * + * @param statusCode 新的状态码 + * @return Response 新的响应对象(如果状态码相同则返回原对象) + */ + fun withStatusCode(statusCode: Int): PagedResponse = + if (this.statusCode == statusCode) this else PagedResponse(time, message, data, statusCode) + +} diff --git a/src/main/kotlin/com/mingliqiye/utils/http/Response.kt b/src/main/kotlin/com/mingliqiye/utils/http/Response.kt index a04ff30..2040eeb 100644 --- a/src/main/kotlin/com/mingliqiye/utils/http/Response.kt +++ b/src/main/kotlin/com/mingliqiye/utils/http/Response.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile Response.kt - * LastUpdate 2026-03-14 08:01:32 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ @@ -38,10 +38,15 @@ import com.mingliqiye.utils.time.DateTime * @property statusCode HTTP状态码 */ data class Response( - private val time: String, // 响应时间,一旦创建不可修改 - private var message: String, // 响应消息,可通过setter修改 - private var data: T?, // 响应数据,可通过setter修改 - private var statusCode: Int, // HTTP状态码,可通过setter修改 + override val time: String, // 响应时间,一旦创建不可修改 + override var message: String, // 响应消息,可通过setter修改 + override var data: T?, // 响应数据,可通过setter修改 + override var statusCode: Int, // HTTP状态码,可通过setter修改 +) : BaseResponse( + time, + message, + data, + statusCode, ) { companion object { @@ -70,10 +75,7 @@ data class Response( */ @JvmStatic fun ok(message: String) = Response( - time = DateTime.now().format(), - message = message, - data = null, - statusCode = 200 + time = DateTime.now().format(), message = message, data = null, statusCode = 200 ) /** @@ -95,10 +97,7 @@ data class Response( */ @JvmStatic fun okData(data: T) = Response( - time = DateTime.now().format(), - message = "操作成功", - data = data, - statusCode = 200 + time = DateTime.now().format(), message = "操作成功", data = data, statusCode = 200 ) /** @@ -111,10 +110,7 @@ data class Response( */ @JvmStatic fun okData(data: T, message: String) = Response( - time = DateTime.now().format(), - message = message, - data = data, - statusCode = 200 + time = DateTime.now().format(), message = message, data = data, statusCode = 200 ) /** @@ -126,10 +122,7 @@ data class Response( */ @JvmStatic fun code(statusCode: Int) = Response( - time = DateTime.now().format(), - message = "操作成功", - data = null, - statusCode = statusCode + time = DateTime.now().format(), message = "操作成功", data = null, statusCode = statusCode ) /** @@ -142,10 +135,7 @@ data class Response( */ @JvmStatic fun code(statusCode: Int, message: String) = Response( - time = DateTime.now().format(), - message = message, - data = null, - statusCode = statusCode + time = DateTime.now().format(), message = message, data = null, statusCode = statusCode ) } @@ -154,75 +144,9 @@ data class Response( * 使用当前时间、默认消息"操作成功"、状态码200、无数据 */ constructor() : this( - time = DateTime.now().format(), - message = "操作成功", - statusCode = 200, - data = null + time = DateTime.now().format(), message = "操作成功", statusCode = 200, data = null ) - /** - * 获取格式化后的时间字符串。 - * - * @return 格式化后的时间字符串 - */ - fun getTime(): String = time - - /** - * 获取响应消息 - * - * @return String 当前响应消息 - */ - fun getMessage(): String = message - - /** - * 设置响应消息 - * - * 该方法允许修改响应消息,并返回当前对象以支持链式调用。 - * - * @param message 新的响应消息 - * @return Response 当前响应对象(支持链式调用) - */ - fun setMessage(message: String): Response { - this.message = message - return this - } - - /** - * 获取响应数据 - * - * 返回的响应数据可能为null,调用前应进行空值检查。 - * - * @return T? 响应数据,可能为空 - */ - fun getData(): T? = data - - /** - * 获取非空数据对象 - * - * 该方法强制解包data属性,如果data为null则会抛出NullPointerException异常。 - * 适用于确定data不为null的场景,避免重复的空值检查。 - * - * @return T 非空的数据对象 - * @throws NullPointerException 当data属性为null时抛出此异常 - */ - @Throws(NullPointerException::class) - fun notNullData(): T { - return data ?: throw NullPointerException("at Response.notNullData() because data is null") - } - - /** - * 设置响应数据 - * - * 该方法允许修改响应数据,并返回当前对象以支持链式调用。 - * - * @param data 新的响应数据 - * @return Response 当前响应对象(支持链式调用) - */ - fun setData(data: T): Response { - this.data = data - return this - } - /** * 创建一个新的Response对象,使用指定的时间 * @@ -232,8 +156,7 @@ data class Response( * @param time 新的响应时间 * @return Response 新的响应对象(如果时间相同则返回原对象) */ - fun withTime(time: String): Response = - if (this.time == time) this else Response(time, message, data, statusCode) + fun withTime(time: String): Response = if (this.time == time) this else Response(time, message, data, statusCode) /** * 创建一个新的Response对象,使用指定的数据 @@ -245,8 +168,7 @@ data class Response( * @param data 新的响应数据 * @return Response 新的响应对象,数据类型为D */ - fun withData(data: D): Response = - Response(this.time, this.message, data, this.statusCode) + fun withData(data: D): Response = Response(this.time, this.message, data, this.statusCode) /** * 创建一个新的Response对象,使用指定的消息 @@ -272,25 +194,6 @@ data class Response( fun withStatusCode(statusCode: Int): Response = if (this.statusCode == statusCode) this else Response(time, message, data, statusCode) - /** - * 获取状态码 - * - * @return Int 当前HTTP状态码 - */ - fun getStatusCode(): Int = statusCode - - /** - * 设置状态码 - * - * 该方法允许修改状态码,并返回当前对象以支持链式调用。 - * - * @param statusCode 新的HTTP状态码 - * @return Response 当前响应对象(支持链式调用) - */ - fun setStatusCode(statusCode: Int): Response { - this.statusCode = statusCode - return this - } /** * 返回响应对象的字符串表示 @@ -301,5 +204,5 @@ data class Response( * @return 格式化的字符串表示 */ override fun toString(): String = - "Response<${data?.javaClass?.simpleName ?: "Nothing"}>(time=${getTime()}, message=${getMessage()}, data=${getData()}, statusCode=${getStatusCode()})" + "Response<${data?.javaClass?.simpleName ?: "Nothing"}>(time=${time}, message=${message}, data=${data}, statusCode=${statusCode})" } diff --git a/src/main/kotlin/com/mingliqiye/utils/json/converters/base/JsonConverterUtils.kt b/src/main/kotlin/com/mingliqiye/utils/json/converters/base/JsonConverterUtils.kt index 77aa00b..ccf0ab5 100644 --- a/src/main/kotlin/com/mingliqiye/utils/json/converters/base/JsonConverterUtils.kt +++ b/src/main/kotlin/com/mingliqiye/utils/json/converters/base/JsonConverterUtils.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile JsonConverterUtils.kt - * LastUpdate 2026-02-26 16:01:49 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ @file:JvmName("JsonConverterUtils") @@ -74,11 +74,11 @@ inline fun > com.fasterxml.jackson.databind. * @return 配置了自定义序列化器和反序列化器的 SimpleModule 对象。 */ fun JsonConverter.getJacksonModule(): com.fasterxml.jackson.databind.module.SimpleModule = - com.fasterxml.jackson.databind.module.SimpleModule("${getFromClass().name}To${getToClass().name}") + com.fasterxml.jackson.databind.module.SimpleModule("(${getFromClass().name})-(${getToClass().name})") .addSerializer(getFromClass(), JackJsonSerializer(null, this)) .addDeserializer(getFromClass(), JackJsonDeserializer(null, this)) fun JsonConverter.getJackson3Module(): tools.jackson.databind.module.SimpleModule = - tools.jackson.databind.module.SimpleModule("${getFromClass().name}To${getToClass().name}") + tools.jackson.databind.module.SimpleModule("(${getFromClass().name})-(${getToClass().name})") .addSerializer(getFromClass(), JackJson3Serializer(null, this)) .addDeserializer(getFromClass(), JackJson3Deserializer(null, this)) diff --git a/src/main/kotlin/com/mingliqiye/utils/mybatisplus/BaseMapperQuery.kt b/src/main/kotlin/com/mingliqiye/utils/mybatisplus/BaseMapperQuery.kt index f6bf80b..319bdd9 100644 --- a/src/main/kotlin/com/mingliqiye/utils/mybatisplus/BaseMapperQuery.kt +++ b/src/main/kotlin/com/mingliqiye/utils/mybatisplus/BaseMapperQuery.kt @@ -13,25 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile BaseMapperQuery.kt - * LastUpdate 2026-10-12 13:33:03 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ package com.mingliqiye.utils.mybatisplus -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper -import com.baomidou.mybatisplus.core.mapper.BaseMapper -import com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper -import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper -import com.baomidou.mybatisplus.extension.kotlin.KtUpdateChainWrapper -import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper - @Deprecated( "rename to FastBaseMapper", @@ -45,112 +35,4 @@ import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper * @since 4.6.1 * 已经重命名 [FastBaseMapper] */ -interface BaseMapperQuery : FastBaseMapper - -/** - * 扩展[BaseMapper]接口,提供便捷的查询和更新包装器创建方法 - * 包含普通包装器、`Lambda`包装器和`Kotlin`专用包装器的创建方法 - */ -interface FastBaseMapper : BaseMapper { - /** - * 创建[QueryWrapper]实例 - * @return QueryWrapper 查询包装器实例 - */ - fun queryWrapper() = QueryWrapper() - - /** - * 创建[UpdateWrapper]实例 - * @return UpdateWrapper 更新包装器实例 - */ - fun updateWrapper() = UpdateWrapper() - - /** - * 创建[LambdaQueryWrapper]实例 - * @return LambdaQueryWrapper Lambda查询包装器实例 - */ - fun lambdaQueryWrapper() = LambdaQueryWrapper() - - /** - * 创建[LambdaUpdateWrapper]实例 - * @return LambdaUpdateWrapper Lambda更新包装器实例 - */ - fun lambdaUpdateWrapper() = LambdaUpdateWrapper() - - - companion object { - - /** - * 为[BaseMapper]创建[QueryWrapper]实例 - * @param T 范型类型,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return QueryWrapper 查询包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.queryWrapper(): QueryWrapper = QueryWrapper(T::class.java) - - /** - * 为[BaseMapper]创建[UpdateWrapper]实例 - * @param T 范型类型,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return UpdateWrapper 更新包装器实例 - */ - inline fun BaseMapper.updateWrapper(): UpdateWrapper = UpdateWrapper() - - /** - * 为[BaseMapper]创建[LambdaQueryWrapper]实例 - * @param T 范型类型,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return LambdaQueryWrapper Lambda查询包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.lambdaQueryWrapper(): LambdaQueryWrapper = - LambdaQueryWrapper(T::class.java) - - /** - * 为[BaseMapper]创建[LambdaUpdateWrapper]实例 - * @param T 范型类型,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return LambdaUpdateWrapper Lambda更新包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.lambdaUpdateWrapper(): LambdaUpdateWrapper = - LambdaUpdateWrapper(T::class.java) - - - /** - * 为[BaseMapper]创建[KtQueryWrapper]实例 - * @param T 范型类型,必须继承自Any,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return KtQueryWrapper Kotlin查询包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.ktQueryWrapper(): KtQueryWrapper = KtQueryWrapper(T::class.java) - - /** - * 为[BaseMapper]创建[KtQueryChainWrapper]实例 - * @param T 范型类型,必须继承自Any,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return KtQueryChainWrapper Kotlin查询链式包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.ktQueryChainWrapper(): KtQueryChainWrapper = - KtQueryChainWrapper(T::class.java) - - /** - * 为[BaseMapper]创建[KtUpdateWrapper]实例 - * @param T 范型类型,必须继承自Any,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return KtUpdateWrapper Kotlin更新包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.ktUpdateWrapper(): KtUpdateWrapper = - KtUpdateWrapper(T::class.java) - - /** - * 为[BaseMapper]创建[KtUpdateChainWrapper]实例 - * @param T 范型类型,必须继承自Any,通过reified获取实际类型 - * @receiver BaseMapper 基础映射器实例 - * @return KtUpdateChainWrapper Kotlin更新链式包装器实例,使用T类作为参数 - */ - inline fun BaseMapper.ktUpdateChainWrapper(): KtUpdateChainWrapper = - KtUpdateChainWrapper(T::class.java) - - - } - - -} +typealias BaseMapperQuery = FastBaseMapper diff --git a/src/main/kotlin/com/mingliqiye/utils/mybatisplus/FastBaseMapper.kt b/src/main/kotlin/com/mingliqiye/utils/mybatisplus/FastBaseMapper.kt new file mode 100644 index 0000000..4a11644 --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/mybatisplus/FastBaseMapper.kt @@ -0,0 +1,208 @@ +/* + * Copyright 2026 mingliqiye + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ProjectName FastBaseMapper.kt + * ModuleName mingli-utils.main + * CurrentFile FastBaseMapper.kt + * LastUpdate 2026-10-26 23:22:18 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.mybatisplus + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper +import com.baomidou.mybatisplus.core.mapper.BaseMapper +import com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper +import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper +import com.baomidou.mybatisplus.extension.kotlin.KtUpdateChainWrapper +import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper +import com.baomidou.mybatisplus.extension.plugins.pagination.Page +import kotlin.reflect.KProperty1 + +/** + * 扩展[com.baomidou.mybatisplus.core.mapper.BaseMapper]接口,提供便捷的查询和更新包装器创建方法 + * 包含普通包装器、`Lambda`包装器和`Kotlin`专用包装器的创建方法 + */ +interface FastBaseMapper : BaseMapper { + /** + * 创建[com.baomidou.mybatisplus.core.conditions.query.QueryWrapper]实例 + * @return QueryWrapper 查询包装器实例 + */ + fun queryWrapper() = QueryWrapper() + + /** + * 创建[com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper]实例 + * @return UpdateWrapper 更新包装器实例 + */ + fun updateWrapper() = UpdateWrapper() + + /** + * 创建[com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper]实例 + * @return LambdaQueryWrapper Lambda查询包装器实例 + */ + fun lambdaQueryWrapper() = LambdaQueryWrapper() + + /** + * 创建[com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper]实例 + * @return LambdaUpdateWrapper Lambda更新包装器实例 + */ + fun lambdaUpdateWrapper() = LambdaUpdateWrapper() + + + fun FastBaseMapper.qw() = queryWrapper() + fun FastBaseMapper.uw() = updateWrapper() + fun FastBaseMapper.qcw() = lambdaQueryWrapper() + fun FastBaseMapper.ucw() = lambdaUpdateWrapper() + + + companion object { + + /** + * 为[BaseMapper]创建[QueryWrapper]实例 + * @param T 范型类型,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return QueryWrapper 查询包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.queryWrapper(): QueryWrapper = QueryWrapper(T::class.java) + + /** + * 为[BaseMapper]创建[UpdateWrapper]实例 + * @param T 范型类型,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return UpdateWrapper 更新包装器实例 + */ + inline fun BaseMapper.updateWrapper(): UpdateWrapper = UpdateWrapper() + + /** + * 为[BaseMapper]创建[LambdaQueryWrapper]实例 + * @param T 范型类型,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return LambdaQueryWrapper Lambda查询包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.lambdaQueryWrapper(): LambdaQueryWrapper = + LambdaQueryWrapper(T::class.java) + + /** + * 为[BaseMapper]创建[LambdaUpdateWrapper]实例 + * @param T 范型类型,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return LambdaUpdateWrapper Lambda更新包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.lambdaUpdateWrapper(): LambdaUpdateWrapper = + LambdaUpdateWrapper(T::class.java) + + + /** + * 为[BaseMapper]创建[com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper]实例 + * @param T 范型类型,必须继承自Any,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return KtQueryWrapper Kotlin查询包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.ktQueryWrapper(): KtQueryWrapper = KtQueryWrapper(T::class.java) + + /** + * 为[BaseMapper]创建[com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper]实例 + * @param T 范型类型,必须继承自Any,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return KtQueryChainWrapper Kotlin查询链式包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.ktQueryChainWrapper(): KtQueryChainWrapper = + KtQueryChainWrapper(T::class.java) + + /** + * 为[BaseMapper]创建[com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper]实例 + * @param T 范型类型,必须继承自Any,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return KtUpdateWrapper Kotlin更新包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.ktUpdateWrapper(): KtUpdateWrapper = + KtUpdateWrapper(T::class.java) + + /** + * 为[BaseMapper]创建[com.baomidou.mybatisplus.extension.kotlin.KtUpdateChainWrapper]实例 + * @param T 范型类型,必须继承自Any,通过reified获取实际类型 + * @receiver BaseMapper 基础映射器实例 + * @return KtUpdateChainWrapper Kotlin更新链式包装器实例,使用T类作为参数 + */ + inline fun BaseMapper.ktUpdateChainWrapper(): KtUpdateChainWrapper = + KtUpdateChainWrapper(T::class.java) + + inline fun FastBaseMapper.kqw() = ktQueryWrapper() + inline fun FastBaseMapper.kuw() = ktUpdateWrapper() + inline fun FastBaseMapper.kqcw() = ktQueryChainWrapper() + inline fun FastBaseMapper.kucw() = ktUpdateChainWrapper() + + inline fun FastBaseMapper.update(funs: (wrapper: KtUpdateWrapper) -> KtUpdateWrapper): Int = + this.update(funs(kuw())) + + + inline fun FastBaseMapper.selectList(funs: (wrapper: KtQueryWrapper) -> KtQueryWrapper): List = + this.selectList(funs(kqw())) + + inline fun FastBaseMapper.selectPage( + page: Page, + funs: (wrapper: KtQueryWrapper) -> KtQueryWrapper, + ): Page = this.selectPage(page, funs(kqw())) + + + inline fun FastBaseMapper.selectOne(funs: (wrapper: KtQueryWrapper) -> KtQueryWrapper): T? = + this.selectList(funs).let { + if (it.size != 1) null + else it[0] + } + + inline fun FastBaseMapper.selectListByColumn( + column: KProperty1, + value: R, + ): List = selectList { + it.eq(column, value) + } + + inline fun FastBaseMapper.selectListByColumn( + column: KProperty1, + value: Collection, + ): List { + if (value.isEmpty()) return emptyList() + return selectList { + it.eq(column, value) + } + } + + inline fun FastBaseMapper.selectMapByColumn( + column: KProperty1, + value: Collection, + ): LinkedHashMap { + if (value.isEmpty()) return linkedMapOf() + + val data = selectList { + it.eq(column, value) + } + + val mapdata: Map = data + .associateBy { column(it) } + + val map = LinkedHashMap(value.size) + value.forEach { key -> + map[key] = mapdata[key] + } + return map + } + } + + +} diff --git a/src/main/kotlin/com/mingliqiye/utils/pool/ObjectPool.kt b/src/main/kotlin/com/mingliqiye/utils/pool/ObjectPool.kt index 610f173..8703f2f 100644 --- a/src/main/kotlin/com/mingliqiye/utils/pool/ObjectPool.kt +++ b/src/main/kotlin/com/mingliqiye/utils/pool/ObjectPool.kt @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile ObjectPool.kt - * LastUpdate 2026-10-12 13:57:11 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ package com.mingliqiye.utils.pool -import com.mingliqiye.utils.require.Require.require import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.locks.Condition diff --git a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3AutoConfiguration.kt b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3AutoConfiguration.kt index 57ad9ce..c0e1827 100644 --- a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3AutoConfiguration.kt +++ b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3AutoConfiguration.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile Jackson3AutoConfiguration.kt - * LastUpdate 2026-10-02 16:11:12 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ @@ -38,15 +38,35 @@ open class Jackson3AutoConfiguration { private val logger = MingLiLoggerFactory.getLogger() - @Bean - @ConditionalOnMissingBean(JsonMapperBuilderCustomizer::class) - open fun myJsonMapperCustomizer(): JsonMapperBuilderCustomizer { + /** + * 注册 UUID 的 Jackson 3 序列化/反序列化模块。 + * + * 如需替换 UUID 处理逻辑,注册名为 [UUIDJsonConverterJsonMapperCustomizer] + * 的 [JsonMapperBuilderCustomizer] Bean 即可,本 Bean 将自动跳过。 + */ + @Bean("UUIDJsonConverterJsonMapperCustomizer") + @ConditionalOnMissingBean(name = ["UUIDJsonConverterJsonMapperCustomizer"]) + open fun getUUIDJsonConverterJsonMapperCustomizer(): JsonMapperBuilderCustomizer { return JsonMapperBuilderCustomizer { builder -> - builder - .addModule(UUIDJsonConverter.getJsonConverter().getJackson3Module()) - .addModule(DateTimeJsonConverter.getJsonConverter().getJackson3Module()) + builder.addModule(UUIDJsonConverter.getJsonConverter().getJackson3Module()) }.also { - logger.info("MingliUtils Jackson3 Serializers created") + logger.info("MingliUtils Jackson3 UUID Serializers created") + } + } + + /** + * 注册日期时间的 Jackson 3 序列化/反序列化模块。 + * + * 如需替换日期时间处理逻辑,注册名为 [DateTimeJsonConverterJsonMapperCustomizer] + * 的 [JsonMapperBuilderCustomizer] Bean 即可,本 Bean 将自动跳过。 + */ + @Bean("DateTimeJsonConverterJsonMapperCustomizer") + @ConditionalOnMissingBean(name = ["DateTimeJsonConverterJsonMapperCustomizer"]) + open fun getDateTimeJsonConverterJsonMapperCustomizer(): JsonMapperBuilderCustomizer { + return JsonMapperBuilderCustomizer { builder -> + builder.addModule(DateTimeJsonConverter.getJsonConverter().getJackson3Module()) + }.also { + logger.info("MingliUtils Jackson3 DateTime Serializers created") } } } diff --git a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3JsonApiAutoConfiguration.kt b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3JsonApiAutoConfiguration.kt index 3441124..a718e1a 100644 --- a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3JsonApiAutoConfiguration.kt +++ b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Jackson3JsonApiAutoConfiguration.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile Jackson3JsonApiAutoConfiguration.kt - * LastUpdate 2026-10-02 16:11:02 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ @@ -33,26 +33,75 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.context.annotation.Bean import tools.jackson.databind.json.JsonMapper +/** + * 基于 Jackson 3 的 [JsonApi] 自动配置。 + * + * 在类路径存在 Jackson 3(`tools.jackson.databind.json.JsonMapper`) + * 及 Spring Boot 的 Jackson 自动配置时生效,将容器中的 [JsonMapper] + * 包装为 [Jackson3JsonApi] 并以 [JsonApi] 类型注册为 Bean, + * 同时尝试初始化全局单例 [JSONA]。 + * + * ## 生效顺序 + * + * 本类依赖 [Jackson3AutoConfiguration] 注册的 `JsonMapper` 构建定制器, + * 通过 `@AutoConfigureAfter` 保证在其之后处理,确保 `JsonMapper` 已按 + * 自定义模块完成配置。 + * + * ## 覆盖方式 + * + * 若调用方需要自定义 [JsonApi] 实现,只需自行声明一个 [JsonApi] Bean, + * 本配置的 `@ConditionalOnMissingBean(JsonApi::class)` 将自动跳过创建。 + * + * ## 全局单例 + * + * [JSONA] 是进程级全局 JSON 访问入口。本配置在创建 Bean 后尝试读取 + * [JSONA] 当前实例;若尚未设置(读取抛 [NullPointerException]), + * 则将本次创建的 [JsonApi] 设置为其全局实现。若调用方已在更早阶段 + * 设置过 [JSONA],则保留既有实现,不覆盖。 + * + * @see Jackson3AutoConfiguration + * @see Jackson3JsonApi + */ @ConditionalOnClass(name = ["tools.jackson.databind.json.JsonMapper", "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration"]) @AutoConfigureAfter(name = ["com.mingliqiye.utils.springboot.autoconfigure.Jackson3AutoConfiguration"]) open class Jackson3JsonApiAutoConfiguration { - private val logger = MingLiLoggerFactory.getLogger() + companion object { + private val logger = MingLiLoggerFactory.getLogger() + } + + /** + * 创建并注册默认的 [JsonApi] Bean。 + * + * 使用容器中的 [JsonMapper] 构造 [Jackson3JsonApi]。读取器直接返回该 [JsonMapper]; + * 写入器被设计为抛出 [JsonException],即本实现不允许通过 [JsonApi] 替换底层 + * `JsonMapper`,底层实例由 Spring 容器统一管理。 + * + * 创建完成后会尝试初始化全局 [JSONA]: + * - 若 [JSONA] 尚未设置,则设置为本实例; + * - 若已设置,则保留既有实现。 + * + * 该 Bean 仅在容器中不存在其他 [JsonApi] 时创建。 + * + * @param jsonMapper 容器中的 Jackson 3 映射器 + * @return 基于 Jackson 3 的 JSON 访问门面 + */ @Bean @ConditionalOnMissingBean(JsonApi::class) open fun jsonApi(jsonMapper: JsonMapper): JsonApi { return Jackson3JsonApi( get = { jsonMapper }, - set = { throw JsonException("JSON API set method is not allowed.") }).also { - logger.info("JsonApi Bean Auto Configuration Success") - try { - JSONA.getJsonApi() - } catch (_: NullPointerException) { - JSONA.setJsonApi(it) - logger.info( - "JSONA Using {}", it.javaClass.name - ) + set = { throw JsonException("JSON API set method is not allowed.") }) + .also { + logger.info("JsonApi Bean Auto Configuration Success") + try { + JSONA.getJsonApi() + } catch (_: NullPointerException) { + JSONA.setJsonApi(it) + logger.info( + "JSONA Using {}", it.javaClass.name + ) + } } - } } } diff --git a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonAutoConfiguration.kt b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonApiAutoConfiguration.kt similarity index 62% rename from src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonAutoConfiguration.kt rename to src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonApiAutoConfiguration.kt index bebf746..3604c7f 100644 --- a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonAutoConfiguration.kt +++ b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonApiAutoConfiguration.kt @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main - * CurrentFile JacksonAutoConfiguration.kt - * LastUpdate 2026-10-02 16:10:53 + * CurrentFile JacksonJsonApiAutoConfiguration.kt + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ @@ -26,9 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.mingliqiye.utils.json.api.JSONA import com.mingliqiye.utils.json.api.JacksonJsonApi import com.mingliqiye.utils.json.api.base.JsonApi -import com.mingliqiye.utils.json.converters.DateTimeJsonConverter -import com.mingliqiye.utils.json.converters.UUIDJsonConverter -import com.mingliqiye.utils.json.converters.base.addJsonConverter import com.mingliqiye.utils.logger.MingLiLoggerFactory import org.slf4j.Logger import org.springframework.boot.autoconfigure.AutoConfigureAfter @@ -37,28 +34,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Primary -/* - * Copyright 2026 mingliqiye - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ProjectName mingli-utils - * ModuleName mingli-utils.main - * CurrentFile JacksonAutoConfiguration.kt - * LastUpdate 2026-02-05 10:39:54 - * UpdateUser MingLiPro - */ - /* * JacksonAutoConfiguration 是一个 Spring Boot 自动配置类,用于配置 Jackson 相关的序列化和反序列化功能。 * 该类在检测到 ObjectMapper 和 Spring Boot 的 JacksonAutoConfiguration 存在时自动生效, @@ -67,21 +42,15 @@ import org.springframework.context.annotation.Primary * @param objectMapper 用于 JSON 序列化和反序列化的 ObjectMapper 实例。 */ @ConditionalOnClass(name = ["com.fasterxml.jackson.databind.ObjectMapper", "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration"]) -@AutoConfigureAfter(name = ["org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration"]) -open class JacksonAutoConfiguration(objectMapper: ObjectMapper) { - private val log: Logger = MingLiLoggerFactory.getLogger("MingliUtils-JacksonAutoConfiguration") +@AutoConfigureAfter(name = ["com.mingliqiye.utils.springboot.autoconfigure.JacksonJsonAutoConfiguration"]) +open class JacksonJsonApiAutoConfiguration { - /* - * 初始化块:在类实例化时执行。 - * 注册自定义的 UUID 和 DateTime JSON 转换器模块到 ObjectMapper 中。 - */ - init { - objectMapper - .addJsonConverter() - .addJsonConverter() - log.info("MingliUtils Jackson Serializers created") + + companion object { + private val log: Logger = MingLiLoggerFactory.getLogger("MingliUtils-JacksonAutoConfiguration") } + /* * 创建并返回一个 JsonApi Bean 实例。 * 该方法会在没有其他 JsonApi Bean 存在时被调用,并将创建的 JacksonJsonApi 实例设置为全局默认的 JSON API。 diff --git a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonAutoConfiguration.kt b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonAutoConfiguration.kt new file mode 100644 index 0000000..e21a27d --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/JacksonJsonAutoConfiguration.kt @@ -0,0 +1,75 @@ +/* + * Copyright 2026 mingliqiye + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ProjectName FastBaseMapper.kt + * ModuleName mingli-utils.main + * CurrentFile JacksonJsonAutoConfiguration.kt + * LastUpdate 2026-10-26 23:22:18 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.springboot.autoconfigure + +import com.fasterxml.jackson.databind.ObjectMapper +import com.mingliqiye.utils.json.converters.DateTimeJsonConverter +import com.mingliqiye.utils.json.converters.UUIDJsonConverter +import com.mingliqiye.utils.json.converters.base.getJacksonModule +import com.mingliqiye.utils.logger.MingLiLoggerFactory +import org.springframework.boot.autoconfigure.AutoConfigureAfter +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer + +/** + * Jackson 2 的序列化模块自动配置(过渡兼容)。 + * + * 在类路径存在 Jackson 2(`com.fasterxml.jackson.databind.ObjectMapper`) + * 及对应 Spring Boot 自动配置时生效,向容器注册用于追加 UUID / 日期时间 + * 模块的 [Jackson2ObjectMapperBuilderCustomizer]。 + * + * ## 定位说明 + * + * Spring Boot 4 起默认 JSON 库为 Jackson 3,Jackson 2 的自动配置已被弃用, + * 仅用于迁移过渡,并计划在未来版本移除。本类只服务于仍在使用 Jackson 2 的场景, + * 新项目应优先使用 Jackson 3 的对应配置。 + * + * ## 类名注意 + * + * 条件与排序中引用的自动配置类名需与目标 Spring Boot 版本一致。 + * Spring Boot 4 中 Jackson 2 的自动配置类位于 `spring-boot-jackson2` 模块 + * (包路径形如 `org.springframework.boot.jackson2.autoconfigure.Jackson2AutoConfiguration`)。 + * 若项目中引用的类名不存在,本配置会被整体跳过而不报错,需自行核对。 + * + * ## Bean 命名 + * + * 与 Jackson 3 配置中的定制器 Bean 名称刻意区分(后缀 `2`), + * 避免两套配置同时生效时发生名称冲突。 + * + * @see Jackson2ObjectMapperBuilderCustomizer + */ +@ConditionalOnClass(name = ["com.fasterxml.jackson.databind.ObjectMapper", "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration"]) +@AutoConfigureAfter(name = ["org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration"]) +open class JacksonJsonAutoConfiguration(objectMapper: ObjectMapper) { + + companion object { + private val log = MingLiLoggerFactory.getLogger() + } + + init { + objectMapper.registerModule(DateTimeJsonConverter.getJsonConverter().getJacksonModule()) + objectMapper.registerModule(UUIDJsonConverter.getJsonConverter().getJacksonModule()) + log.info("MingliUtils JacksonModule UUID,DateTime Serializers created") + } + +} diff --git a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Okhttp3AutoConfiguration.kt b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Okhttp3AutoConfiguration.kt index 6555387..e0b936e 100644 --- a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Okhttp3AutoConfiguration.kt +++ b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/Okhttp3AutoConfiguration.kt @@ -13,18 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * ProjectName mingli-utils + * ProjectName FastBaseMapper.kt * ModuleName mingli-utils.main * CurrentFile Okhttp3AutoConfiguration.kt - * LastUpdate 2026-10-02 16:10:15 + * LastUpdate 2026-10-26 23:22:18 * UpdateUser MingLiPro */ package com.mingliqiye.utils.springboot.autoconfigure import com.mingliqiye.utils.logger.MingLiLoggerFactory +import com.mingliqiye.utils.springboot.autoconfigure.builder.OkhttpBuilder import org.slf4j.Logger -import org.springframework.beans.factory.annotation.Autowired +import org.springframework.beans.factory.ObjectProvider import org.springframework.boot.autoconfigure.AutoConfiguration import org.springframework.boot.autoconfigure.condition.ConditionalOnClass import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean @@ -32,43 +33,91 @@ import org.springframework.context.annotation.Bean import org.springframework.context.event.ContextClosedEvent import org.springframework.context.event.EventListener +/** + * OkHttp 3 的 Spring Boot 自动配置。 + * + * 在类路径存在 `okhttp3.OkHttpClient` 时生效,向容器注册一个默认的 + * [okhttp3.OkHttpClient] Bean。构建过程中会依次应用容器中所有 + * [OkhttpBuilder] 定制器(按 `@Order` / [org.springframework.core.Ordered] 排序), + * 便于调用方追加拦截器、超时、代理、连接池等配置,而无需自行创建客户端。 + * + * ## 覆盖方式 + * + * 若调用方需要完全自定义客户端,只需自行声明一个 [okhttp3.OkHttpClient] Bean, + * 本配置的 `@ConditionalOnMissingBean` 将自动跳过创建,不会产生多余实例。 + * + * 若只想在默认客户端上做增量调整,实现 [OkhttpBuilder] 并注册为 Bean 即可, + * 无需替换整个客户端。 + * + * ## 生命周期 + * + * 由本配置创建的客户端会在 Spring 上下文关闭时([ContextClosedEvent]) + * 主动清理连接池并关闭分发器线程池,避免线程与连接泄漏。 + * 调用方自行声明的客户端不会被本配置清理,其生命周期由调用方负责。 + * + * @see OkhttpBuilder + */ @AutoConfiguration @ConditionalOnClass(name = ["okhttp3.OkHttpClient"]) open class Okhttp3AutoConfiguration { - private var okHttpClient: okhttp3.OkHttpClient? = null - - val log: Logger = MingLiLoggerFactory.getLogger() - - @Autowired(required = false) - open var userDefinedBuilder: okhttp3.OkHttpClient.Builder? = null - - open fun initOkHttpClient() { - okHttpClient = if (userDefinedBuilder == null) { - okhttp3.OkHttpClient() - } else { - userDefinedBuilder!!.build() - } + companion object { + val log: Logger = MingLiLoggerFactory.getLogger() } + /** + * 由本配置创建并注册的 [okhttp3.OkHttpClient] 实例,供上下文关闭时清理使用。 + * + * 当调用方自行声明了 `OkHttpClient` Bean 时,本配置的 Bean 方法不会执行, + * 该字段保持 `null`,关闭时的清理逻辑也会相应跳过。 + */ + var okhttp: okhttp3.OkHttpClient? = null + + /** + * 创建默认的 [okhttp3.OkHttpClient] Bean。 + * + * 依次应用容器中所有 [OkhttpBuilder] 定制器后构建客户端。没有任何定制器时 + * 也能正常构建([ObjectProvider] 允许零个元素)。 + * + * 该 Bean 仅在容器中不存在其他 `OkHttpClient` 时创建;若调用方已自行声明, + * 本方法不会被调用。 + * + * @param builders 容器中的 OkHttp 构建定制器,按 `@Order` 排序后依次应用 + * @return 构建完成的 OkHttp 客户端 + */ @Bean @ConditionalOnMissingBean - open fun okHttpClient(): okhttp3.OkHttpClient { - if (okHttpClient == null) { - initOkHttpClient() + open fun okHttpClient(builders: ObjectProvider): okhttp3.OkHttpClient { + var connt = 0 + return okhttp3.OkHttpClient.Builder().let { builder -> + var b = builder + builders.orderedStream().forEach { + b = it.customize(b) + connt++ + } + b.build() + }.also { + okhttp = it + log.info("load $connt OkhttpBuilder initialized OkHttpClient successfully") } - log.info("OkHttpClient initialized (using ${if (userDefinedBuilder != null) "user-defined" else "default"} builder)") - return okHttpClient!! } - + /** + * 在 Spring 上下文关闭时清理本配置创建的 OkHttp 客户端。 + * + * 执行两步清理: + * 1. [okhttp3.ConnectionPool.evictAll] 立即关闭连接池中的空闲连接; + * 2. 关闭 [okhttp3.Dispatcher] 的线程池,中断未完成的任务。 + * + * 仅当 [okhttp] 字段非空(即客户端由本配置创建)时执行; + * 调用方自行声明的客户端不会被清理。 + */ @EventListener(ContextClosedEvent::class) open fun handleContextClosed() { - if (okHttpClient != null) { + okhttp?.let { log.info("Context closed, cleaning up OkHttpClient...") - okHttpClient?.dispatcher?.executorService?.shutdown() - okHttpClient?.connectionPool?.evictAll() - okHttpClient?.dispatcher?.executorService?.shutdownNow() + it.connectionPool.evictAll() + it.dispatcher.executorService.shutdownNow() } } } diff --git a/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/builder/OkhttpBuilder.kt b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/builder/OkhttpBuilder.kt new file mode 100644 index 0000000..c4f61cc --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/springboot/autoconfigure/builder/OkhttpBuilder.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2026 mingliqiye + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ProjectName FastBaseMapper.kt + * ModuleName mingli-utils.main + * CurrentFile OkhttpBuilder.kt + * LastUpdate 2026-10-26 23:22:18 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.springboot.autoconfigure.builder + +import okhttp3.OkHttpClient + +@FunctionalInterface +fun interface OkhttpBuilder { + fun customize(builder: OkHttpClient.Builder): OkHttpClient.Builder +} diff --git a/src/main/kotlin/com/mingliqiye/utils/stream/SuperStream.java b/src/main/kotlin/com/mingliqiye/utils/stream/SuperStream.java deleted file mode 100644 index 6939bff..0000000 --- a/src/main/kotlin/com/mingliqiye/utils/stream/SuperStream.java +++ /dev/null @@ -1,1236 +0,0 @@ -/* - * Copyright 2026 mingliqiye - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ProjectName mingli-utils - * ModuleName mingli-utils.main - * CurrentFile SuperStream.java - * LastUpdate 2026-10-20 20:05:37 - * UpdateUser MingLiPro - */ - -package com.mingliqiye.utils.stream; - -import com.mingliqiye.utils.collection.Collections; -import com.mingliqiye.utils.functions.P1Function; -import com.mingliqiye.utils.functions.P2Function; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Array; -import java.util.*; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.*; -import java.util.stream.*; - - -/** - * SuperStream是一个增强版的Stream包装器,提供了更多的便捷方法和重载方法来处理各种数据类型的流操作。 - * 它继承了Stream接口并实现了所有Stream的方法,同时添加了一些额外的便利功能。 - */ -public class SuperStream implements Stream { - - private final Stream stream; - - - /** - * 构造一个新的SuperStream实例 - * - * @param stream 被包装的基础Stream对象 - */ - private SuperStream(Stream stream) { - this.stream = stream; - } - - /** - * 创建一个包含指定整数元素的SuperStream - * - * @param args 可变参数的整数值数组 - * @return 包含指定整数的SuperStream实例 - */ - public static SuperStream of(int... args) { - return of(Collections.newArrayLists(args)); - } - - /** - * 创建一个包含指定字节元素的SuperStream - * - * @param args 可变参数的字节数组 - * @return 包含指定字节的SuperStream实例 - */ - public static SuperStream of(byte... args) { - return of(Collections.newArrayLists(args)); - } - - /** - * 创建一个包含指定短整数元素的SuperStream - * - * @param args 可变参数的短整数数组 - * @return 包含指定短整数的SuperStream实例 - */ - public static SuperStream of(short... args) { - return of(Collections.newArrayLists(args)); - } - - /** - * 创建一个包含指定字符元素的SuperStream - * - * @param args 可变参数的字符数组 - * @return 包含指定字符的SuperStream实例 - */ - public static SuperStream of(char... args) { - return of(Collections.newArrayLists(args)); - } - - /** - * 创建一个包含指定长整数元素的SuperStream - * - * @param args 可变参数的长整数数组 - * @return 包含指定长整数的SuperStream实例 - */ - public static SuperStream of(long... args) { - return of(Collections.newArrayLists(args)); - } - - /** - * 创建一个包含指定布尔元素的SuperStream - * - * @param args 可变参数的布尔数组 - * @return 包含指定布尔的SuperStream实例 - */ - public static SuperStream of(boolean... args) { - return of(Collections.newArrayLists(args)); - } - - - /** - * 创建一个包含指定浮点数元素的SuperStream - * - * @param args 可变参数的浮点数数组 - * @return 包含指定浮点数的SuperStream实例 - */ - public static SuperStream of(float... args) { - return of(Collections.newArrayLists(args)); - } - - /** - * 创建一个包含指定双精度浮点数元素的SuperStream - * - * @param args 可变参数的双精度浮点数数组 - * @return 包含指定双精度浮点数的SuperStream实例 - */ - public static SuperStream of(double... args) { - return of(Collections.newArrayLists(args)); - } - - - /** - * 将现有的Stream包装成SuperStream - * - * @param stream 需要包装的Stream对象 - * @param 流中元素的类型 - * @return 包装后的SuperStream实例 - */ - public static SuperStream of(Stream stream) { - return new SuperStream<>(stream); - } - - /** - * 创建一个包含指定数组元素的SuperStream,支持并行处理 - * - * @param ts 元素数组 - * @param parallel 是否使用并行流 - * @param 数组元素的类型 - * @return 包含指定数组元素的SuperStream实例 - */ - public static SuperStream of(T[] ts, boolean parallel) { - return of(Collections.newArrayLists(ts), parallel); - } - - /** - * 创建一个包含指定数组元素的SuperStream(默认串行) - * - * @param ts 元素数组 - * @param 数组元素的类型 - * @return 包含指定数组元素的SuperStream实例 - */ - public static SuperStream of(T[] ts) { - return of(ts, false); - } - - - /** - * 创建一个包含指定集合元素的SuperStream(默认串行) - * - * @param collection 包含元素的集合 - * @param 集合元素的类型 - * @return 包含指定集合元素的SuperStream实例 - */ - public static SuperStream of(Collection collection) { - return of(collection, false); - } - - - /** - * 创建一个包含指定Map键值对Entry的SuperStream(默认串行) - * - * @param map 源Map对象 - * @param Map的键类型 - * @param Map的值类型 - * @return 包含Map Entry的SuperStream实例 - */ - public static SuperStream> of(Map map) { - return of(map.entrySet(), false); - } - - - /** - * 创建一个包含指定Map键值对Entry的SuperStream,支持并行处理 - * - * @param map 源Map对象 - * @param parallel 是否使用并行流 - * @param Map的键类型 - * @param Map的值类型 - * @return 包含Map Entry的SuperStream实例 - */ - public static SuperStream> of(Map map, boolean parallel) { - return SuperStream.of(map.entrySet(), parallel); - } - - - /** - * 创建一个包含指定集合元素的SuperStream,支持并行处理 - * - * @param stream 包含元素的集合 - * @param parallel 是否使用并行流 - * @param 集合元素的类型 - * @return 包含指定集合元素的SuperStream实例 - */ - public static SuperStream of(Collection stream, boolean parallel) { - return parallel ? SuperStream.of(stream.parallelStream()) : SuperStream.of(stream.stream()); - } - - - /** - * 返回一个收集器,该收集器产生一个DoubleSummaryStatistics,描述输入元素的统计信息 - * - * @param mapper 用于将输入元素映射到double值的函数 - * @param 输入元素的类型 - * @return 产生DoubleSummaryStatistics的收集器 - */ - public static Collector summarizingDouble(@NotNull ToDoubleFunction mapper) { - return Collectors.summarizingDouble(mapper); - } - - - /** - * 返回一个收集器,该收集器产生一个LongSummaryStatistics,描述输入元素的统计信息 - * - * @param mapper 用于将输入元素映射到long值的函数 - * @param 输入元素的类型 - * @return 产生LongSummaryStatistics的收集器 - */ - public static Collector summarizingLong(@NotNull ToLongFunction mapper) { - return Collectors.summarizingLong(mapper); - } - - - /** - * 返回一个收集器,该收集器产生一个IntSummaryStatistics,描述输入元素的统计信息 - * - * @param mapper 用于将输入元素映射到int值的函数 - * @param 输入元素的类型 - * @return 产生IntSummaryStatistics的收集器 - */ - public static Collector summarizingInt(@NotNull ToIntFunction mapper) { - return Collectors.summarizingInt(mapper); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到ConcurrentMap中 - * - * @param keyMapper 用于产生键的映射函数 - * @param valueMapper 用于产生值的映射函数 - * @param mergeFunction 当键冲突时合并值的函数 - * @param mapSupplier 用于创建新Map的供应函数 - * @param 输入元素的类型 - * @param 键的类型 - * @param 值的类型 - * @param Map的具体类型 - * @return 产生ConcurrentMap的收集器 - */ - public static > Collector toConcurrentMap(@NotNull Function keyMapper, @NotNull Function valueMapper, @NotNull BinaryOperator mergeFunction, @NotNull Supplier mapSupplier) { - return Collectors.toConcurrentMap(keyMapper, valueMapper, mergeFunction, mapSupplier); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到ConcurrentMap中,使用BinaryOperator处理键冲突 - * - * @param keyMapper 用于产生键的映射函数 - * @param valueMapper 用于产生值的映射函数 - * @param mergeFunction 当键冲突时合并值的函数 - * @param 输入元素的类型 - * @param 键的类型 - * @param 值的类型 - * @return 产生ConcurrentMap的收集器 - */ - public static Collector> toConcurrentMap(@NotNull Function keyMapper, @NotNull Function valueMapper, @NotNull BinaryOperator mergeFunction) { - return Collectors.toConcurrentMap(keyMapper, valueMapper, mergeFunction); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到ConcurrentMap中,使用HashMap.merge处理键冲突 - * - * @param keyMapper 用于产生键的映射函数 - * @param valueMapper 用于产生值的映射函数 - * @param 输入元素的类型 - * @param 键的类型 - * @param 值的类型 - * @return 产生ConcurrentMap的收集器 - */ - public static Collector> toConcurrentMap(@NotNull Function keyMapper, @NotNull Function valueMapper) { - return Collectors.toConcurrentMap(keyMapper, valueMapper); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到Map中 - * - * @param keyMapper 用于产生键的映射函数 - * @param valueMapper 用于产生值的映射函数 - * @param mergeFunction 当键冲突时合并值的函数 - * @param mapSupplier 用于创建新Map的供应函数 - * @param 输入元素的类型 - * @param 键的类型 - * @param 值的类型 - * @param Map的具体类型 - * @return 产生Map的收集器 - */ - public static > Collector toMap(@NotNull Function keyMapper, @NotNull Function valueMapper, @NotNull BinaryOperator mergeFunction, @NotNull Supplier mapSupplier) { - return Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapSupplier); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到Map中,使用BinaryOperator处理键冲突 - * - * @param keyMapper 用于产生键的映射函数 - * @param valueMapper 用于产生值的映射函数 - * @param mergeFunction 当键冲突时合并值的函数 - * @param 输入元素的类型 - * @param 键的类型 - * @param 值的类型 - * @return 产生Map的收集器 - */ - public static Collector> toMap(@NotNull Function keyMapper, @NotNull Function valueMapper, @NotNull BinaryOperator mergeFunction) { - return Collectors.toMap(keyMapper, valueMapper, mergeFunction); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到Map中,使用HashMap.merge处理键冲突 - * - * @param keyMapper 用于产生键的映射函数 - * @param valueMapper 用于产生值的映射函数 - * @param 输入元素的类型 - * @param 键的类型 - * @param 值的类型 - * @return 产生Map的收集器 - */ - public static Collector> toMap(@NotNull Function keyMapper, @NotNull Function valueMapper) { - return Collectors.toMap(keyMapper, valueMapper); - } - - - /** - * 返回一个收集器,该收集器根据谓词将输入元素分区到Map中 - * - * @param predicate 用于确定元素分区的谓词 - * @param downstream 应用于分区结果的下游收集器 - * @param 输入元素的类型 - * @param 下游收集器的结果类型 - * @param 下游收集器的累加器类型 - * @return 产生分区Map的收集器 - */ - public static Collector> partitioningBy(@NotNull Predicate predicate, @NotNull Collector downstream) { - return Collectors.partitioningBy(predicate, downstream); - } - - - /** - * 返回一个收集器,该收集器根据谓词将输入元素分区到Map中 - * - * @param predicate 用于确定元素分区的谓词 - * @param 输入元素的类型 - * @return 产生分区Map的收集器 - */ - public static Collector>> partitioningBy(@NotNull Predicate predicate) { - return Collectors.partitioningBy(predicate); - } - - - /** - * 返回一个收集器,该收集器将输入元素按分类器分组到ConcurrentMap中 - * - * @param classifier 用于分类元素的函数 - * @param mapFactory 用于创建Map的工厂函数 - * @param downstream 应用于分组结果的下游收集器 - * @param 输入元素的类型 - * @param 分类键的类型 - * @param 下游收集器的结果类型 - * @param 下游收集器的累加器类型 - * @param Map的具体类型 - * @return 产生ConcurrentMap的收集器 - */ - public static > Collector groupingByConcurrent(@NotNull Function classifier, @NotNull Supplier mapFactory, @NotNull Collector downstream) { - return Collectors.groupingByConcurrent(classifier, mapFactory, downstream); - } - - - /** - * 返回一个收集器,该收集器将输入元素按分类器分组到ConcurrentMap中 - * - * @param classifier 用于分类元素的函数 - * @param downstream 应用于分组结果的下游收集器 - * @param 输入元素的类型 - * @param 分类键的类型 - * @param 下游收集器的累加器类型 - * @param 下游收集器的结果类型 - * @return 产生ConcurrentMap的收集器 - */ - public static Collector> groupingByConcurrent(@NotNull Function classifier, @NotNull Collector downstream) { - return Collectors.groupingByConcurrent(classifier, downstream); - } - - - /** - * 返回一个收集器,该收集器将输入元素按分类器分组到ConcurrentMap中 - * - * @param classifier 用于分类元素的函数 - * @param 输入元素的类型 - * @param 分类键的类型 - * @return 产生ConcurrentMap的收集器 - */ - public static Collector>> groupingByConcurrent(@NotNull Function classifier) { - return Collectors.groupingByConcurrent(classifier); - } - - - /** - * 返回一个收集器,该收集器将输入元素按分类器分组到Map中 - * - * @param classifier 用于分类元素的函数 - * @param mapFactory 用于创建Map的工厂函数 - * @param downstream 应用于分组结果的下游收集器 - * @param 输入元素的类型 - * @param 分类键的类型 - * @param 下游收集器的结果类型 - * @param 下游收集器的累加器类型 - * @param Map的具体类型 - * @return 产生Map的收集器 - */ - public static > Collector groupingBy(@NotNull Function classifier, @NotNull Supplier mapFactory, @NotNull Collector downstream) { - return Collectors.groupingBy(classifier, mapFactory, downstream); - } - - - /** - * 返回一个收集器,该收集器将输入元素按分类器分组到Map中 - * - * @param classifier 用于分类元素的函数 - * @param downstream 应用于分组结果的下游收集器 - * @param 输入元素的类型 - * @param 分类键的类型 - * @param 下游收集器的累加器类型 - * @param 下游收集器的结果类型 - * @return 产生Map的收集器 - */ - public static Collector> groupingBy(@NotNull Function classifier, @NotNull Collector downstream) { - return Collectors.groupingBy(classifier, downstream); - } - - - /** - * 返回一个收集器,该收集器将输入元素按分类器分组到Map中 - * - * @param classifier 用于分类元素的函数 - * @param 输入元素的类型 - * @param 分类键的类型 - * @return 产生Map的收集器 - */ - public static Collector>> groupingBy(@NotNull Function classifier) { - return Collectors.groupingBy(classifier); - } - - - /** - * 返回一个收集器,该收集器执行归约操作 - * - * @param identity 归约操作的初始值 - * @param mapper 用于将输入元素映射到中间值的函数 - * @param op 用于组合中间值的二元操作符 - * @param 输入元素的类型 - * @param 中间值和结果的类型 - * @return 执行归约操作的收集器 - */ - public static Collector reducing(U identity, @NotNull Function mapper, @NotNull BinaryOperator op) { - return Collectors.reducing(identity, mapper, op); - } - - - /** - * 返回一个收集器,该收集器执行归约操作 - * - * @param op 用于组合元素的二元操作符 - * @param 输入元素的类型 - * @return 执行归约操作的收集器 - */ - public static Collector> reducing(@NotNull BinaryOperator op) { - return Collectors.reducing(op); - } - - - /** - * 返回一个收集器,该收集器执行归约操作 - * - * @param identity 归约操作的初始值 - * @param op 用于组合元素的二元操作符 - * @param 输入元素的类型 - * @return 执行归约操作的收集器 - */ - public static Collector reducing(T identity, @NotNull BinaryOperator op) { - return Collectors.reducing(identity, op); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的平均值 - * - * @param mapper 用于将输入元素映射到double值的函数 - * @param 输入元素的类型 - * @return 计算平均值的收集器 - */ - public static Collector averagingDouble(@NotNull ToDoubleFunction mapper) { - return Collectors.averagingDouble(mapper); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的平均值 - * - * @param mapper 用于将输入元素映射到long值的函数 - * @param 输入元素的类型 - * @return 计算平均值的收集器 - */ - public static Collector averagingLong(@NotNull ToLongFunction mapper) { - return Collectors.averagingLong(mapper); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的平均值 - * - * @param mapper 用于将输入元素映射到int值的函数 - * @param 输入元素的类型 - * @return 计算平均值的收集器 - */ - public static Collector averagingInt(@NotNull ToIntFunction mapper) { - return Collectors.averagingInt(mapper); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的总和 - * - * @param mapper 用于将输入元素映射到double值的函数 - * @param 输入元素的类型 - * @return 计算总和的收集器 - */ - public static Collector summingDouble(@NotNull ToDoubleFunction mapper) { - return Collectors.summingDouble(mapper); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的总和 - * - * @param mapper 用于将输入元素映射到long值的函数 - * @param 输入元素的类型 - * @return 计算总和的收集器 - */ - public static Collector summingLong(@NotNull ToLongFunction mapper) { - return Collectors.summingLong(mapper); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的总和 - * - * @param mapper 用于将输入元素映射到int值的函数 - * @param 输入元素的类型 - * @return 计算总和的收集器 - */ - public static Collector summingInt(@NotNull ToIntFunction mapper) { - return Collectors.summingInt(mapper); - } - - - /** - * 返回一个收集器,该收集器根据比较器找到最大元素 - * - * @param comparator 用于比较元素的比较器 - * @param 输入元素的类型 - * @return 找到最大元素的收集器 - */ - public static Collector> maxBy(@NotNull Comparator comparator) { - return Collectors.maxBy(comparator); - } - - - /** - * 返回一个收集器,该收集器根据比较器找到最小元素 - * - * @param comparator 用于比较元素的比较器 - * @param 输入元素的类型 - * @return 找到最小元素的收集器 - */ - public static Collector> minBy(@NotNull Comparator comparator) { - return Collectors.minBy(comparator); - } - - - /** - * 返回一个收集器,该收集器计算输入元素的数量 - * - * @param 输入元素的类型 - * @return 计算元素数量的收集器 - */ - public static Collector counting() { - return Collectors.counting(); - } - - - /** - * 返回一个收集器,该收集器在应用下游收集器后执行finisher转换 - * - * @param downstream 下游收集器 - * @param finisher 在下游收集器完成后应用的finisher函数 - * @param 输入元素的类型 - * @param 下游收集器的累加器类型 - * @param 下游收集器的结果类型 - * @param 最终结果类型 - * @return 执行转换的收集器 - */ - public static Collector collectingAndThen(@NotNull Collector downstream, @NotNull Function finisher) { - return Collectors.collectingAndThen(downstream, finisher); - } - - - /** - * 返回一个收集器,该收集器将输入元素映射后应用下游收集器 - * - * @param mapper 用于映射输入元素的函数 - * @param downstream 应用于映射后元素的下游收集器 - * @param 输入元素的类型 - * @param 映射后元素的类型 - * @param 下游收集器的累加器类型 - * @param 下游收集器的结果类型 - * @return 执行映射和收集的收集器 - */ - public static Collector mapping(@NotNull Function mapper, @NotNull Collector downstream) { - return Collectors.mapping(mapper, downstream); - } - - - /** - * 返回一个收集器,该收集器连接输入的字符序列 - * - * @param delimiter 分隔符 - * @param prefix 前缀 - * @param suffix 后缀 - * @return 连接字符序列的收集器 - */ - public static Collector joining(@NotNull CharSequence delimiter, @NotNull CharSequence prefix, @NotNull CharSequence suffix) { - return Collectors.joining(delimiter, prefix, suffix); - } - - - /** - * 返回一个收集器,该收集器连接输入的字符序列 - * - * @param delimiter 分隔符 - * @return 连接字符序列的收集器 - */ - public static Collector joining(@NotNull CharSequence delimiter) { - return Collectors.joining(delimiter); - } - - - /** - * 返回一个收集器,该收集器连接输入的字符序列 - * - * @return 连接字符序列的收集器 - */ - public static Collector joining() { - return Collectors.joining(); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到Set中 - * - * @param 输入元素的类型 - * @return 产生Set的收集器 - */ - public static Collector> toSet() { - return Collectors.toSet(); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到List中 - * - * @param 输入元素的类型 - * @return 产生List的收集器 - */ - public static Collector> toListCollector() { - return Collectors.toList(); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到指定类型的集合中 - * - * @param collectionFactory 用于创建集合的工厂函数 - * @param 输入元素的类型 - * @param 目标集合的具体类型 - * @return 产生指定类型集合的收集器 - */ - public static > Collector toCollection(@NotNull Supplier collectionFactory) { - return Collectors.toCollection(collectionFactory); - } - - - /** - * 返回一个收集器,该收集器将输入元素累积到Map中,键由keyMapper提供,值为元素本身 - * - * @param keyMapper 用于产生键的映射函数 - * @param 输入元素的类型 - * @param 键的类型 - * @return 产生Map的收集器 - */ - public static Collector> toMap(Function keyMapper) { - return toMap(keyMapper, Function.identity()); - } - - - /** - * 返回一个收集器,该收集器将Map.Entry类型的输入元素累积到Map中 - * - * @param 输入元素的类型(必须是Map.Entry) - * @param 键的类型 - * @param 值的类型 - * @return 产生Map的收集器 - */ - public static , K, V> Collector> toMap() { - return Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue); - } - - /** - * 对流中的每个元素应用过滤条件 - * - * @param predicate 用于测试元素是否满足条件的谓词 - * @return 过滤后的SuperStream实例 - */ - public SuperStream filter(Predicate predicate) { - return SuperStream.of(stream.filter(predicate)); - } - - /** - * 使用指定的收集器对流进行收集操作 - * - * @param collector 用于收集元素的收集器 - * @param 收集结果的类型 - * @param 收集器累加器的类型 - * @return 收集操作的结果 - */ - public R collect(Collector collector) { - return stream.collect(collector); - } - - /** - * 获取流的Spliterator - * - * @return 流的Spliterator实例 - */ - @NotNull - public Spliterator spliterator() { - return stream.spliterator(); - } - - /** - * 将每个元素映射为IntStream并展平结果 - * - * @param mapper 用于将元素映射为IntStream的函数 - * @return 展平后的IntStream - */ - public IntStream flatMapToInt(Function mapper) { - return stream.flatMapToInt(mapper); - } - - /** - * 检查流是否为并行流 - * - * @return 如果流是并行的则返回true,否则返回false - */ - public boolean isParallel() { - return stream.isParallel(); - } - - /** - * 获取流的迭代器 - * - * @return 流的Iterator实例 - */ - @NotNull - public Iterator iterator() { - return stream.iterator(); - } - - /** - * 对流中的每个元素执行指定的动作 - * - * @param action 要执行的动作函数 - */ - public void forEach(P1Function action) { - stream.forEach(action::call); - } - - /** - * 对流中的每个元素执行指定的动作,并传递索引 - * - * @param action 要执行的动作函数,接收元素和索引作为参数 - */ - public void forEach(P2Function action) { - AtomicInteger i22 = new AtomicInteger(0); - stream.forEach(i -> { - action.call(i, i22.getAndAdd(1)); - }); - } - - /** - * 对流中的每个元素执行指定的动作 - * - * @param action 要执行的动作函数 - */ - public void forEach(Consumer action) { - stream.forEach(action); - } - - /** - * 将每个元素映射为Stream并展平结果 - * - * @param mapper 用于将元素映射为Stream的函数 - * @param 映射后元素的类型 - * @return 展平后的Stream实例 - */ - public Stream flatMap(Function> mapper) { - return stream.flatMap(mapper); - } - - /** - * 返回一个串行流 - * - * @return 串行的SuperStream实例 - */ - @NotNull - public SuperStream sequential() { - return SuperStream.of(stream.sequential()); - } - - /** - * 跳过指定数量的元素 - * - * @param n 要跳过的元素数量 - * @return 跳过元素后的SuperStream实例 - */ - public SuperStream skip(long n) { - return SuperStream.of(stream.skip(n)); - } - - /** - * 使用指定的收集器对流进行收集操作 - * - * @param supplier 用于创建初始累加器的供应函数 - * @param accumulator 用于将元素添加到累加器的操作 - * @param combiner 用于合并两个累加器的操作 - * @param 收集结果的类型 - * @return 收集操作的结果 - */ - public R collect(Supplier supplier, BiConsumer accumulator, BiConsumer combiner) { - return stream.collect(supplier, accumulator, combiner); - } - - /** - * 返回一个并行流 - * - * @return 并行的SuperStream实例 - */ - @NotNull - public SuperStream parallel() { - return SuperStream.of(stream.parallel()); - } - - /** - * 将每个元素映射为DoubleStream并展平结果 - * - * @param mapper 用于将元素映射为DoubleStream的函数 - * @return 展平后的DoubleStream - */ - public DoubleStream flatMapToDouble(Function mapper) { - return stream.flatMapToDouble(mapper); - } - - /** - * 将流转换为指定类型的数组 - * - * @param generator 用于创建数组的函数 - * @param 数组元素的类型 - * @return 转换后的数组 - */ - @NotNull - public A[] toArray(IntFunction generator) { - return stream.toArray(generator); - } - - /** - * 查找流中的第一个元素 - * - * @return 包含第一个元素的Optional,如果流为空则返回空Optional - */ - @NotNull - public Optional findFirst() { - return stream.findFirst(); - } - - /** - * 返回一个无序流 - * - * @return 无序的SuperStream实例 - */ - @NotNull - public SuperStream unordered() { - return SuperStream.of(stream.unordered()); - } - - /** - * 根据比较器查找流中的最小元素 - * - * @param comparator 用于比较元素的比较器 - * @return 包含最小元素的Optional,如果流为空则返回空Optional - */ - @NotNull - public Optional min(Comparator comparator) { - return stream.min(comparator); - } - - /** - * 查找流中的任意元素 - * - * @return 包含任意元素的Optional,如果流为空则返回空Optional - */ - @NotNull - public Optional findAny() { - return stream.findAny(); - } - - /** - * 注册一个关闭处理器,在流关闭时执行 - * - * @param closeHandler 关闭时要执行的Runnable - * @return 添加了关闭处理器的SuperStream实例 - */ - @NotNull - public SuperStream onClose(@NotNull Runnable closeHandler) { - return SuperStream.of(stream.onClose(closeHandler)); - } - - /** - * 将每个元素映射为LongStream并展平结果 - * - * @param mapper 用于将元素映射为LongStream的函数 - * @return 展平后的LongStream - */ - public LongStream flatMapToLong(Function mapper) { - return stream.flatMapToLong(mapper); - } - - /** - * 将流转换为指定类型的数组 - * - * @param clazz 数组元素的Class对象 - * @return 转换后的数组 - */ - @NotNull - @SuppressWarnings("unchecked") - public T[] toArray(Class clazz) { - return stream.toArray(i -> (T[]) Array.newInstance(clazz, i)); - } - - /** - * 将流转换为Object数组 - * - * @return 转换后的Object数组 - */ - @NotNull - public Object[] toArray() { - return stream.toArray(); - } - - /** - * 按顺序对流中的每个元素执行指定的动作 - * - * @param action 要执行的动作函数 - */ - public void forEachOrdered(Consumer action) { - stream.forEachOrdered(action); - } - - /** - * 关闭流并释放相关资源 - */ - public void close() { - stream.close(); - } - - /** - * 对流执行归约操作 - * - * @param accumulator 用于组合元素的二元操作符 - * @return 归约操作的结果,如果流为空则返回空Optional - */ - @NotNull - public Optional reduce(BinaryOperator accumulator) { - return stream.reduce(accumulator); - } - - /** - * 返回一个根据指定比较器排序的流 - * - * @param comparator 用于比较元素的比较器 - * @return 排序后的SuperStream实例 - */ - public SuperStream sorted(Comparator comparator) { - return SuperStream.of(stream.sorted(comparator)); - } - - /** - * 检查流中的所有元素是否都满足给定的谓词 - * - * @param predicate 用于测试元素的谓词 - * @return 如果所有元素都满足谓词或流为空则返回true,否则返回false - */ - public boolean allMatch(Predicate predicate) { - return stream.allMatch(predicate); - } - - /** - * 返回一个自然排序的流 - * - * @return 排序后的SuperStream实例 - */ - public SuperStream sorted() { - return SuperStream.of(stream.sorted()); - } - - /** - * 计算流中元素的数量 - * - * @return 流中元素的数量 - */ - public long count() { - return stream.count(); - } - - /** - * 将流中的每个元素通过映射函数转换 - * - * @param mapper 用于转换元素的映射函数 - * @param 映射后元素的类型 - * @return 转换后的SuperStream实例 - */ - public SuperStream map(Function mapper) { - return SuperStream.of(stream.map(mapper)); - } - - /** - * 对流执行归约操作 - * - * @param identity 归约操作的初始值 - * @param accumulator 用于组合元素的二元操作符 - * @return 归约操作的结果 - */ - public T reduce(T identity, BinaryOperator accumulator) { - return stream.reduce(identity, accumulator); - } - - /** - * 检查流中的所有元素都不满足给定的谓词 - * - * @param predicate 用于测试元素的谓词 - * @return 如果所有元素都不满足谓词则返回true,否则返回false - */ - public boolean noneMatch(Predicate predicate) { - return stream.noneMatch(predicate); - } - - /** - * 返回一个去重后的流 - * - * @return 去重后的SuperStream实例 - */ - public SuperStream distinct() { - return SuperStream.of(stream.distinct()); - } - - /** - * 根据比较器查找流中的最大元素 - * - * @param comparator 用于比较元素的比较器 - * @return 包含最大元素的Optional,如果流为空则返回空Optional - */ - @NotNull - public Optional max(Comparator comparator) { - return stream.max(comparator); - } - - /** - * 将流中的每个元素映射为double值 - * - * @param mapper 用于映射元素为double值的函数 - * @return 映射后的DoubleStream - */ - public DoubleStream mapToDouble(ToDoubleFunction mapper) { - return stream.mapToDouble(mapper); - } - - /** - * 限制流中元素的数量 - * - * @param maxSize 最大元素数量 - * @return 限制后的SuperStream实例 - */ - public SuperStream limit(long maxSize) { - return SuperStream.of(stream.limit(maxSize)); - } - - /** - * 将流中的每个元素映射为long值 - * - * @param mapper 用于映射元素为long值的函数 - * @return 映射后的LongStream - */ - public LongStream mapToLong(ToLongFunction mapper) { - return stream.mapToLong(mapper); - } - - /** - * 对流中的每个元素执行动作,然后返回原流 - * - * @param action 要执行的动作函数 - * @return 原始的SuperStream实例 - */ - public SuperStream peek(Consumer action) { - return SuperStream.of(stream.peek(action)); - } - - /** - * 对流执行归约操作 - * - * @param identity 归约操作的初始值 - * @param accumulator 用于组合元素的二元操作符 - * @param combiner 用于合并累加器的二元操作符 - * @param 累加器和结果的类型 - * @return 归约操作的结果 - */ - public U reduce(U identity, BiFunction accumulator, BinaryOperator combiner) { - return stream.reduce(identity, accumulator, combiner); - } - - /** - * 将流中的每个元素映射为int值 - * - * @param mapper 用于映射元素为int值的函数 - * @return 映射后的IntStream - */ - public IntStream mapToInt(ToIntFunction mapper) { - return stream.mapToInt(mapper); - } - - /** - * 检查流中是否有任何元素满足给定的谓词 - * - * @param predicate 用于测试元素的谓词 - * @return 如果有任何元素满足谓词则返回true,否则返回false - */ - public boolean anyMatch(Predicate predicate) { - return stream.anyMatch(predicate); - } - - /** - * 获取被包装的基础Stream对象 - * - * @return 基础Stream对象 - */ - public Stream getStream() { - return stream; - } - - /** - * 将流中的元素收集到Map中,使用指定的键和值映射函数 - * - * @param keyMapper 用于生成键的映射函数 - * @param valueMapper 用于生成值的映射函数 - * @param 键的类型 - * @param 值的类型 - * @return 包含映射结果的Map - */ - public Map toAMap(Function keyMapper, Function valueMapper) { - return collect(toMap(keyMapper, valueMapper)); - } - - /** - * 将流中的元素收集到Map中,使用指定的键映射函数,值为元素本身 - * - * @param keyMapper 用于生成键的映射函数 - * @param 键的类型 - * @return 包含映射结果的Map - */ - public Map toAMap(Function keyMapper) { - return collect(toMap(keyMapper)); - } - - /** - * 将流中的元素收集到List中 - * - * @return 包含流中所有元素的List - */ - public List toAList() { - return collect(toListCollector()); - } - -} diff --git a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 6414688..78a0e29 100644 --- a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -13,15 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# ProjectName mingli-utils +# ProjectName FastBaseMapper.kt # ModuleName mingli-utils.main # CurrentFile org.springframework.boot.autoconfigure.AutoConfiguration.imports -# LastUpdate 2026-02-27 17:39:55 +# LastUpdate 2026-10-26 23:22:18 # UpdateUser MingLiPro # com.mingliqiye.utils.springboot.autoconfigure.AutoConfiguration -com.mingliqiye.utils.springboot.autoconfigure.JacksonAutoConfiguration +com.mingliqiye.utils.springboot.autoconfigure.JacksonJsonAutoConfiguration +com.mingliqiye.utils.springboot.autoconfigure.JacksonJsonApiAutoConfiguration com.mingliqiye.utils.springboot.autoconfigure.Jackson3AutoConfiguration com.mingliqiye.utils.springboot.autoconfigure.Jackson3JsonApiAutoConfiguration com.mingliqiye.utils.springboot.autoconfigure.Okhttp3AutoConfiguration