org.jeecg.modules.oss.entity.OSSFile Java Examples

The following examples show how to use org.jeecg.modules.oss.entity.OSSFile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OSSFileController.java    From jeecg-cloud with Apache License 2.0 8 votes vote down vote up
@ResponseBody
@DeleteMapping("/delete")
public Result delete(@RequestParam(name = "id") String id) {
	Result result = new Result();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		boolean ok = ossFileService.delete(file);
		if (ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #2
Source File: SysUploadController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 上传
 * @param request
 */
@PostMapping(value = "/uploadMinio")
public Result<?> uploadMinio(HttpServletRequest request) {
    Result<?> result = new Result<>();
    String bizPath = request.getParameter("biz");
    if(oConvertUtils.isEmpty(bizPath)){
        bizPath = "";
    }
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
    String orgName = file.getOriginalFilename();// 获取文件名
    orgName = CommonUtils.getFileName(orgName);
    String file_url =  MinioUtil.upload(file,bizPath);
    //保存文件信息
    OSSFile minioFile = new OSSFile();
    minioFile.setFileName(orgName);
    minioFile.setUrl(file_url);
    ossFileService.save(minioFile);
    result.setMessage(file_url);
    result.setSuccess(true);
    return result;
}
 
Example #3
Source File: OSSFileController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
@ResponseBody
@DeleteMapping("/delete")
public Result delete(@RequestParam(name = "id") String id) {
	Result result = new Result();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		boolean ok = ossFileService.delete(file);
		if (ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #4
Source File: SysUploadController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 上传
 * @param request
 */
@PostMapping(value = "/uploadMinio")
public Result<?> uploadMinio(HttpServletRequest request) {
    Result<?> result = new Result<>();
    String bizPath = request.getParameter("biz");
    if(oConvertUtils.isEmpty(bizPath)){
        bizPath = "";
    }
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
    String orgName = file.getOriginalFilename();// 获取文件名
    orgName = CommonUtils.getFileName(orgName);
    String file_url =  MinioUtil.upload(file,bizPath);
    //保存文件信息
    OSSFile minioFile = new OSSFile();
    minioFile.setFileName(orgName);
    minioFile.setUrl(file_url);
    ossFileService.save(minioFile);
    result.setMessage(file_url);
    result.setSuccess(true);
    return result;
}
 
Example #5
Source File: OSSFileController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
@ResponseBody
@DeleteMapping("/delete")
public Result delete(@RequestParam(name = "id") String id) {
	Result result = new Result();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		boolean ok = ossFileService.delete(file);
		if (ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #6
Source File: OSSFileController.java    From teaching with Apache License 2.0 6 votes vote down vote up
@ResponseBody
@DeleteMapping("/delete")
public Result delete(@RequestParam(name = "id") String id) {
	Result result = new Result();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		boolean ok = ossFileService.delete(file);
		if (ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #7
Source File: SysUploadController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 上传
 * @param request
 */
@PostMapping(value = "/uploadMinio")
public Result<?> uploadMinio(HttpServletRequest request) {
    Result<?> result = new Result<>();
    String bizPath = request.getParameter("biz");
    if(oConvertUtils.isEmpty(bizPath)){
        bizPath = "";
    }
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
    String orgName = file.getOriginalFilename();// 获取文件名
    String file_url =  MinioUtil.upload(file,bizPath);
    //保存文件信息
    OSSFile minioFile = new OSSFile();
    minioFile.setFileName(orgName);
    minioFile.setUrl(file_url);
    ossFileService.save(minioFile);
    result.setMessage(file_url);
    result.setSuccess(true);
    return result;
}
 
Example #8
Source File: OSSFileServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public boolean delete(OSSFile ossFile) {
	try {
		this.removeById(ossFile.getId());
		OssBootUtil.deleteUrl(ossFile.getUrl());
	}
	catch (Exception ex) {
		return false;
	}
	return true;
}
 
Example #9
Source File: OSSFileServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	fileName = CommonUtils.getFileName(fileName);
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	String url = OssBootUtil.upload(multipartFile,"upload/test");
	ossFile.setUrl(url);
	this.save(ossFile);
}
 
Example #10
Source File: OSSFileController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 通过id查询.
 */
@ResponseBody
@GetMapping("/queryById")
public Result<OSSFile> queryById(@RequestParam(name = "id") String id) {
	Result<OSSFile> result = new Result<>();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		result.setResult(file);
		result.setSuccess(true);
	}
	return result;
}
 
Example #11
Source File: OSSFileController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@ResponseBody
@GetMapping("/list")
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
		@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	Result<IPage<OSSFile>> result = new Result<>();
	QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
	Page<OSSFile> page = new Page<>(pageNo, pageSize);
	IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #12
Source File: OSSFileServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public boolean delete(OSSFile ossFile) {
	try {
		this.removeById(ossFile.getId());
		OssBootUtil.deleteUrl(ossFile.getUrl());
	}
	catch (Exception ex) {
		return false;
	}
	return true;
}
 
Example #13
Source File: OSSFileServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	String url = OssBootUtil.upload(multipartFile,"upload/test");
	ossFile.setUrl(url);
	this.save(ossFile);
}
 
Example #14
Source File: OSSFileController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 通过id查询.
 */
@ResponseBody
@GetMapping("/queryById")
public Result<OSSFile> queryById(@RequestParam(name = "id") String id) {
	Result<OSSFile> result = new Result<>();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		result.setResult(file);
		result.setSuccess(true);
	}
	return result;
}
 
Example #15
Source File: OSSFileController.java    From teaching with Apache License 2.0 5 votes vote down vote up
@ResponseBody
@GetMapping("/list")
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
		@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	Result<IPage<OSSFile>> result = new Result<>();
	QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
	Page<OSSFile> page = new Page<>(pageNo, pageSize);
	IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #16
Source File: OSSFileServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
public boolean delete(OSSFile ossFile) {
	try {
		this.removeById(ossFile.getId());
		ossManager.delete(ossFile.getFileName());
	}
	catch (Exception ex) {
		return false;
	}
	return true;
}
 
Example #17
Source File: OSSFileServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	ossFile.setUrl("https://" + properties.getBucketName() + "." + properties.getEndpoint() + "/" + fileName);
	this.save(ossFile);
	ossManager.upload(fileName, multipartFile.getInputStream());
}
 
Example #18
Source File: OSSFileController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 通过id查询.
 */
@ResponseBody
@GetMapping("/queryById")
public Result<OSSFile> queryById(@RequestParam(name = "id") String id) {
	Result<OSSFile> result = new Result<>();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		result.setResult(file);
		result.setSuccess(true);
	}
	return result;
}
 
Example #19
Source File: OSSFileController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@ResponseBody
@GetMapping("/list")
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
		@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	Result<IPage<OSSFile>> result = new Result<>();
	QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
	Page<OSSFile> page = new Page<>(pageNo, pageSize);
	IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #20
Source File: OSSFileServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public boolean delete(OSSFile ossFile) {
	try {
		this.removeById(ossFile.getId());
		OssBootUtil.deleteUrl(ossFile.getUrl());
	}
	catch (Exception ex) {
		return false;
	}
	return true;
}
 
Example #21
Source File: OSSFileServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	fileName = CommonUtils.getFileName(fileName);
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	String url = OssBootUtil.upload(multipartFile,"upload/test");
	ossFile.setUrl(url);
	this.save(ossFile);
}
 
Example #22
Source File: OSSFileController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 通过id查询.
 */
@ResponseBody
@GetMapping("/queryById")
public Result<OSSFile> queryById(@RequestParam(name = "id") String id) {
	Result<OSSFile> result = new Result<>();
	OSSFile file = ossFileService.getById(id);
	if (file == null) {
		result.error500("未找到对应实体");
	}
	else {
		result.setResult(file);
		result.setSuccess(true);
	}
	return result;
}
 
Example #23
Source File: OSSFileController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@ResponseBody
@GetMapping("/list")
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
		@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	Result<IPage<OSSFile>> result = new Result<>();
	QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
	Page<OSSFile> page = new Page<>(pageNo, pageSize);
	IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #24
Source File: IOSSFileService.java    From teaching with Apache License 2.0 votes vote down vote up
boolean delete(OSSFile ossFile); 
Example #25
Source File: IOSSFileService.java    From jeecg-boot-with-activiti with MIT License votes vote down vote up
boolean delete(OSSFile ossFile); 
Example #26
Source File: IOSSFileService.java    From jeecg-cloud with Apache License 2.0 votes vote down vote up
boolean delete(OSSFile ossFile); 
Example #27
Source File: IOSSFileService.java    From jeecg-boot with Apache License 2.0 votes vote down vote up
boolean delete(OSSFile ossFile);