Commit 7a6d31dc by zhangkb

修改返回状态

parent 410b5d0c
......@@ -40,7 +40,12 @@ public class IndCatalogCtrl {
}else {
message = "修改基础项目录:{}";
}
indCatalog = indCatalogService.saveOrUpdate(indCatalog);
try {
indCatalog = indCatalogService.saveOrUpdate(indCatalog);
} catch (Exception e) {
e.printStackTrace();
throw new ApiException("存在同名目录110");
}
LogManager.logInfo(Constants.LOG_INDICATOR_BASE_INDI_API,message,indCatalog.getCatalogName());
return indCatalog.getId();
}
......
......@@ -25,11 +25,11 @@ public class IndCatalogService {
@Autowired
private BaseIndDefMapper baseIndDefMapper;
public IndCatalog saveOrUpdate(IndCatalog indCatalog) throws ApiException{
public IndCatalog saveOrUpdate(IndCatalog indCatalog) throws Exception{
if(indCatalog.getId()==null) {//新增
if(!indCatalogMapper.findIsExist(indCatalog.getCatalogName(), indCatalog.getParentId(),
indCatalog.getCode()).isEmpty()) {
throw new ApiException("存在同名目录");
throw new Exception("存在同名目录");
}
//保存
indCatalogMapper.insert(indCatalog);
......@@ -37,7 +37,7 @@ public class IndCatalogService {
List<IndCatalog> dbList = indCatalogMapper.findIsExist(indCatalog.getCatalogName(), indCatalog.getParentId(),
indCatalog.getCode());
if(!dbList.isEmpty() && !dbList.get(0).getId().equals(indCatalog.getId())) {
throw new ApiException("存在同名目录");
throw new Exception("存在同名目录");
}
}
//获取parentId拼接idPath
......@@ -47,7 +47,7 @@ public class IndCatalogService {
}else {
IndCatalog parentIndCatalog = indCatalogMapper.selectByPrimaryKey(indCatalog.getParentId());
if(parentIndCatalog==null) {
throw new ApiException("父节点不存在:parent catalog is not exist");
throw new Exception("父节点不存在:parent catalog is not exist");
}else {
indCatalog.setIdPath(parentIndCatalog.getIdPath()+indCatalog.getId()+";");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment