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

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

上级 73ca6081
......@@ -43,6 +43,7 @@ public interface IDABuildService extends IService<DABuild> {
Page<DABuild> searchDefault(DABuildSearchContext context);
List<DABuild> selectByModelId(String id);
void removeByModelId(String id);
void saveByModelId(String id, List<DABuild> list) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -240,6 +240,35 @@ public class DABuildServiceImpl extends ServiceImpl<DABuildMapper, DABuild> impl
this.remove(new QueryWrapper<DABuild>().eq("modelid",id));
}
@Override
public void saveByModelId(String id,List<DABuild> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<DABuild> _update=new ArrayList<DABuild>();
List<DABuild> _create=new ArrayList<DABuild>();
for(DABuild before:selectByModelId(id)){
delIds.add(before.getBuildId());
}
for(DABuild sub:list) {
sub.setModelId(id);
if(ObjectUtils.isEmpty(sub.getBuildId()))
sub.setBuildId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getBuildId())) {
delIds.remove(sub.getBuildId());
_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);
}
/**
* 查询集合 数据集
......
......@@ -124,6 +124,22 @@ public class MetaModel extends EntityMP implements Serializable {
private cn.ibizlab.core.lite.domain.DstSystem system;
/**
* 分析
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.analysis.domain.DABuild> builds;
/**
* 规则
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.rule.domain.RuleItem> ruleitems;
/**
* 设置 [名称]
......
......@@ -72,6 +72,8 @@ public class MetaModelServiceImpl extends ServiceImpl<MetaModelMapper, MetaModel
if(!this.retBool(this.baseMapper.insert(et))) {
return false;
}
dabuildService.saveByModelId(et.getId(), et.getBuilds());
ruleitemService.saveByModelId(et.getId(), et.getRuleitems());
CachedBeanCopier.copy(get(et.getId()), et);
return true;
}
......@@ -88,6 +90,8 @@ public class MetaModelServiceImpl extends ServiceImpl<MetaModelMapper, MetaModel
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("modelid", et.getId()))) {
return false;
}
dabuildService.saveByModelId(et.getId(), et.getBuilds());
ruleitemService.saveByModelId(et.getId(), et.getRuleitems());
CachedBeanCopier.copy(get(et.getId()), et);
return true;
}
......@@ -101,6 +105,8 @@ public class MetaModelServiceImpl extends ServiceImpl<MetaModelMapper, MetaModel
@Override
@Transactional
public boolean remove(String key) {
dabuildService.removeByModelId(key) ;
ruleitemService.removeByModelId(key) ;
boolean result = removeById(key);
return result ;
}
......@@ -120,6 +126,8 @@ public class MetaModelServiceImpl extends ServiceImpl<MetaModelMapper, MetaModel
et.setId(key);
}
else {
et.setBuilds(dabuildService.selectByModelId(key));
et.setRuleitems(ruleitemService.selectByModelId(key));
}
return et;
}
......
......@@ -43,6 +43,7 @@ public interface IRuleItemService extends IService<RuleItem> {
Page<RuleItem> searchDefault(RuleItemSearchContext context);
List<RuleItem> selectByModelId(String id);
void removeByModelId(String id);
void saveByModelId(String id, List<RuleItem> list) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -236,6 +236,35 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
this.remove(new QueryWrapper<RuleItem>().eq("modelid",id));
}
@Override
public void saveByModelId(String id,List<RuleItem> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<RuleItem> _update=new ArrayList<RuleItem>();
List<RuleItem> _create=new ArrayList<RuleItem>();
for(RuleItem before:selectByModelId(id)){
delIds.add(before.getRuleId());
}
for(RuleItem sub:list) {
sub.setModelId(id);
if(ObjectUtils.isEmpty(sub.getRuleId()))
sub.setRuleId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getRuleId())) {
delIds.remove(sub.getRuleId());
_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);
}
/**
* 查询集合 数据集
......
......@@ -4,7 +4,7 @@
<!--输出实体[DA_BUILD]数据结构 -->
<changeSet author="root" id="tab-da_build-67-1">
<changeSet author="root" id="tab-da_build-68-1">
<createTable tableName="IBZDABUILD">
<column name="BUILDID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DA_BUILD_BUILDID"/>
......@@ -328,7 +328,7 @@
<!--输出实体[META_MODEL]数据结构 -->
<changeSet author="root" id="tab-meta_model-27-12">
<changeSet author="root" id="tab-meta_model-29-12">
<createTable tableName="IBZMODEL">
<column name="MODELID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_MODEL_MODELID"/>
......@@ -432,7 +432,7 @@
<!--输出实体[RU_ITEM]数据结构 -->
<changeSet author="root" id="tab-ru_item-77-16">
<changeSet author="root" id="tab-ru_item-78-16">
<createTable tableName="IBZRULE">
<column name="RULEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_RU_ITEM_RULEID"/>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册