|
@@ -6,6 +6,7 @@ import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.github.microservice.components.data.mongo.mongo.domain.SuperEntity;
|
|
import com.github.microservice.components.data.mongo.mongo.domain.SuperEntity;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
import com.github.microservice.net.ResultContent;
|
|
|
import com.zhongshu.card.client.model.dictionary.*;
|
|
import com.zhongshu.card.client.model.dictionary.*;
|
|
|
|
|
+import com.zhongshu.card.client.type.DictionaryPermission;
|
|
|
import com.zhongshu.card.client.type.DictionaryType;
|
|
import com.zhongshu.card.client.type.DictionaryType;
|
|
|
import com.zhongshu.card.client.type.DictionaryUpdateStatus;
|
|
import com.zhongshu.card.client.type.DictionaryUpdateStatus;
|
|
|
import com.zhongshu.card.server.core.dao.dictionary.DictionaryDao;
|
|
import com.zhongshu.card.server.core.dao.dictionary.DictionaryDao;
|
|
@@ -109,7 +110,9 @@ public class DictionaryService extends SuperService {
|
|
|
return ResultContent.buildFail("数据不存在");
|
|
return ResultContent.buildFail("数据不存在");
|
|
|
}
|
|
}
|
|
|
if (DictionaryType.Standard.equals(dictionary.getType())){
|
|
if (DictionaryType.Standard.equals(dictionary.getType())){
|
|
|
- return ResultContent.buildFail("标准字典不允许删除");
|
|
|
|
|
|
|
+ if (dictionary.getPermission() == null || !dictionary.getPermission().contains(DictionaryPermission.delete)){
|
|
|
|
|
+ return ResultContent.buildFail("标准字典不允许删除");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
dictionaryDao.deleteById(id);
|
|
dictionaryDao.deleteById(id);
|
|
|
//TODO 删除字典下的字典项
|
|
//TODO 删除字典下的字典项
|
|
@@ -152,7 +155,19 @@ public class DictionaryService extends SuperService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (dictionary.getType().equals(DictionaryType.Standard)){
|
|
if (dictionary.getType().equals(DictionaryType.Standard)){
|
|
|
- return ResultContent.buildFail("标准字典不允许添加项");
|
|
|
|
|
|
|
+ List<DictionaryPermission> permission = dictionary.getPermission();
|
|
|
|
|
+ if (permission==null || !permission.contains(DictionaryPermission.add)){
|
|
|
|
|
+ return ResultContent.buildFail("该字典不允许添加项");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (param.getParentId()!=null){
|
|
|
|
|
+ DictionaryItem parentItem = dictionaryItemDao.findTopById(param.getParentId());
|
|
|
|
|
+ if (parentItem != null && parentItem.getType().equals(DictionaryType.Standard)){
|
|
|
|
|
+ if (parentItem.getPermission() == null || !parentItem.getPermission().contains(DictionaryPermission.add)){
|
|
|
|
|
+ return ResultContent.buildFail("该项不允许添加下级");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
DictionaryItem updateItem = dictionaryItemDao.findTopByDictionary_IdAndKey(param.getDictionaryId(), param.getKey());
|
|
DictionaryItem updateItem = dictionaryItemDao.findTopByDictionary_IdAndKey(param.getDictionaryId(), param.getKey());
|
|
@@ -213,7 +228,9 @@ public class DictionaryService extends SuperService {
|
|
|
return ResultContent.buildFail("数据不存在");
|
|
return ResultContent.buildFail("数据不存在");
|
|
|
}
|
|
}
|
|
|
if (DictionaryType.Standard.equals(dictionaryItem.getType())){
|
|
if (DictionaryType.Standard.equals(dictionaryItem.getType())){
|
|
|
- return ResultContent.buildFail("标准字典的项不允许删除");
|
|
|
|
|
|
|
+ if (dictionaryItem.getPermission() == null || dictionaryItem.getPermission().contains(DictionaryPermission.delete)){
|
|
|
|
|
+ return ResultContent.buildFail("标准字典的项不允许删除");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
dictionaryItemDao.deleteById(id);
|
|
dictionaryItemDao.deleteById(id);
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|