!77 optimize mybatis-flex-annotation javadoc

Merge pull request !77 from 王帅/main
This commit is contained in:
Michael Yang 2023-06-19 03:45:24 +00:00 committed by Gitee
commit c5f80ef7bb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 347 additions and 204 deletions

View File

@ -1,7 +1,23 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* 类型支持 insert 监听器
* 类型支持 insert 监听器
*
* @author snow
* @since 2023/4/28
@ -9,12 +25,17 @@ package com.mybatisflex.annotation;
public abstract class AbstractInsertListener<T> implements InsertListener {
/**
* 该监听器支持的entity类型
* 该监听器支持的 entity 类型
*
* @return type
*/
public abstract Class<T> supportType();
/**
* 新增操作的前置操作
*
* @param entity 实体类
*/
public abstract void doInsert(T entity);
@Override
@ -26,4 +47,5 @@ public abstract class AbstractInsertListener<T> implements InsertListener {
doInsert(object);
}
}
}

View File

@ -1,7 +1,23 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* 类型支持 update 监听器
* 类型支持 update 监听器
*
* @author snow
* @since 2023/4/28
@ -9,11 +25,17 @@ package com.mybatisflex.annotation;
public abstract class AbstractUpdateListener<T> implements UpdateListener {
/**
* 该监听器支持的entity类型
* 该监听器支持的 entity 类型
*
* @return type
*/
public abstract Class<T> supportType();
/**
* 更新操作的前置操作
*
* @param entity 实体类
*/
public abstract void doUpdate(T entity);
@Override
@ -25,4 +47,5 @@ public abstract class AbstractUpdateListener<T> implements UpdateListener {
doUpdate(object);
}
}
}

View File

@ -1,17 +1,17 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
@ -22,7 +22,7 @@ import org.apache.ibatis.type.UnknownTypeHandler;
import java.lang.annotation.*;
/**
* 数据库表中的列信息注解
* 数据库表中的列信息注解
*
* @author 开源海哥
*/
@ -32,54 +32,57 @@ import java.lang.annotation.*;
public @interface Column {
/**
* 字段名称
* 字段名称
*/
String value() default "";
/**
* 是否忽略该字段可能只是业务字段而非数据库对应字段
* 是否忽略该字段可能只是业务字段而非数据库对应字段
*/
boolean ignore() default false;
/**
* insert 的时候默认值这个值会直接被拼接到 sql 而不通过参数设置
* insert 的时候默认值这个值会直接被拼接到 sql 而不通过参数设置
*/
String onInsertValue() default "";
/**
* update 的时候自动赋值这个值会直接被拼接到 sql 而不通过参数设置
* update 的时候自动赋值这个值会直接被拼接到 sql 而不通过参数设置
*/
String onUpdateValue() default "";
/**
* 是否是大字段大字段 APT 不会生成到 DEFAULT_COLUMNS
* 是否是大字段大字段 APT 不会生成到 DEFAULT_COLUMNS
*/
boolean isLarge() default false;
/**
* 是否是逻辑删除字段一张表中只能存在 1 一个逻辑删除字段
* 逻辑删除的字段被删除时会设置为 1正常状态为 0可以通过 FlexGlobalConfig 配置来修改 1 0 为其他值
* <p>是否是逻辑删除字段一张表中只能存在 1 一个逻辑删除字段
*
* <p>逻辑删除的字段被删除时会设置为 1正常状态为 0可以通过 FlexGlobalConfig 配置来修改 1 0 为其他值
*/
boolean isLogicDelete() default false;
/**
* 是否为乐观锁字段若是乐观锁字段的话数据更新的时候会去检测当前版本号若更新成功的话会设置当前版本号 +1
* 只能用于数值的字段
* <p>是否为乐观锁字段
*
* <p>若是乐观锁字段的话数据更新的时候会去检测当前版本号若更新成功的话会设置当前版本号 +1
* 只能用于数值的字段
*/
boolean version() default false;
/**
* 是否是租户 ID
* 是否是租户 ID
*/
boolean tenantId() default false;
/**
* 配置的 jdbcType
* 配置的 jdbcType
*/
JdbcType jdbcType() default JdbcType.UNDEFINED;
/**
* 自定义 TypeHandler
* 自定义 TypeHandler
*/
Class<? extends TypeHandler> typeHandler() default UnknownTypeHandler.class;

View File

@ -1,31 +1,33 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
import java.lang.annotation.*;
/**
* 数据脱敏注解
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface ColumnMask {
/**
* 脱敏方式
* 脱敏方式
*/
String value();
}

View File

@ -1,25 +1,27 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
import java.lang.annotation.*;
/**
* 枚举属性注解
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface EnumValue {
}

View File

@ -1,50 +1,53 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
import java.lang.annotation.*;
/**
* 数据库表中的列信息注解
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Id {
/**
* ID 生成策略默认为 none
* ID 生成策略默认为 {@link KeyType#None}
*
* @return 生成策略
*/
KeyType keyType() default KeyType.None;
/**
* keyType 类型是 sequence value 则代表的是
* sequence 序列的 sql 内容
* <p> keyType 类型是 sequence value 则代表的是
* sequence 序列的 sql 内容
* 例如select SEQ_USER_ID.nextval as id from dual
*
* keyType Generatorvalue 则代表的是使用的那个 keyGenerator 的名称
*
* <p> keyType Generatorvalue 则代表的是使用的那个 keyGenerator 的名称
*/
String value() default "";
/**
* sequence 序列执行顺序
* 是在 entity 数据插入之前执行还是之后执行之后执行的一般是数据主动生成的 id
* <p>sequence 序列执行顺序
*
* <p>是在 entity 数据插入之前执行还是之后执行之后执行的一般是数据主动生成的 id
*
* @return 执行之前还是之后
*/
boolean before() default true;
}

View File

@ -1,20 +1,33 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
public interface InsertListener extends Listener{
/**
* 用于监听实体类数据被新增到数据库可以在实体类被新增时做一些前置操作
*
* @see AbstractInsertListener
*/
@FunctionalInterface
public interface InsertListener extends Listener {
/**
* 新增操作的前置操作
*
* @param entity 实体类
*/
void onInsert(Object entity);
}

View File

@ -1,43 +1,45 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* ID 生成策略
* ID 生成策略
*/
public enum KeyType {
/**
* 自增的方式
* 自增的方式
*/
Auto,
/**
* 通过执行数据库 sql 生成
* 例如select SEQ_USER_ID.nextval as id from dual
* <p>通过执行数据库 sql 生成
*
* <p>例如select SEQ_USER_ID.nextval as id from dual
*/
Sequence,
/**
* 通过 IKeyGenerator 生成器生成
* 通过 IKeyGenerator 生成器生成
*/
Generator,
/**
* 其他方式比如在代码层用户手动设置
* 其他方式比如在代码层用户手动设置
*/
None,
}

View File

@ -1,7 +1,23 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* 监听器
* 监听器接口
*
* @author snow
* @since 2023/4/28
@ -9,8 +25,9 @@ package com.mybatisflex.annotation;
public interface Listener extends Comparable<Listener> {
/**
* 多个监听器时的执行顺序
* <p>值越小越早触发执行</p>
* <p>多个监听器时的执行顺序
*
* <p>值越小越早触发执行
*
* @return order
*/
@ -22,4 +39,5 @@ public interface Listener extends Comparable<Listener> {
default int compareTo(Listener other) {
return order() - other.order();
}
}

View File

@ -1,33 +1,38 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* 空监听器
*/
public final class NoneListener implements InsertListener, UpdateListener, SetListener {
@Override
public void onInsert(Object entity) {
// do nothing here.
}
@Override
public void onUpdate(Object entity) {
// do nothing here.
}
@Override
public Object onSet(Object entity, String property, Object value) {
return value;
}
}

View File

@ -1,21 +1,33 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* 查询实体类数据时对实体类的属性设置的监听
*/
public interface SetListener extends Listener {
/**
* 实体类属性设置
*
* @param entity 实体类
* @param property 属性名
* @param value 属性值
* @return 实体类
*/
Object onSet(Object entity, String property, Object value);
}

View File

@ -1,17 +1,17 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
@ -20,47 +20,51 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 数据库表信息注解
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface Table {
/**
* 显式指定表名称
* 显式指定表名称
*/
String value();
/**
* 数据库的 schema模式
* 数据库的 schema模式
*/
String schema() default "";
/**
* 默认为 驼峰属性 转换为 下划线字段
* 默认为 驼峰属性 转换为 下划线字段
*/
boolean camelToUnderline() default true;
/**
* 默认使用哪个数据源若系统找不到该指定的数据源时默认使用第一个数据源
* 默认使用哪个数据源若系统找不到该指定的数据源时默认使用第一个数据源
*/
String dataSource() default "";
/**
* 监听 entity insert 行为
* 监听 entity insert 行为
*/
Class<? extends InsertListener>[] onInsert() default {};
/**
* 监听 entity update 行为
* 监听 entity update 行为
*/
Class<? extends UpdateListener>[] onUpdate() default {};
/**
* 监听 entity 的查询数据的 set 行为用户主动 set 不会触发
* 监听 entity 的查询数据的 set 行为用户主动 set 不会触发
*/
Class<? extends SetListener>[] onSet() default {};
/**
* 在某些场景下我们需要手动编写 Mapper可以通过这个注解来关闭 APT Mapper 生成
* 在某些场景下我们需要手动编写 Mapper可以通过这个注解来关闭 APT Mapper 生成
*/
boolean mapperGenerateEnable() default true;
}

View File

@ -1,22 +1,34 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
/**
* 用于监听实体类数据被更新到数据库可以在数据被更新的时候设置一些默认数据
*
* @see AbstractUpdateListener
*/
@FunctionalInterface
public interface UpdateListener extends Listener {
/**
* 更新操作的前置操作
*
* @param entity 实体类
*/
void onUpdate(Object entity);
}

View File

@ -1,31 +1,33 @@
/**
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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 com.mybatisflex.annotation;
import java.lang.annotation.*;
/**
* 多数据源切换注解
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface UseDataSource {
/**
* 使用哪个数据源配置的是 Mybatis environmentId
* 使用哪个数据源配置的是 Mybatis environmentId 属性
*/
String value();
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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.
*/
/**
* MyBatis-Flex 相关注解
*/
package com.mybatisflex.annotation;