mirror of
				https://github.com/continew-org/continew-starter.git
				synced 2025-10-31 22:57:19 +08:00 
			
		
		
		
	refactor(data): 调整 Query 相关类到 data-core
This commit is contained in:
		| @@ -1,47 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * <p> | ||||
|  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * <p> | ||||
|  * http://www.gnu.org/licenses/lgpl.html | ||||
|  * <p> | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.starter.data.mybatis.plus.query; | ||||
|  | ||||
| import java.lang.annotation.*; | ||||
|  | ||||
| /** | ||||
|  * 查询注解 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @author Jasmine | ||||
|  * @since 1.0.0 | ||||
|  */ | ||||
| @Target(ElementType.FIELD) | ||||
| @Retention(RetentionPolicy.RUNTIME) | ||||
| @Documented | ||||
| public @interface Query { | ||||
|  | ||||
|     /** | ||||
|      * 列名(注意:列名是数据库字段名,而不是实体类字段名。如果命名是数据库关键字的,请使用转义符包裹) | ||||
|      * | ||||
|      * <p> | ||||
|      * columns 为空时,默认取值字段名(自动转换为下划线命名);<br> | ||||
|      * columns 不为空且 columns 长度大于 1,多个列查询条件之间为或关系(OR)。 | ||||
|      * </p> | ||||
|      */ | ||||
|     String[] columns() default {}; | ||||
|  | ||||
|     /** | ||||
|      * 查询类型(等值查询、模糊查询、范围查询等) | ||||
|      */ | ||||
|     QueryType type() default QueryType.EQ; | ||||
| } | ||||
| @@ -1,38 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * <p> | ||||
|  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * <p> | ||||
|  * http://www.gnu.org/licenses/lgpl.html | ||||
|  * <p> | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.starter.data.mybatis.plus.query; | ||||
|  | ||||
| import java.lang.annotation.*; | ||||
|  | ||||
| /** | ||||
|  * 查询解析忽略注解 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 1.3.0 | ||||
|  */ | ||||
| @Target(ElementType.FIELD) | ||||
| @Retention(RetentionPolicy.RUNTIME) | ||||
| @Documented | ||||
| public @interface QueryIgnore { | ||||
|  | ||||
|     /** | ||||
|      * 获取是否忽略查询解析 | ||||
|      * | ||||
|      * @return 是否忽略查询解析 | ||||
|      */ | ||||
|     boolean value() default true; | ||||
| } | ||||
| @@ -1,96 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * <p> | ||||
|  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * <p> | ||||
|  * http://www.gnu.org/licenses/lgpl.html | ||||
|  * <p> | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.starter.data.mybatis.plus.query; | ||||
|  | ||||
| /** | ||||
|  * 查询类型枚举 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 1.0.0 | ||||
|  */ | ||||
| public enum QueryType { | ||||
|  | ||||
|     /** | ||||
|      * 等于 =,例如:WHERE age = 18 | ||||
|      */ | ||||
|     EQ, | ||||
|  | ||||
|     /** | ||||
|      * 不等于 !=,例如:WHERE age != 18 | ||||
|      */ | ||||
|     NE, | ||||
|  | ||||
|     /** | ||||
|      * 大于 >,例如:WHERE age > 18 | ||||
|      */ | ||||
|     GT, | ||||
|  | ||||
|     /** | ||||
|      * 大于等于 >= ,例如:WHERE age >= 18 | ||||
|      */ | ||||
|     GE, | ||||
|  | ||||
|     /** | ||||
|      * 小于 <,例如:WHERE age < 18 | ||||
|      */ | ||||
|     LT, | ||||
|  | ||||
|     /** | ||||
|      * 小于等于 <=,例如:WHERE age <= 18 | ||||
|      */ | ||||
|     LE, | ||||
|  | ||||
|     /** | ||||
|      * 范围查询,例如:WHERE age BETWEEN 10 AND 18 | ||||
|      */ | ||||
|     BETWEEN, | ||||
|  | ||||
|     /** | ||||
|      * LIKE '%值%',例如:WHERE nickname LIKE '%s%' | ||||
|      */ | ||||
|     LIKE, | ||||
|  | ||||
|     /** | ||||
|      * LIKE '%值',例如:WHERE nickname LIKE '%s' | ||||
|      */ | ||||
|     LIKE_LEFT, | ||||
|  | ||||
|     /** | ||||
|      * LIKE '值%',例如:WHERE nickname LIKE 's%' | ||||
|      */ | ||||
|     LIKE_RIGHT, | ||||
|  | ||||
|     /** | ||||
|      * 包含查询,例如:WHERE age IN (10, 20, 30) | ||||
|      */ | ||||
|     IN, | ||||
|  | ||||
|     /** | ||||
|      * 不包含查询,例如:WHERE age NOT IN (20, 30) | ||||
|      */ | ||||
|     NOT_IN, | ||||
|  | ||||
|     /** | ||||
|      * 空查询,例如:WHERE email IS NULL | ||||
|      */ | ||||
|     IS_NULL, | ||||
|  | ||||
|     /** | ||||
|      * 非空查询,例如:WHERE email IS NOT NULL | ||||
|      */ | ||||
|     IS_NOT_NULL,; | ||||
| } | ||||
| @@ -26,6 +26,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import top.charles7c.continew.starter.core.exception.BadRequestException; | ||||
| import top.charles7c.continew.starter.core.util.ReflectUtils; | ||||
| import top.charles7c.continew.starter.core.util.validate.ValidationUtils; | ||||
| import top.charles7c.continew.starter.data.core.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.core.annotation.QueryIgnore; | ||||
| import top.charles7c.continew.starter.data.core.enums.QueryType; | ||||
|  | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.ArrayList; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user