!279 QueryChain添加新of方法,用于支持通过Entity创建QueryChain对象

Merge pull request !279 from liibang/main
This commit is contained in:
Michael Yang 2023-08-13 04:53:39 +00:00 committed by Gitee
commit bace7dcfb2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -17,6 +17,7 @@
package com.mybatisflex.core.query; package com.mybatisflex.core.query;
import com.mybatisflex.core.BaseMapper; import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.mybatis.Mappers;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.table.TableInfo; import com.mybatisflex.core.table.TableInfo;
import com.mybatisflex.core.table.TableInfoFactory; import com.mybatisflex.core.table.TableInfoFactory;
@ -38,6 +39,11 @@ public class QueryChain<T> extends QueryWrapperAdapter<QueryChain<T>> implements
this.baseMapper = baseMapper; this.baseMapper = baseMapper;
} }
public static <T> QueryChain<T> of(Class<T> entityClass) {
BaseMapper<T> baseMapper = Mappers.ofEntityClass(entityClass);
return new QueryChain<>(baseMapper);
}
public static <E> QueryChain<E> of(BaseMapper<E> baseMapper) { public static <E> QueryChain<E> of(BaseMapper<E> baseMapper) {
return new QueryChain<>(baseMapper); return new QueryChain<>(baseMapper);
} }