|
|
@@ -24,8 +24,6 @@ import cn.com.taiji.core.entity.basic.DictType; |
|
|
|
import cn.com.taiji.userw.model.FormatException; |
|
|
|
import cn.com.taiji.userw.model.protocol.dict.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
public class DictTypeManagerImpl extends CommonAbstract implements DictTypeManager { |
|
|
|
|
|
|
@@ -101,8 +99,8 @@ public class DictTypeManagerImpl extends CommonAbstract implements DictTypeManag |
|
|
|
throw new ManagerException("未查询到对应数据,请检查参数!"); |
|
|
|
dictTypeRepo.delete(dictTypeOptional); |
|
|
|
List<DictItem> items = dictItemRepo.findByTypeId(req.getTypeId()); |
|
|
|
if (!items.isEmpty()){ |
|
|
|
for (DictItem item : items){ |
|
|
|
if (!items.isEmpty()) { |
|
|
|
for (DictItem item : items) { |
|
|
|
dictItemRepo.delete(item); |
|
|
|
} |
|
|
|
} |
|
|
@@ -119,9 +117,10 @@ public class DictTypeManagerImpl extends CommonAbstract implements DictTypeManag |
|
|
|
|
|
|
|
@Override |
|
|
|
public DictTypeQueryResponse view(DictTypeViewRequest req) throws ManagerException { |
|
|
|
DictTypeQueryResponse res =new DictTypeQueryResponse(); |
|
|
|
DictTypeQueryResponse res = new DictTypeQueryResponse(); |
|
|
|
DictType dictType = dictTypeRepo.findByTypeId(req.getTypeId()); |
|
|
|
if(dictType==null)throw new ManagerException("未查询到对应数据,请检查参数!"); |
|
|
|
if (dictType == null) |
|
|
|
throw new ManagerException("未查询到对应数据,请检查参数!"); |
|
|
|
List<DictItem> items = dictItemRepo.findByTypeId(dictType.getId()); |
|
|
|
DictTypeModel dictTypeModel = fromDictType(dictType, items); |
|
|
|
res.setDictType(dictTypeModel); |
|
|
@@ -139,6 +138,8 @@ public class DictTypeManagerImpl extends CommonAbstract implements DictTypeManag |
|
|
|
items.forEach(o -> { |
|
|
|
DictItemModel model = new DictItemModel(); |
|
|
|
BeanTools.copyProperties(o, model); |
|
|
|
model.setDictTypeId(o.getTypeId()); |
|
|
|
model.setDictItemId(o.getId()); |
|
|
|
dictItems.add(model); |
|
|
|
}); |
|
|
|
dictTypeModel.setDictItems(dictItems); |