feat: 开发中...

This commit is contained in:
2023-04-06 09:18:12 +08:00
parent b5eb9b468e
commit f8d2c94586
8 changed files with 81 additions and 37 deletions

View File

@@ -24,8 +24,8 @@ public class AttachEntity {
private Long id;
@Setter
@Column(name = "name", nullable = false)
private String name;
@Column(name = "filename", nullable = false)
private String filename;
@Setter
@Column(name = "content_type", nullable = false)

View File

@@ -50,7 +50,7 @@ public class AttachService implements IAttachService {
}
log.info("prepare to save file: {}({} bytes)", file.getOriginalFilename(), file.getSize());
AttachEntity attachEntity = new AttachEntity();
attachEntity.setName(file.getOriginalFilename());
attachEntity.setFilename(file.getOriginalFilename());
attachEntity.setContentType(file.getContentType());
attachEntity.setData(file.getBytes());
attachEntity = attachRepo.save(attachEntity);
@@ -91,7 +91,7 @@ public class AttachService implements IAttachService {
return ResponseEntity
.ok()
.header("Cache-Control", "no-cache, no-store, must-revalidate")
.header("Content-Disposition", String.format("attachment; filename=\"%s\"", entity.getName()))
.header("Content-Disposition", String.format("attachment; filename=\"%s\"", entity.getFilename()))
.header("Pragma", "no-cache")
.header("Expires", "0")
.contentLength(localCacheFile.length())

View File

@@ -15,6 +15,10 @@ public class AttachInfoResponseVO {
@NotNull
private Long id;
@NotNull
private String filename;
@NotNull
private String contentType;
@NotNull
private UserInfoResponseVO creator;
@NotNull
private UserInfoResponseVO updater;