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

demoadmin 发布系统代码 [ibz-dst,应用]

上级 3e40bc62
...@@ -179,6 +179,38 @@ public class MetaEntity extends EntityMP implements Serializable { ...@@ -179,6 +179,38 @@ public class MetaEntity extends EntityMP implements Serializable {
private cn.ibizlab.core.lite.domain.MetaModule module; private cn.ibizlab.core.lite.domain.MetaModule module;
/**
* 数据集
*/
@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;
/** /**
* 设置 [实体名] * 设置 [实体名]
......
...@@ -39,6 +39,7 @@ public interface IMetaDataSetService extends IService<MetaDataSet> { ...@@ -39,6 +39,7 @@ public interface IMetaDataSetService extends IService<MetaDataSet> {
Page<MetaDataSet> searchDefault(MetaDataSetSearchContext context); Page<MetaDataSet> searchDefault(MetaDataSetSearchContext context);
List<MetaDataSet> selectByEntityId(String entity_id); List<MetaDataSet> selectByEntityId(String entity_id);
void removeByEntityId(String entity_id); void removeByEntityId(String entity_id);
void saveByEntityId(String entity_id, List<MetaDataSet> list) ;
/** /**
*自定义查询SQL *自定义查询SQL
* @param sql select * from table where id =#{et.param} * @param sql select * from table where id =#{et.param}
......
...@@ -39,6 +39,7 @@ public interface IMetaFieldService extends IService<MetaField> { ...@@ -39,6 +39,7 @@ public interface IMetaFieldService extends IService<MetaField> {
Page<MetaField> searchDefault(MetaFieldSearchContext context); Page<MetaField> searchDefault(MetaFieldSearchContext context);
List<MetaField> selectByEntityId(String entity_id); List<MetaField> selectByEntityId(String entity_id);
void removeByEntityId(String entity_id); void removeByEntityId(String entity_id);
void saveByEntityId(String entity_id, List<MetaField> list) ;
List<MetaField> selectByRefFieldId(String field_id); List<MetaField> selectByRefFieldId(String field_id);
void removeByRefFieldId(String field_id); void removeByRefFieldId(String field_id);
List<MetaField> selectByRelationId(String id); List<MetaField> selectByRelationId(String id);
......
...@@ -39,8 +39,10 @@ public interface IMetaRelationshipService extends IService<MetaRelationship> { ...@@ -39,8 +39,10 @@ public interface IMetaRelationshipService extends IService<MetaRelationship> {
Page<MetaRelationship> searchDefault(MetaRelationshipSearchContext context); Page<MetaRelationship> searchDefault(MetaRelationshipSearchContext context);
List<MetaRelationship> selectByEntityId(String entity_id); List<MetaRelationship> selectByEntityId(String entity_id);
void removeByEntityId(String entity_id); void removeByEntityId(String entity_id);
void saveByEntityId(String entity_id, List<MetaRelationship> list) ;
List<MetaRelationship> selectByRefEntityId(String entity_id); List<MetaRelationship> selectByRefEntityId(String entity_id);
void removeByRefEntityId(String entity_id); void removeByRefEntityId(String entity_id);
void saveByRefEntityId(String entity_id, List<MetaRelationship> list) ;
/** /**
*自定义查询SQL *自定义查询SQL
* @param sql select * from table where id =#{et.param} * @param sql select * from table where id =#{et.param}
......
...@@ -198,6 +198,38 @@ public class MetaDataSetServiceImpl extends ServiceImpl<MetaDataSetMapper, MetaD ...@@ -198,6 +198,38 @@ public class MetaDataSetServiceImpl extends ServiceImpl<MetaDataSetMapper, MetaD
this.remove(new QueryWrapper<MetaDataSet>().eq("entityid",entity_id)); this.remove(new QueryWrapper<MetaDataSet>().eq("entityid",entity_id));
} }
public IMetaDataSetService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
@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)
getProxyService().updateBatch(_update);
if(_create.size()>0)
getProxyService().createBatch(_create);
if(delIds.size()>0)
getProxyService().removeBatch(delIds);
}
/** /**
* 查询集合 数据集 * 查询集合 数据集
...@@ -259,9 +291,6 @@ public class MetaDataSetServiceImpl extends ServiceImpl<MetaDataSetMapper, MetaD ...@@ -259,9 +291,6 @@ public class MetaDataSetServiceImpl extends ServiceImpl<MetaDataSetMapper, MetaD
public IMetaDataSetService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
} }
......
...@@ -76,6 +76,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt ...@@ -76,6 +76,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
if(!this.retBool(this.baseMapper.insert(et))) { if(!this.retBool(this.baseMapper.insert(et))) {
return false; 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); CachedBeanCopier.copy(get(et.getEntityId()), et);
return true; return true;
} }
...@@ -94,6 +98,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt ...@@ -94,6 +98,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("entityid", et.getEntityId()))) { if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("entityid", et.getEntityId()))) {
return false; 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); CachedBeanCopier.copy(get(et.getEntityId()), et);
return true; return true;
} }
...@@ -108,6 +116,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt ...@@ -108,6 +116,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
@Override @Override
@Transactional @Transactional
public boolean remove(String key) { public boolean remove(String key) {
metadatasetService.removeByEntityId(key) ;
metafieldService.removeByEntityId(key) ;
metarelationshipService.removeByEntityId(key) ;
metarelationshipService.removeByRefEntityId(key) ;
boolean result = removeById(key); boolean result = removeById(key);
return result ; return result ;
} }
...@@ -127,6 +139,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt ...@@ -127,6 +139,10 @@ public class MetaEntityServiceImpl extends ServiceImpl<MetaEntityMapper, MetaEnt
et.setEntityId(key); et.setEntityId(key);
} }
else { else {
et.setDataSets(metadatasetService.selectByEntityId(key));
et.setFields(metafieldService.selectByEntityId(key));
et.setParentEntitys(metarelationshipService.selectByEntityId(key));
et.setSubEntitys(metarelationshipService.selectByRefEntityId(key));
} }
return et; return et;
} }
......
...@@ -203,6 +203,38 @@ public class MetaFieldServiceImpl extends ServiceImpl<MetaFieldMapper, MetaField ...@@ -203,6 +203,38 @@ public class MetaFieldServiceImpl extends ServiceImpl<MetaFieldMapper, MetaField
this.remove(new QueryWrapper<MetaField>().eq("entityid",entity_id)); this.remove(new QueryWrapper<MetaField>().eq("entityid",entity_id));
} }
public IMetaFieldService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
@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)
getProxyService().updateBatch(_update);
if(_create.size()>0)
getProxyService().createBatch(_create);
if(delIds.size()>0)
getProxyService().removeBatch(delIds);
}
@Override @Override
public List<MetaField> selectByRefFieldId(String field_id) { public List<MetaField> selectByRefFieldId(String field_id) {
return baseMapper.selectByRefFieldId(field_id); return baseMapper.selectByRefFieldId(field_id);
...@@ -306,9 +338,6 @@ public class MetaFieldServiceImpl extends ServiceImpl<MetaFieldMapper, MetaField ...@@ -306,9 +338,6 @@ public class MetaFieldServiceImpl extends ServiceImpl<MetaFieldMapper, MetaField
public IMetaFieldService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
} }
......
...@@ -201,6 +201,38 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap ...@@ -201,6 +201,38 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap
this.remove(new QueryWrapper<MetaRelationship>().eq("entityid",entity_id)); this.remove(new QueryWrapper<MetaRelationship>().eq("entityid",entity_id));
} }
public IMetaRelationshipService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
@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)
getProxyService().updateBatch(_update);
if(_create.size()>0)
getProxyService().createBatch(_create);
if(delIds.size()>0)
getProxyService().removeBatch(delIds);
}
@Override @Override
public List<MetaRelationship> selectByRefEntityId(String entity_id) { public List<MetaRelationship> selectByRefEntityId(String entity_id) {
return baseMapper.selectByRefEntityId(entity_id); return baseMapper.selectByRefEntityId(entity_id);
...@@ -210,6 +242,35 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap ...@@ -210,6 +242,35 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap
this.remove(new QueryWrapper<MetaRelationship>().eq("refentityid",entity_id)); 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)
getProxyService().updateBatch(_update);
if(_create.size()>0)
getProxyService().createBatch(_create);
if(delIds.size()>0)
getProxyService().removeBatch(delIds);
}
/** /**
* 查询集合 数据集 * 查询集合 数据集
...@@ -282,9 +343,6 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap ...@@ -282,9 +343,6 @@ public class MetaRelationshipServiceImpl extends ServiceImpl<MetaRelationshipMap
public IMetaRelationshipService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
} }
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
<!--输出实体[META_DATASET]数据结构 --> <!--输出实体[META_DATASET]数据结构 -->
<changeSet author="root" id="tab-meta_dataset-3-9"> <changeSet author="root" id="tab-meta_dataset-4-9">
<createTable tableName="IBZDATASET"> <createTable tableName="IBZDATASET">
<column name="DATASETID" remarks="" type="VARCHAR(100)"> <column name="DATASETID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_DATASET_DATASETID"/> <constraints primaryKey="true" primaryKeyName="PK_META_DATASET_DATASETID"/>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
<!--输出实体[META_ENTITY]数据结构 --> <!--输出实体[META_ENTITY]数据结构 -->
<changeSet author="root" id="tab-meta_entity-17-10"> <changeSet author="root" id="tab-meta_entity-21-10">
<createTable tableName="IBZENTITY"> <createTable tableName="IBZENTITY">
<column name="ENTITYID" remarks="" type="VARCHAR(100)"> <column name="ENTITYID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_ENTITY_ENTITYID"/> <constraints primaryKey="true" primaryKeyName="PK_META_ENTITY_ENTITYID"/>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
<!--输出实体[META_FIELD]数据结构 --> <!--输出实体[META_FIELD]数据结构 -->
<changeSet author="root" id="tab-meta_field-8-11"> <changeSet author="root" id="tab-meta_field-9-11">
<createTable tableName="IBZFIELD"> <createTable tableName="IBZFIELD">
<column name="FIELDID" remarks="" type="VARCHAR(100)"> <column name="FIELDID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_FIELD_FIELDID"/> <constraints primaryKey="true" primaryKeyName="PK_META_FIELD_FIELDID"/>
...@@ -372,7 +372,7 @@ ...@@ -372,7 +372,7 @@
<!--输出实体[META_RELATION]数据结构 --> <!--输出实体[META_RELATION]数据结构 -->
<changeSet author="root" id="tab-meta_relation-9-14"> <changeSet author="root" id="tab-meta_relation-12-14">
<createTable tableName="IBZRELATION"> <createTable tableName="IBZRELATION">
<column name="RELATIONID" remarks="" type="VARCHAR(100)"> <column name="RELATIONID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_RELATION_RELATIONID"/> <constraints primaryKey="true" primaryKeyName="PK_META_RELATION_RELATIONID"/>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册