From 5eed682aa1d567908015c8ffb62ef500c9971411 Mon Sep 17 00:00:00 2001 From: minglipro Date: Sat, 20 Sep 2025 14:22:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(utils):=20=E6=B7=BB=E5=8A=A0=20MyBatis-Plu?= =?UTF-8?q?s=20=E6=9F=A5=E8=AF=A2=E5=8C=85=E8=A3=85=E5=99=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 build.gradle.kts 中替换 JNA依赖为 mybatis-plus-core,并新增BaseMapperQuery 接口,提供通用的 QueryWrapper 实例创建方法,便于MyBatis-Plus 相关操作的统一封装与复用 --- build.gradle.kts | 6 +-- gradle.properties | 4 +- .../utils/mybatisplus/QueryWrapper.kt | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 src/main/kotlin/com/mingliqiye/utils/mybatisplus/QueryWrapper.kt diff --git a/build.gradle.kts b/build.gradle.kts index ba806c4..6caf27a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils * CurrentFile build.gradle.kts - * LastUpdate 2025-09-19 09:39:33 + * LastUpdate 2025-09-20 14:16:07 * UpdateUser MingLiPro */ @@ -77,7 +77,7 @@ dependencies { compileOnly("com.google.code.gson:gson:2.13.1") compileOnly("org.mybatis:mybatis:3.5.19") compileOnly("com.alibaba.fastjson2:fastjson2:2.0.58") - compileOnly("net.java.dev.jna:jna:5.17.0") + compileOnly("com.baomidou:mybatis-plus-core:3.0.1") } @@ -213,5 +213,3 @@ tasks.processResources { ) } } - - diff --git a/gradle.properties b/gradle.properties index 62be1e0..18a795f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,13 +16,13 @@ # ProjectName mingli-utils # ModuleName mingli-utils # CurrentFile gradle.properties -# LastUpdate 2025-09-20 14:01:07 +# LastUpdate 2025-09-20 14:22:07 # UpdateUser MingLiPro # JDKVERSIONS=1.8 GROUPSID=com.mingliqiye.utils ARTIFACTID=mingli-utils -VERSIONS=4.1.6 +VERSIONS=4.1.7 signing.keyId=B22AA93B signing.password= signing.secretKeyRingFile=secret.gpg diff --git a/src/main/kotlin/com/mingliqiye/utils/mybatisplus/QueryWrapper.kt b/src/main/kotlin/com/mingliqiye/utils/mybatisplus/QueryWrapper.kt new file mode 100644 index 0000000..3c3dbf0 --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/mybatisplus/QueryWrapper.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2025 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 QueryWrapper.kt + * LastUpdate 2025-09-20 14:21:44 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.mybatisplus + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper +import com.baomidou.mybatisplus.core.mapper.BaseMapper + +/** + * BaseMapperQuery接口扩展了BaseMapper,提供了通用的查询包装器功能 + * + * @param T 实体类类型 + */ +interface BaseMapperQuery : BaseMapper { + /** + * 创建并返回一个新的QueryWrapper实例 + * + * @return QueryWrapper 返回类型化的查询包装器实例 + */ + fun queryWrapper(): QueryWrapper { + return QueryWrapper() + } +}