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

ibizdev提交

上级 00037c66
......@@ -1073,10 +1073,10 @@ export default class IBZDictEditViewBase extends Vue {
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
_this.$emit('viewdataschange', JSON.stringify({status:'error',action:'saveAndExit'}));
_this.$emit('viewdataschange', null);
return;
}
_this.$emit('viewdataschange', JSON.stringify({status:'success',action:'saveAndExit',data:response.data}));
_this.$emit('viewdataschange', [{ ...response.data }]);
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
......
......@@ -1073,10 +1073,10 @@ export default class IBZDictItemEditViewBase extends Vue {
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
_this.$emit('viewdataschange', JSON.stringify({status:'error',action:'saveAndExit'}));
_this.$emit('viewdataschange', null);
return;
}
_this.$emit('viewdataschange', JSON.stringify({status:'success',action:'saveAndExit',data:response.data}));
_this.$emit('viewdataschange', [{ ...response.data }]);
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
......
......@@ -80,7 +80,7 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override
public boolean checkKey(IBZDictItem et) {
return true;
return (!ObjectUtils.isEmpty(et.getItemid()))&&(!Objects.isNull(this.getById(et.getItemid())));
}
@Override
@Transactional
......@@ -103,7 +103,10 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
public boolean update(IBZDictItem et) {
boolean ret = update(et, et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid()));
if(!ret) return ret;
CachedBeanCopier.copy(get(et.getItemid()),et);
IBZDictItem newet=get(et.getItemid());
CachedBeanCopier.copy(newet,et);
return ret ;
}
......@@ -112,8 +115,8 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
*/
@Override
public Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDictItem> iBZDictItems=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond());
return new PageImpl<IBZDictItem>(iBZDictItems.getRecords(), context.getPageable(), iBZDictItems.getTotal());
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDictItem> pages=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond());
return new PageImpl<IBZDictItem>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
......
......@@ -76,7 +76,7 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override
public boolean checkKey(IBZDict et) {
return true;
return (!ObjectUtils.isEmpty(et.getDictid()))&&(!Objects.isNull(this.getById(et.getDictid())));
}
@Override
public IBZDict getDraft(IBZDict et) {
......@@ -88,27 +88,41 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
public boolean update(IBZDict et) {
boolean ret = update(et, et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid()));
if(!ret) return ret;
//嵌套[字典项目]
Set _items=new HashSet();
if(!ObjectUtils.isEmpty(et.getItems())){
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
sub.setDictid(et.getDictid());
if(ObjectUtils.isEmpty(sub.getItemid()))
sub.setItemid((String)sub.getDefaultKey(true));
_items.add(sub.getItemid());
}
ibzdictitemService.saveBatch(et.getItems(),500) ;
}
CachedBeanCopier.copy(get(et.getDictid()),et);
IBZDict newet=get(et.getDictid());
//删除多余的嵌套[字典项目]
if(_items.size()>0&&(!ObjectUtils.isEmpty(et.getItems()))){
List<String> ids=new ArrayList<String>();
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
if(!_items.contains(sub.getItemid()))
ids.add(sub.getItemid());
}
ibzdictitemService.removeBatch(ids,500) ;
}
CachedBeanCopier.copy(newet,et);
return ret ;
}
@Override
@Transactional
public remove(String key) {
IBZDict et = get(key);
//嵌套[字典项目]
if(!ObjectUtils.isEmpty(et.getItems())){
List<String> ids=new ArrayList<String>();
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
ids.add(sub.getDictid());
ids.add(sub.getItemid());
}
ibzdictitemService.removeBatch(ids,500) ;
}
......@@ -140,8 +154,8 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
*/
@Override
public Page<IBZDict> searchDefault(IBZDictSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDict> iBZDicts=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond());
return new PageImpl<IBZDict>(iBZDicts.getRecords(), context.getPageable(), iBZDicts.getTotal());
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDict> pages=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond());
return new PageImpl<IBZDict>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
......
......@@ -3,6 +3,7 @@ package cn.ibizlab.util.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
......@@ -43,6 +44,11 @@ public class EntityBase implements Serializable {
return wrapper;
}
public Serializable getDefaultKey(boolean gen)
{
return IdWorker.get32UUID();
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册