mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 09:08:24 +08:00
修复:租户模式下,deleteBatchByIds报错。close #I6W0I4
This commit is contained in:
parent
fe94c30b22
commit
fdfbad3d0a
@ -150,7 +150,8 @@ public class EntitySqlProvider {
|
|||||||
|
|
||||||
TableInfo tableInfo = ProviderUtil.getTableInfo(context);
|
TableInfo tableInfo = ProviderUtil.getTableInfo(context);
|
||||||
|
|
||||||
ProviderUtil.setSqlArgs(params, primaryValues);
|
Object[] tenantIdArgs = tableInfo.buildTenantIdArgs();
|
||||||
|
ProviderUtil.setSqlArgs(params, ArrayUtil.concat(primaryValues,tenantIdArgs));
|
||||||
|
|
||||||
return DialectFactory.getDialect().forDeleteEntityBatchByIds(tableInfo, primaryValues);
|
return DialectFactory.getDialect().forDeleteEntityBatchByIds(tableInfo, primaryValues);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ package com.mybatisflex.test;
|
|||||||
import com.mybatisflex.core.MybatisFlexBootstrap;
|
import com.mybatisflex.core.MybatisFlexBootstrap;
|
||||||
import com.mybatisflex.core.audit.AuditManager;
|
import com.mybatisflex.core.audit.AuditManager;
|
||||||
import com.mybatisflex.core.audit.ConsoleMessageCollector;
|
import com.mybatisflex.core.audit.ConsoleMessageCollector;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
|
||||||
import com.mybatisflex.core.tenant.TenantFactory;
|
import com.mybatisflex.core.tenant.TenantFactory;
|
||||||
import com.mybatisflex.core.tenant.TenantManager;
|
import com.mybatisflex.core.tenant.TenantManager;
|
||||||
import com.mybatisflex.mapper.TenantAccountMapper;
|
import com.mybatisflex.mapper.TenantAccountMapper;
|
||||||
@ -27,10 +26,6 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
|||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import static com.mybatisflex.core.query.QueryMethods.select;
|
|
||||||
import static com.mybatisflex.test.table.Tables.ACCOUNT;
|
|
||||||
import static com.mybatisflex.test.table.Tables.TENANT_ACCOUNT;
|
|
||||||
|
|
||||||
public class TenantTester {
|
public class TenantTester {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -61,15 +56,17 @@ public class TenantTester {
|
|||||||
|
|
||||||
TenantAccountMapper mapper = MybatisFlexBootstrap.getInstance().getMapper(TenantAccountMapper.class);
|
TenantAccountMapper mapper = MybatisFlexBootstrap.getInstance().getMapper(TenantAccountMapper.class);
|
||||||
|
|
||||||
mapper.selectListByQuery(QueryWrapper.create()
|
// mapper.selectListByQuery(QueryWrapper.create()
|
||||||
.select(TENANT_ACCOUNT.ALL_COLUMNS)
|
// .select(TENANT_ACCOUNT.ALL_COLUMNS)
|
||||||
.from(TENANT_ACCOUNT.as("c"), ACCOUNT.as("b"))
|
// .from(TENANT_ACCOUNT.as("c"), ACCOUNT.as("b"))
|
||||||
.where(TENANT_ACCOUNT.ID.eq(ACCOUNT.ID))
|
// .where(TENANT_ACCOUNT.ID.eq(ACCOUNT.ID))
|
||||||
.and(TENANT_ACCOUNT.ID.eq(1))
|
// .and(TENANT_ACCOUNT.ID.eq(1))
|
||||||
.unionAll(select(TENANT_ACCOUNT.ALL_COLUMNS).from(TENANT_ACCOUNT)
|
// .unionAll(select(TENANT_ACCOUNT.ALL_COLUMNS).from(TENANT_ACCOUNT)
|
||||||
.where(TENANT_ACCOUNT.ID.eq(2))
|
// .where(TENANT_ACCOUNT.ID.eq(2))
|
||||||
)
|
// )
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
// mapper.deleteBatchByIds(Arrays.asList(1, 2));
|
||||||
|
|
||||||
//
|
//
|
||||||
// //SELECT * FROM `tb_account` WHERE `tenant_id` = 1
|
// //SELECT * FROM `tb_account` WHERE `tenant_id` = 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user