mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-15 03:25:06 +08:00
多模块重构 11:新增 H2 SQL 脚本的生成
This commit is contained in:
@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.test.core.util;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
||||
import uk.co.jemos.podam.api.PodamFactory;
|
||||
import uk.co.jemos.podam.api.PodamFactoryImpl;
|
||||
|
||||
@ -21,6 +22,9 @@ public class RandomUtils {
|
||||
|
||||
private static final int RANDOM_STRING_LENGTH = 10;
|
||||
|
||||
private static final Set<String> TINYINT_FIELDS = SetUtils.asSet("type", "category");
|
||||
private static final int TINYINT_MAX = 127;
|
||||
|
||||
private static final int RANDOM_DATE_MAX = 30;
|
||||
|
||||
private static final int RANDOM_COLLECTION_LENGTH = 5;
|
||||
@ -37,6 +41,10 @@ public class RandomUtils {
|
||||
if (attributeMetadata.getAttributeName().equals("status")) {
|
||||
return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
|
||||
}
|
||||
// 针对部分字段,使用 tinyint 范围
|
||||
if (TINYINT_FIELDS.contains(attributeMetadata.getAttributeName())) {
|
||||
return RandomUtil.randomInt(1, TINYINT_MAX + 1);
|
||||
}
|
||||
return RandomUtil.randomInt();
|
||||
});
|
||||
// Boolean
|
||||
|
Reference in New Issue
Block a user