|
@@ -3,11 +3,15 @@ package com.fdkankan.ucenter.controller;
|
|
|
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
|
|
+import com.fdkankan.ucenter.common.BaseController;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
import com.fdkankan.ucenter.entity.Folder;
|
|
import com.fdkankan.ucenter.entity.Folder;
|
|
|
|
+import com.fdkankan.ucenter.entity.User;
|
|
import com.fdkankan.ucenter.service.IFolderService;
|
|
import com.fdkankan.ucenter.service.IFolderService;
|
|
|
|
+import com.fdkankan.ucenter.service.IUserService;
|
|
import com.fdkankan.ucenter.vo.request.FolderParam;
|
|
import com.fdkankan.ucenter.vo.request.FolderParam;
|
|
|
|
+import com.fdkankan.ucenter.vo.request.RequestFolder;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -24,10 +28,12 @@ import java.util.List;
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/ucenter/user/folder")
|
|
@RequestMapping("/ucenter/user/folder")
|
|
-public class FolderController {
|
|
|
|
|
|
+public class FolderController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
IFolderService folderService;
|
|
IFolderService folderService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IUserService userService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 新增文件夹
|
|
* 新增文件夹
|
|
@@ -84,5 +90,23 @@ public class FolderController {
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据文件夹名字获取该用户所有文件
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "/findListByName", method = RequestMethod.POST)
|
|
|
|
+ public Result findListByName(@RequestBody RequestFolder param){
|
|
|
|
+ User user = userService.getByToken(getToken());
|
|
|
|
+ if(user == null){
|
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(param.getType() == null){
|
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Folder> list = folderService.findByUserIdAndType(user.getId(), param.getType(), param.getName());
|
|
|
|
+
|
|
|
|
+ return Result.success(list);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|