增强服务配置文件启动功能,支持文件配置仍然可以修改
This commit is contained in:
@@ -482,17 +482,34 @@ public final class MetaKit {
|
||||
|
||||
// ---------------------- repository -------------------
|
||||
public static <T extends Doc> void save(T ... ts) {
|
||||
Set<Class<T>> clazzs = new HashSet<>();
|
||||
if (ts == null || ts.length == 0) return;
|
||||
|
||||
for (T t : ts) {
|
||||
if ("file".equals(dcate)) {
|
||||
if (t.getKey() == null) { //数据新增异常提示
|
||||
throw new UnsupportedOperationException("数据文件形式启动服务,不支持配置新增!");
|
||||
}
|
||||
|
||||
cacheSave(t.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.getKey() == null) {
|
||||
t.save();
|
||||
} else {
|
||||
|
||||
if (t instanceof MetaLink) {
|
||||
//避免删除属性无效
|
||||
if (((MetaLink) t).getLink() != null && ((MetaLink) t).getLink().size() > 0) {
|
||||
t.find(String.format("UPDATE '%s' WITH { link:null } IN MetaLink", t.getKey()), Map.class);
|
||||
}
|
||||
}
|
||||
|
||||
t.update();
|
||||
}
|
||||
|
||||
clazzs.add((Class<T>) t.getClass());
|
||||
}
|
||||
clazzs.forEach(x -> reload(x));
|
||||
|
||||
reload(ts[0].getClass());
|
||||
}
|
||||
|
||||
public static <T extends Doc> T findFirst(T t) {
|
||||
|
||||
Reference in New Issue
Block a user