提交 b23b6d5e 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 a3c3e28c
......@@ -123,6 +123,38 @@ public class MetaEntity extends EntityMP implements Serializable {
private cn.ibizlab.core.lite.domain.DstSystem system;
/**
* 数据集
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.lite.domain.MetaDataSet> datasets;
/**
* 属性
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.lite.domain.MetaField> fields;
/**
* 实体关系
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.lite.domain.MetaRelationship> parententitys;
/**
* 实体关系
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.lite.domain.MetaRelationship> subentitys;
/**
* 设置 [实体名]
......
......@@ -40,6 +40,7 @@ public interface IMetaDataSetService extends IService<MetaDataSet>{
Page<MetaDataSet> searchDefault(MetaDataSetSearchContext context) ;
List<MetaDataSet> selectByEntityId(String entity_id) ;
void removeByEntityId(String entity_id) ;
void saveByEntityId(String entity_id,List<MetaDataSet> list) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -40,6 +40,7 @@ public interface IMetaFieldService extends IService<MetaField>{
Page<MetaField> searchDefault(MetaFieldSearchContext context) ;
List<MetaField> selectByEntityId(String entity_id) ;
void removeByEntityId(String entity_id) ;
void saveByEntityId(String entity_id,List<MetaField> list) ;
List<MetaField> selectByRefFieldId(String field_id) ;
void removeByRefFieldId(String field_id) ;
List<MetaField> selectByRelationId(String id) ;
......
......@@ -40,8 +40,10 @@ public interface IMetaRelationshipService extends IService<MetaRelationship>{
Page<MetaRelationship> searchDefault(MetaRelationshipSearchContext context) ;
List<MetaRelationship> selectByEntityId(String entity_id) ;
void removeByEntityId(String entity_id) ;
void saveByEntityId(String entity_id,List<MetaRelationship> list) ;
List<MetaRelationship> selectByRefEntityId(String entity_id) ;
void removeByRefEntityId(String entity_id) ;
void saveByRefEntityId(String entity_id,List<MetaRelationship> list) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -168,6 +168,38 @@ public class MetaDataSetServiceImpl extends ServiceImpl<MetaDataSetMapper, MetaD
this.remove(new QueryWrapper<MetaDataSet>().eq("entityid",entity_id));
}
@Autowired
@Lazy
IMetaDataSetService proxyService;
@Override
public void saveByEntityId(String entity_id,List<MetaDataSet> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<MetaDataSet> _update=new ArrayList<MetaDataSet>();
List<MetaDataSet> _create=new ArrayList<MetaDataSet>();
for(MetaDataSet before:selectByEntityId(entity_id)){
delIds.add(before.getDatasetId());
}
for(MetaDataSet sub:list) {
sub.setEntityId(entity_id);
if(ObjectUtils.isEmpty(sub.getDatasetId()))
sub.setDatasetId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getDatasetId())) {
delIds.remove(sub.getDatasetId());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0)
proxyService.updateBatch(_update);
if(_create.size()>0)
proxyService.createBatch(_create);
if(delIds.size()>0)
proxyService.removeBatch(delIds);
}
/**
* 查询集合 数据集
......
......@@ -72,6 +72,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
fillParentData(et);
if(!this.retBool(this.baseMapper.insert(et)))
return false;
metadatasetService.saveByEntityId(et.getEntityId(),et.getDatasets());
metafieldService.saveByEntityId(et.getEntityId(),et.getFields());
metarelationshipService.saveByEntityId(et.getEntityId(),et.getParententitys());
metarelationshipService.saveByRefEntityId(et.getEntityId(),et.getSubentitys());
CachedBeanCopier.copy(get(et.getEntityId()),et);
return true;
}
......@@ -89,6 +93,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
fillParentData(et);
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("entityid",et.getEntityId())))
return false;
metadatasetService.saveByEntityId(et.getEntityId(),et.getDatasets());
metafieldService.saveByEntityId(et.getEntityId(),et.getFields());
metarelationshipService.saveByEntityId(et.getEntityId(),et.getParententitys());
metarelationshipService.saveByRefEntityId(et.getEntityId(),et.getSubentitys());
CachedBeanCopier.copy(get(et.getEntityId()),et);
return true;
}
......@@ -103,6 +111,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
@Override
@Transactional
public boolean remove(String key) {
metadatasetService.removeByEntityId(key) ;
metafieldService.removeByEntityId(key) ;
metarelationshipService.removeByEntityId(key) ;
metarelationshipService.removeByRefEntityId(key) ;
boolean result=removeById(key);
return result ;
}
......@@ -122,6 +134,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
et.setEntityId(key);
}
else{
et.setDatasets(metadatasetService.selectByEntityId(key));
et.setFields(metafieldService.selectByEntityId(key));
et.setParententitys(metarelationshipService.selectByEntityId(key));
et.setSubentitys(metarelationshipService.selectByRefEntityId(key));
}
return et;
}
......
......@@ -173,6 +173,38 @@ public class MetaFieldServiceImpl extends ServiceImpl<MetaFieldMapper, MetaField
this.remove(new QueryWrapper<MetaField>().eq("entityid",entity_id));
}
@Autowired
@Lazy
IMetaFieldService proxyService;
@Override
public void saveByEntityId(String entity_id,List<MetaField> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<MetaField> _update=new ArrayList<MetaField>();
List<MetaField> _create=new ArrayList<MetaField>();
for(MetaField before:selectByEntityId(entity_id)){
delIds.add(before.getFieldId());
}
for(MetaField sub:list) {
sub.setEntityId(entity_id);
if(ObjectUtils.isEmpty(sub.getFieldId()))
sub.setFieldId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getFieldId())) {
delIds.remove(sub.getFieldId());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0)
proxyService.updateBatch(_update);
if(_create.size()>0)
proxyService.createBatch(_create);
if(delIds.size()>0)
proxyService.removeBatch(delIds);
}
@Override
public List<MetaField> selectByRefFieldId(String field_id) {
return baseMapper.selectByRefFieldId(field_id);
......
......@@ -171,6 +171,38 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap
this.remove(new QueryWrapper<MetaRelationship>().eq("entityid",entity_id));
}
@Autowired
@Lazy
IMetaRelationshipService proxyService;
@Override
public void saveByEntityId(String entity_id,List<MetaRelationship> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<MetaRelationship> _update=new ArrayList<MetaRelationship>();
List<MetaRelationship> _create=new ArrayList<MetaRelationship>();
for(MetaRelationship before:selectByEntityId(entity_id)){
delIds.add(before.getId());
}
for(MetaRelationship sub:list) {
sub.setEntityId(entity_id);
if(ObjectUtils.isEmpty(sub.getId()))
sub.setId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getId())) {
delIds.remove(sub.getId());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0)
proxyService.updateBatch(_update);
if(_create.size()>0)
proxyService.createBatch(_create);
if(delIds.size()>0)
proxyService.removeBatch(delIds);
}
@Override
public List<MetaRelationship> selectByRefEntityId(String entity_id) {
return baseMapper.selectByRefEntityId(entity_id);
......@@ -181,6 +213,35 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap
this.remove(new QueryWrapper<MetaRelationship>().eq("refentityid",entity_id));
}
@Override
public void saveByRefEntityId(String entity_id,List<MetaRelationship> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<MetaRelationship> _update=new ArrayList<MetaRelationship>();
List<MetaRelationship> _create=new ArrayList<MetaRelationship>();
for(MetaRelationship before:selectByRefEntityId(entity_id)){
delIds.add(before.getId());
}
for(MetaRelationship sub:list) {
sub.setRefEntityId(entity_id);
if(ObjectUtils.isEmpty(sub.getId()))
sub.setId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getId())) {
delIds.remove(sub.getId());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0)
proxyService.updateBatch(_update);
if(_create.size()>0)
proxyService.createBatch(_create);
if(delIds.size()>0)
proxyService.removeBatch(delIds);
}
/**
* 查询集合 数据集
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册