1、新增自定义异常捕获处理类
2、新增保存“业务数据”逻辑:
This commit is contained in:
@@ -2,11 +2,12 @@ package net.tccn.meta;
|
||||
|
||||
import lombok.Data;
|
||||
import net.tccn.base.arango.Doc;
|
||||
import net.tccn.dbq.Field;
|
||||
import net.tccn.dbq.table.Field;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,4 +41,17 @@ public class MetaTable extends Doc<MetaTable> implements Serializable {
|
||||
|
||||
return _bean;
|
||||
}
|
||||
|
||||
// 方法名getPK 报错,
|
||||
public String[] pk() {
|
||||
List<String> pks = items.stream().filter(x -> x.getPk() != null && x.getPk()).map(x -> x.getName()).collect(Collectors.toList());
|
||||
|
||||
if (pks.size() > 0) {
|
||||
return pks.toArray(new String[pks.size()]);
|
||||
}
|
||||
|
||||
//存在id字段,取id
|
||||
Optional<Field> any = items.stream().filter(x -> x.getName().equalsIgnoreCase("id")).findAny();
|
||||
return any.isPresent() ? new String[]{"id"} : new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user