mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 17:18:24 +08:00
refactor: 将 assertAreNotNull 从 FlexExceptions 移动到 FlexAssert 中。
This commit is contained in:
parent
e3325e5e4c
commit
5e73333682
@ -82,4 +82,18 @@ public final class FlexAssert {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 断言传入的数组内容不能为 null 或者 空
|
||||
*/
|
||||
public static <T> void assertAreNotNull(T[] elements, String msg, Object params) {
|
||||
if (elements == null || elements.length == 0) {
|
||||
throw FlexExceptions.wrap(msg, params);
|
||||
}
|
||||
for (T element : elements) {
|
||||
if (element == null) {
|
||||
throw FlexExceptions.wrap(msg, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ package com.mybatisflex.core.provider;
|
||||
import com.mybatisflex.core.FlexConsts;
|
||||
import com.mybatisflex.core.dialect.DialectFactory;
|
||||
import com.mybatisflex.core.exception.FlexAssert;
|
||||
import com.mybatisflex.core.exception.FlexExceptions;
|
||||
import com.mybatisflex.core.query.CPI;
|
||||
import com.mybatisflex.core.query.QueryTable;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
@ -240,7 +239,7 @@ public class EntitySqlProvider {
|
||||
Object[] primaryValues = tableInfo.buildPkSqlArgs(entity);
|
||||
Object[] tenantIdArgs = tableInfo.buildTenantIdArgs();
|
||||
|
||||
FlexExceptions.assertAreNotNull(primaryValues, "The value of primary key must not be null, entity[%s]", entity);
|
||||
FlexAssert.assertAreNotNull(primaryValues, "The value of primary key must not be null, entity[%s]", entity);
|
||||
|
||||
ProviderUtil.setSqlArgs(params, ArrayUtil.concat(updateValues, primaryValues, tenantIdArgs));
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@ package com.mybatisflex.core.provider;
|
||||
import com.mybatisflex.core.FlexConsts;
|
||||
import com.mybatisflex.core.dialect.DialectFactory;
|
||||
import com.mybatisflex.core.exception.FlexAssert;
|
||||
import com.mybatisflex.core.exception.FlexExceptions;
|
||||
import com.mybatisflex.core.query.CPI;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
@ -247,7 +246,7 @@ public class RowSqlProvider {
|
||||
Object[] primaryValues = tableInfo.buildPkSqlArgs(entity);
|
||||
Object[] tenantIdArgs = tableInfo.buildTenantIdArgs();
|
||||
|
||||
FlexExceptions.assertAreNotNull(primaryValues, "The value of primary key must not be null, entity[%s]", entity);
|
||||
FlexAssert.assertAreNotNull(primaryValues, "The value of primary key must not be null, entity[%s]", entity);
|
||||
|
||||
ProviderUtil.setSqlArgs(params, ArrayUtil.concat(updateValues, primaryValues, tenantIdArgs));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user