List<JSONObject>oldField=fieldService.select("select fieldid from ibzfield t inner join ibzentity t1 on t.entityid =t1.entityid where t1.systemid = #{et.id}",param);
List<JSONObject>oldRelation=relationService.select("select distinct(relationid) from ibzrelation t inner join ibzentity t1 on t.entityid=t1.entityid or t.refentityid=t1.entityid where t1.systemid=#{et.id} ",param);
List<JSONObject>oldField=fieldService.select("select fieldid from ibzfield t inner join ibzentity t1 on t.entityid =t1.entityid where t1.systemid = #{et.id}",param);
for(JSONObjectfield:oldField){
delField.put(field.getString("FIELDID"),1);
}
Set<MetaField>list=sysModel.getField();
list.forEach(field->{
delField.remove(field.getFieldId());
});
//移除无效资源
if(delField.size()>0)
fieldService.removeBatch(delField.keySet());
//存储或更新资源saveOrUpdate
if(list.size()>0)
fieldService.saveBatch(list);
}
/**
* 同步实体关系
* @param sysModel
*/
privatevoidsyncDERelation(SysModelsysModel){
Map<String,Integer>delRelation=newHashMap<>();
Mapparam=newHashMap();
param.put("id",sysModel.getSystemid());
List<JSONObject>oldRelation=relationService.select("select distinct(relationid) from ibzrelation t inner join ibzentity t1 on t.entityid=t1.entityid or t.refentityid=t1.entityid where t1.systemid=#{et.id} ",param);