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

ibizdev提交

上级 a5f81675
......@@ -10,6 +10,7 @@ import java.util.Set;
import java.util.HashSet;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
......@@ -86,7 +87,7 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
}
@Override
@Transactional
public remove(String key) {
public boolean remove(String key) {
boolean ret = removeById(key);
if(!ret) return ret;
return ret ;
......@@ -103,7 +104,7 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override
@Transactional
public boolean update(IBZDictItem et) {
boolean ret = update(et, et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid()));
boolean ret = update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid()));
if(!ret) return ret;
IBZDictItem newet=get(et.getItemid());
......
......@@ -10,6 +10,7 @@ import java.util.Set;
import java.util.HashSet;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
......@@ -88,7 +89,7 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override
@Transactional
public boolean update(IBZDict et) {
boolean ret = update(et, et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid()));
boolean ret = update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid()));
if(!ret) return ret;
//嵌套[字典项目]
Set _items=new HashSet();
......@@ -119,7 +120,7 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
}
@Override
@Transactional
public remove(String key) {
public boolean remove(String key) {
IBZDict et = get(key);
//嵌套[字典项目]
if(!ObjectUtils.isEmpty(et.getItems())){
......@@ -162,40 +163,6 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
}
//更新嵌套[字典项目]
private void _updateItems(IBZDict newIBZDict , IBZDict oldIBZDict){
Map<String,cn.ibizlab.core.dict.domain.IBZDictItem> oldMapItems = new HashMap<String,cn.ibizlab.core.dict.domain.IBZDictItem>() ;
List<cn.ibizlab.core.dict.domain.IBZDictItem> oldItems = oldIBZDict.getItems();
if(ObjectUtils.isEmpty(oldItems) || oldItems.size()==0){
return ;
}
for(cn.ibizlab.core.dict.domain.IBZDictItem iBZDictItem : oldItems){
oldMapItems.put(iBZDictItem.getItemId(),iBZDictItem);
}
Map<String,cn.ibizlab.core.dict.domain.IBZDictItem> newMapItems = new HashMap<String,cn.ibizlab.core.dict.domain.IBZDictItem>() ;
List<cn.ibizlab.core.dict.domain.IBZDictItem> newItems = newIBZDict.getItems() ;
for(cn.ibizlab.core.dict.domain.IBZDictItem iBZDictItem : newItems){
iBZDictItem.setDictId(newIBZDict.getDictId());
if(iBZDictItem.getItemId() == null ){
iBZDictItemService.create(iBZDictItem) ;
continue ;
}
newMapItems.put(iBZDictItem.getItemId(),iBZDictItem) ;
if(oldMapItems.containsKey(iBZDictItem.getItemId())) {
iBZDictItemService.update(iBZDictItem);
}else {
iBZDictItemService.create(iBZDictItem);
}
}
//删除多余数据
for(String key : oldMapItems.keySet()){
if(!newMapItems.containsKey(key))
iBZDictItemService.remove(key) ;
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册