fixed:不支持自己扩展 mapper 的问题;close #I6ZTS3

This commit is contained in:
开源海哥 2023-05-06 13:23:38 +08:00
parent 2a47e0b526
commit e5c208d888
3 changed files with 12 additions and 3 deletions

View File

@ -102,6 +102,8 @@ public class TableInfoFactory {
Type type = genericInterfaces[0];
if (type instanceof ParameterizedType) {
return (Class<?>) ((ParameterizedType) type).getActualTypeArguments()[0];
} else if (type instanceof Class) {
return getEntityClass((Class<?>) type);
}
}
return getEntityClass(mapperClass.getSuperclass());

View File

@ -27,7 +27,6 @@ import javax.sql.DataSource;
import java.util.List;
import static com.mybatisflex.test.table.Tables.ACCOUNT;
import static com.mybatisflex.test.table.Tables.ARTICLE;
public class EntityTestStarter {
@ -41,6 +40,7 @@ public class EntityTestStarter {
MybatisFlexBootstrap bootstrap = MybatisFlexBootstrap.getInstance()
.setDataSource(dataSource)
.addMapper(AccountMapper.class)
.addMapper(MyAccountMapper.class)
.start();
//开启审计功能
@ -52,6 +52,9 @@ public class EntityTestStarter {
AccountMapper accountMapper = bootstrap.getMapper(AccountMapper.class);
MyAccountMapper myAccountMapper = bootstrap.getMapper(MyAccountMapper.class);
List<Account> accounts1 = myAccountMapper.selectAll();
// QueryWrapper wrapper = QueryWrapper.create().select().from(ACCOUNT)
// .and(ACCOUNT.ID.ge(100).and(ACCOUNT.ID.ge(200)))
@ -62,8 +65,8 @@ public class EntityTestStarter {
QueryWrapper wrapper = QueryWrapper.create().select().from(ACCOUNT)
.leftJoin(ARTICLE).on(ARTICLE.ACCOUNT_ID.eq(ACCOUNT.ID).and(ACCOUNT.ID.ge(100)))
.and(ACCOUNT.ID.ge(100));
// .leftJoin(ARTICLE).on(ARTICLE.ACCOUNT_ID.eq(ACCOUNT.ID).and(ACCOUNT.ID.ge(100)))
.and(ACCOUNT.ID.ge(100).when(false));
List<Account> accounts = accountMapper.selectListByQuery(wrapper);
System.out.println(accounts);

View File

@ -0,0 +1,4 @@
package com.mybatisflex.test;
public interface MyAccountMapper extends AccountMapper{
}