mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
rename: 重命名 TableRef 类。
This commit is contained in:
parent
cd6c27bb2f
commit
8b7c08ce14
@ -29,14 +29,14 @@ import java.lang.annotation.Target;
|
|||||||
*/
|
*/
|
||||||
@Target({ElementType.TYPE})
|
@Target({ElementType.TYPE})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface ViewObject {
|
public @interface TableRef {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对应的 <b>实体类</b> 引用。
|
* 对应的 <b>实体类</b> 引用。
|
||||||
*
|
*
|
||||||
* @return 实体类引用
|
* @return 实体类引用
|
||||||
*/
|
*/
|
||||||
Class<?> ref();
|
Class<?> value();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否复制引用类 {@code @Table} 注解上的内容,默认为:{@code true}。
|
* 是否复制引用类 {@code @Table} 注解上的内容,默认为:{@code true}。
|
||||||
@ -15,7 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.mybatisflex.core.table;
|
package com.mybatisflex.core.table;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.*;
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.ColumnAlias;
|
||||||
|
import com.mybatisflex.annotation.ColumnMask;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.InsertListener;
|
||||||
|
import com.mybatisflex.annotation.NoneListener;
|
||||||
|
import com.mybatisflex.annotation.SetListener;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import com.mybatisflex.annotation.TableRef;
|
||||||
|
import com.mybatisflex.annotation.UpdateListener;
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import com.mybatisflex.core.FlexGlobalConfig;
|
import com.mybatisflex.core.FlexGlobalConfig;
|
||||||
import com.mybatisflex.core.exception.FlexExceptions;
|
import com.mybatisflex.core.exception.FlexExceptions;
|
||||||
@ -23,20 +32,53 @@ import com.mybatisflex.core.query.QueryChain;
|
|||||||
import com.mybatisflex.core.query.QueryColumn;
|
import com.mybatisflex.core.query.QueryColumn;
|
||||||
import com.mybatisflex.core.query.QueryCondition;
|
import com.mybatisflex.core.query.QueryCondition;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.core.util.*;
|
import com.mybatisflex.core.util.ClassUtil;
|
||||||
|
import com.mybatisflex.core.util.CollectionUtil;
|
||||||
|
import com.mybatisflex.core.util.MapUtil;
|
||||||
|
import com.mybatisflex.core.util.Reflectors;
|
||||||
|
import com.mybatisflex.core.util.StringUtil;
|
||||||
import org.apache.ibatis.io.ResolverUtil;
|
import org.apache.ibatis.io.ResolverUtil;
|
||||||
import org.apache.ibatis.reflection.Reflector;
|
import org.apache.ibatis.reflection.Reflector;
|
||||||
import org.apache.ibatis.reflection.TypeParameterResolver;
|
import org.apache.ibatis.reflection.TypeParameterResolver;
|
||||||
import org.apache.ibatis.type.*;
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
import org.apache.ibatis.type.TypeException;
|
||||||
|
import org.apache.ibatis.type.TypeHandler;
|
||||||
|
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||||
|
import org.apache.ibatis.type.UnknownTypeHandler;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.lang.reflect.TypeVariable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.*;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.time.OffsetTime;
|
||||||
|
import java.time.Year;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import java.time.chrono.JapaneseDate;
|
import java.time.chrono.JapaneseDate;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -182,9 +224,9 @@ public class TableInfoFactory {
|
|||||||
// 初始化表名
|
// 初始化表名
|
||||||
Table table = entityClass.getAnnotation(Table.class);
|
Table table = entityClass.getAnnotation(Table.class);
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
ViewObject vo = entityClass.getAnnotation(ViewObject.class);
|
TableRef vo = entityClass.getAnnotation(TableRef.class);
|
||||||
if (vo != null) {
|
if (vo != null) {
|
||||||
TableInfo refTableInfo = ofEntityClass(vo.ref());
|
TableInfo refTableInfo = ofEntityClass(vo.value());
|
||||||
// 设置 VO 类对应的真实的表名
|
// 设置 VO 类对应的真实的表名
|
||||||
tableInfo.setSchema(refTableInfo.getSchema());
|
tableInfo.setSchema(refTableInfo.getSchema());
|
||||||
tableInfo.setTableName(refTableInfo.getTableName());
|
tableInfo.setTableName(refTableInfo.getTableName());
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.mybatisflex.test.alisa;
|
package com.mybatisflex.test.alisa;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.ViewObject;
|
import com.mybatisflex.annotation.TableRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门。
|
* 部门。
|
||||||
@ -24,7 +24,7 @@ import com.mybatisflex.annotation.ViewObject;
|
|||||||
* @author 王帅
|
* @author 王帅
|
||||||
* @since 2023-11-16
|
* @since 2023-11-16
|
||||||
*/
|
*/
|
||||||
@ViewObject(ref = SysDept.class)
|
@TableRef(SysDept.class)
|
||||||
public class DeptVO extends BaseEntity {
|
public class DeptVO extends BaseEntity {
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.mybatisflex.test.alisa;
|
package com.mybatisflex.test.alisa;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.ViewObject;
|
import com.mybatisflex.annotation.TableRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色。
|
* 角色。
|
||||||
@ -24,7 +24,7 @@ import com.mybatisflex.annotation.ViewObject;
|
|||||||
* @author 王帅
|
* @author 王帅
|
||||||
* @since 2023-11-16
|
* @since 2023-11-16
|
||||||
*/
|
*/
|
||||||
@ViewObject(ref = SysRole.class)
|
@TableRef(SysRole.class)
|
||||||
public class RoleVO extends BaseEntity {
|
public class RoleVO extends BaseEntity {
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
package com.mybatisflex.test.alisa;
|
package com.mybatisflex.test.alisa;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.ColumnAlias;
|
import com.mybatisflex.annotation.ColumnAlias;
|
||||||
import com.mybatisflex.annotation.ViewObject;
|
import com.mybatisflex.annotation.TableRef;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
* @author 王帅
|
* @author 王帅
|
||||||
* @since 2023-11-16
|
* @since 2023-11-16
|
||||||
*/
|
*/
|
||||||
@ViewObject(ref = SysUser.class)
|
@TableRef(SysUser.class)
|
||||||
public class UserVO extends BaseEntity {
|
public class UserVO extends BaseEntity {
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user