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

model

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