|
|
|
|
@ -1,14 +1,18 @@
|
|
|
|
|
package com.aurora.controller;
|
|
|
|
|
|
|
|
|
|
import com.aurora.annotation.OptLog;
|
|
|
|
|
import com.aurora.enums.FilePathEnum;
|
|
|
|
|
import com.aurora.model.dto.PhotoAdminDTO;
|
|
|
|
|
import com.aurora.model.dto.PhotoDTO;
|
|
|
|
|
import com.aurora.service.PhotoService;
|
|
|
|
|
import com.aurora.model.vo.*;
|
|
|
|
|
import com.aurora.strategy.context.UploadStrategyContext;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@ -26,6 +30,16 @@ public class PhotoController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private PhotoService photoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private UploadStrategyContext uploadStrategyContext;
|
|
|
|
|
|
|
|
|
|
@OptLog(optType = UPLOAD)
|
|
|
|
|
@ApiOperation(value = "上传照片")
|
|
|
|
|
@ApiImplicitParam(name = "file", value = "照片", required = true, dataType = "MultipartFile")
|
|
|
|
|
@PostMapping("/admin/photos/upload")
|
|
|
|
|
public Result<String> savePhotoAlbumCover(MultipartFile file) {
|
|
|
|
|
return Result.ok(uploadStrategyContext.executeUploadStrategy(file, FilePathEnum.PHOTO.getPath()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "根据相册id获取照片列表")
|
|
|
|
|
@GetMapping("/admin/photos")
|
|
|
|
|
@ -33,7 +47,6 @@ public class PhotoController {
|
|
|
|
|
return Result.ok(photoService.listPhotos(conditionVO));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@OptLog(optType = UPDATE)
|
|
|
|
|
@ApiOperation(value = "更新照片信息")
|
|
|
|
|
@PutMapping("/admin/photos")
|
|
|
|
|
@ -50,7 +63,6 @@ public class PhotoController {
|
|
|
|
|
return Result.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@OptLog(optType = UPDATE)
|
|
|
|
|
@ApiOperation(value = "移动照片相册")
|
|
|
|
|
@PutMapping("/admin/photos/album")
|
|
|
|
|
@ -70,8 +82,8 @@ public class PhotoController {
|
|
|
|
|
@OptLog(optType = DELETE)
|
|
|
|
|
@ApiOperation(value = "删除照片")
|
|
|
|
|
@DeleteMapping("/admin/photos")
|
|
|
|
|
public Result<?> deletePhotos(@RequestBody List<Integer> photoIdList) {
|
|
|
|
|
photoService.deletePhotos(photoIdList);
|
|
|
|
|
public Result<?> deletePhotos(@RequestBody List<Integer> photoIds) {
|
|
|
|
|
photoService.deletePhotos(photoIds);
|
|
|
|
|
return Result.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|