文档库--查看已上传的文件,分页
This commit is contained in:
+3
@@ -19,6 +19,9 @@ public interface IOSSFileService extends IService<OSSFile> {
|
||||
*/
|
||||
public OSSFile uploadLocal(MultipartFile mf, String bizPath);
|
||||
|
||||
|
||||
public List<OSSFile> getFileInfos(String connectId);
|
||||
|
||||
boolean delete(OSSFile ossFile);
|
||||
|
||||
/**
|
||||
|
||||
+10
-1
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.oss.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
@@ -108,7 +109,7 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
//存入文件表
|
||||
oSSFile.setFileName(orgName);
|
||||
oSSFile.setId(UuidUtils.getUUID());
|
||||
oSSFile.setUrl(file.getPath());
|
||||
oSSFile.setUrl(savePath);
|
||||
oSSFile.setCreateBy(loginUser.getUsername());
|
||||
oSSFile.setCreateTime(new Date());
|
||||
this.save(oSSFile);
|
||||
@@ -119,6 +120,14 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
return oSSFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OSSFile> getFileInfos(String connectId) {
|
||||
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OSSFile::getConnectId,connectId);
|
||||
List<OSSFile> list = this.list(wrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(OSSFile ossFile) {
|
||||
try {
|
||||
|
||||
+19
@@ -7,6 +7,8 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.*;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
@@ -30,6 +32,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 前端控制器
|
||||
@@ -38,6 +42,7 @@ import java.net.URLDecoder;
|
||||
* @Author scott
|
||||
* @since 2018-12-20
|
||||
*/
|
||||
@Api(tags="文件通用")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/common")
|
||||
@@ -129,6 +134,7 @@ public class CommonController {
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="文件上传统一方法", notes="文件上传统一方法")
|
||||
@PostMapping(value = "/upload")
|
||||
public Result<?> upload(HttpServletRequest request, HttpServletResponse response) {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
@@ -154,6 +160,19 @@ public class CommonController {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看已上传的文件
|
||||
* @param connectId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="查看已上传的文件", notes="查看已上传的文件")
|
||||
@GetMapping(value = "/getFileInfos")
|
||||
public Result<?> getFileInfos(String connectId) {
|
||||
List<OSSFile> fileInfos = ossFileService.getFileInfos(connectId);
|
||||
return Result.OK(fileInfos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 预览图片&下载文件
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user