コード例 #1
0
 /**
  * 新增或更新文件夹
  *
  * @throws ServiceMessage
  */
 @RequestMapping("/folder/saveFolder")
 @ResponseBody
 public ResponseEntity<FolderTree> saveFolder(FolderVo folder) throws ServiceMessage {
   FolderVo ref = null;
   try {
     if (StringUtil.isEmpty(folder.getRecid())) {
       ref = folderService.createFolder(folder);
     } else {
       ref = folderService.updateFolder(folder);
     }
     if (ref == null) {
       return ResponseEntityUtil.getResponseEntity(new FolderTree(false, "文件夹名称重复!", null));
     }
     List<FolderVo> list = new ArrayList<FolderVo>();
     list.add(ref);
     return ResponseEntityUtil.getResponseEntity(
         new FolderTree(true, "文件夹保存成功!", folderConventerToTreeModel(list)));
   } catch (Exception e) {
     e.printStackTrace();
     log.error("新增文件夹发生异常====" + e.getStackTrace());
   }
   return null;
 }
コード例 #2
0
 /**
  * 删除文件夹
  *
  * @param id
  * @return
  */
 @RequestMapping("/folder/deleteFolder")
 @ResponseBody
 public ResponseEntity<MessageModel> deleteFolder(
     @RequestParam(value = "id", required = false) String id) {
   try {
     List<FolderVo> list = this.folderService.getFoldersByParentId(id);
     if (list != null && !list.isEmpty()) {
       return new ServiceMessage(false, "该文件夹不为空,不能删除!").getMessageModel();
     }
     return folderService.deleteFolder(id).getMessageModel();
   } catch (Exception e) {
     log.error("删除文件夹发生异常====" + e.getStackTrace());
     return ResponseEntityUtil.getResponseEntity(Failure);
   }
 }