mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-30 10:58:14 +08:00
fix 数据库迁移到 mysql 报错(字段不存在)
This commit is contained in:
parent
e6842e5159
commit
e1090f987b
@ -14,6 +14,7 @@
|
||||
(感谢 [@大灰灰大](https://gitee.com/linjianhui) [Gitee issues I6OUDT](https://gitee.com/dromara/Jpom/issues/I6OUDT) )
|
||||
3. 【server】优化 文件管理列表显示,小屏幕部分字段被隐藏(感谢@tinsang)
|
||||
4. 【server】优化 docker 拉取镜像自动解析 tag,避免拉取所有镜像,如果没有配置 tag 默认使用 latest(感谢@Again... .)
|
||||
5. 【server】修复 数据库迁移到 mysql 报错(字段不存在)(感谢@轩辕豆豆)
|
||||
|
||||
------
|
||||
|
||||
|
@ -111,16 +111,16 @@ public class StorageServiceFactory {
|
||||
log.info("成功连接 {} {}", dbExtConfig.getMode(), dbExtConfig.getUrl());
|
||||
Set<Class<?>> classes = ClassUtil.scanPackageByAnnotation("io.jpom", TableName.class);
|
||||
classes = classes.stream()
|
||||
.filter(aClass -> {
|
||||
TableName tableName = aClass.getAnnotation(TableName.class);
|
||||
DbExtConfig.Mode[] modes = tableName.modes();
|
||||
if (ArrayUtil.isEmpty(modes)) {
|
||||
return true;
|
||||
}
|
||||
return ArrayUtil.contains(modes, dbExtConfig.getMode());
|
||||
})
|
||||
.sorted((o1, o2) -> StrUtil.compare(o1.getSimpleName(), o2.getSimpleName(), false))
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
.filter(aClass -> {
|
||||
TableName tableName = aClass.getAnnotation(TableName.class);
|
||||
DbExtConfig.Mode[] modes = tableName.modes();
|
||||
if (ArrayUtil.isEmpty(modes)) {
|
||||
return true;
|
||||
}
|
||||
return ArrayUtil.contains(modes, dbExtConfig.getMode());
|
||||
})
|
||||
.sorted((o1, o2) -> StrUtil.compare(o1.getSimpleName(), o2.getSimpleName(), false))
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
log.info("准备迁移数据");
|
||||
int total = 0;
|
||||
for (Class<?> aClass : classes) {
|
||||
@ -153,12 +153,12 @@ public class StorageServiceFactory {
|
||||
}
|
||||
// 过滤需要忽略迁移的数据
|
||||
List<Entity> newResult = pageResult.stream()
|
||||
.map(entity -> entity.toBeanIgnoreCase(aClass))
|
||||
.map(o -> {
|
||||
// 兼容大小写
|
||||
Entity entity = Entity.create(tableName.value());
|
||||
return entity.parseBean(o);
|
||||
}).collect(Collectors.toList());
|
||||
.map(entity -> entity.toBeanIgnoreCase(aClass))
|
||||
.map(o -> {
|
||||
// 兼容大小写
|
||||
Entity entity = Entity.create(tableName.value());
|
||||
return entity.parseBean(o, false, true);
|
||||
}).collect(Collectors.toList());
|
||||
if (newResult.isEmpty()) {
|
||||
if (pageResult.isLast()) {
|
||||
// 最后一页
|
||||
|
Loading…
Reference in New Issue
Block a user