|
@@ -80,37 +80,10 @@ public class PhotosServiceImpl implements PhotosService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// @Override
|
|
|
-// public void savePhotos(MultipartFile file, Integer groupId) {
|
|
|
-// // 1. 确保文件不为空且是压缩文件
|
|
|
-// if (file == null || !file.getOriginalFilename().endsWith(".zip")) {
|
|
|
-// throw new IllegalArgumentException("上传的文件必须是一个压缩包");
|
|
|
-// }
|
|
|
-//
|
|
|
-// try {
|
|
|
-// // 2. 创建临时目录来存储解压的文件
|
|
|
-// File tempDir = Files.createTempDirectory("photos").toFile();
|
|
|
-// ZipInputStream zis = new ZipInputStream(file.getInputStream());
|
|
|
-// ZipEntry zipEntry;
|
|
|
-//
|
|
|
-// while ((zipEntry = zis.getNextEntry()) != null) {
|
|
|
-// // 3. 读取文件内容并保存
|
|
|
-// byte[] content = zis.readAllBytes();
|
|
|
-// String photoUrl = createFile(tempDir.getAbsolutePath() + "/" + zipEntry.getName(), content);
|
|
|
-//
|
|
|
-// // 4. 保存照片信息到数据库
|
|
|
-// PhotosDO photo = new PhotosDO();
|
|
|
-// photo.setGroupId(groupId); // 设置照片组ID
|
|
|
-// photo.setPhotoUrl(photoUrl); // 设置照片URL
|
|
|
-// photosMapper.insert(photo); // 假设你有这个 Mapper
|
|
|
-// zis.closeEntry();
|
|
|
-// }
|
|
|
-//
|
|
|
-// zis.close();
|
|
|
-//
|
|
|
-// } catch (IOException e) {
|
|
|
-// throw new RuntimeException("处理上传文件时发生错误", e);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public List<PhotosDO> getPhotosByGroupId(Integer groupId) {
|
|
|
+ return photosMapper.selectByGroupId(groupId);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|