提交 27a74788 编写于 作者: sq3536's avatar sq3536

model

上级 c09471a8
......@@ -187,19 +187,25 @@ public class EntityModel {
{
if("BASE".equalsIgnoreCase(dataSet))
{
String columnSet="";
for(FieldModel fieldModel:fields)
{
String columnExp=fieldModel.getColumnExp();
if(StringUtils.isEmpty(columnExp))
continue;
if(!StringUtils.isEmpty(columnSet)){
columnSet=columnSet+",";
}
columnSet=columnSet+columnExp;
}
return "select "+columnSet+" from "+this.getTableName()+" ";
String columnSet="";
for(FieldModel fieldModel:fields)
{
String columnExp=fieldModel.getColumnExp();
if(StringUtils.isEmpty(columnExp))
continue;
if(fieldModel.isPhysicalField())
continue;
if(!StringUtils.isEmpty(columnSet)){
columnSet=columnSet+",";
}
columnSet=columnSet+columnExp;
}
if(!StringUtils.isEmpty(columnSet)){
columnSet=columnSet+",";
}
columnSet=columnSet+"t.*";
return "select "+columnSet+" from "+this.getTableName()+" t ";
}
else if("CORE".equalsIgnoreCase(dataSet))
{
......
......@@ -134,6 +134,8 @@ public class EntityObj extends DataObj<String,Object> {
return rowKey;
}
@JsonIgnore
@JSONField(serialize = false)
@Override
public Timestamp getTimestamp() {
Timestamp lastModify=super.getTimestamp();
......
......@@ -4,10 +4,12 @@ import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.core.lite.extensions.model.LayerMapping;
import cn.ibizlab.core.lite.extensions.model.Property;
import cn.ibizlab.core.lite.extensions.util.LiteStorage;
import cn.ibizlab.util.helper.DataObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.util.StringUtils;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
......@@ -221,6 +223,31 @@ public class ModelObj extends DataObj<String,Object> {
return rowKey;
}
@JsonIgnore
@JSONField(serialize = false)
@Override
public Timestamp getTimestamp()
{
Timestamp last = DataObject.getBeginDate();
for(Object sub:this.values())
{
if(sub == null)
continue;
else if(sub instanceof EntityObj)
{
if(((EntityObj)sub).getTimestamp().getTime()>last.getTime())
last=((EntityObj)sub).getTimestamp();
}
else if(sub instanceof NestedArray)
{
if(((NestedArray)sub).getTimestamp().getTime()>last.getTime())
last=((NestedArray)sub).getTimestamp();
}
}
this.setTimestamp(last);
return last;
}
public ModelObj findParent(List<ModelObj> uplayerObjs)
{
if(uplayerObjs.size()==1)
......
package cn.ibizlab.core.lite.extensions.domain;
import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.util.helper.DataObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.sql.Timestamp;
import java.util.ArrayList;
public class NestedArray extends ArrayList<ModelObj> {
......@@ -51,4 +53,15 @@ public class NestedArray extends ArrayList<ModelObj> {
return rt;
}
@JsonIgnore
@JSONField(serialize = false)
public Timestamp getTimestamp()
{
Timestamp last = DataObject.getBeginDate();
for(ModelObj sub:this)
if(sub.getTimestamp().getTime()>last.getTime())
last=sub.getTimestamp();
return last;
}
}
......@@ -155,6 +155,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
fillEntityObj(dataModel,rt);
dataModel.getNestedDataModels().forEach(subModel->
this.getModelObjs(subModel, factEntityList).forEach(subObj->subObj.findParent(rt)));
rt.forEach(modelObj -> modelObj.getTimestamp());
return rt;
}
......
......@@ -57,7 +57,6 @@ public class LiteCoreResource {
if(StringUtils.isEmpty(modelid))
modelid="dataModelff8080816a8b510c016a8c2f18b10001";
List<ModelObj> list=dbEntityService.getModelObjs(modelid, DataObject.getBeginDate());
return ResponseEntity.ok(list);
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册