|
@@ -11,6 +11,7 @@ import com.jkcredit.sysnews.resource.web.photo.fb.PhotoQueryFB;
|
|
|
import com.jkcredit.sysnews.service.photo.PhotoService;
|
|
|
import com.jkcredit.sysnews.spi.lang.exception.ServiceException;
|
|
|
import com.jkcredit.sysnews.spi.web.data.ResponseData;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -31,6 +32,7 @@ public class PhotoResource extends WebResource {
|
|
|
|
|
|
@PostMapping("/upload")
|
|
|
@PreAuthorize("hasPermission('photo','upload')")
|
|
|
+ @ApiOperation(value = "上传图片")
|
|
|
public ResponseData upload(@RequestParam("photo") MultipartFile photo) {
|
|
|
if (photo == null) {
|
|
|
return ResponseData.failed("上传失败,图片不能为空!");
|
|
@@ -45,6 +47,7 @@ public class PhotoResource extends WebResource {
|
|
|
|
|
|
@GetMapping("/page/photos")
|
|
|
@PreAuthorize("hasPermission('photo','read')")
|
|
|
+ @ApiOperation(value = "获取图片列表")
|
|
|
public ResponseData getPhotos(Page page, PhotoQueryFB queryFB) {
|
|
|
try {
|
|
|
PhotoDto photoDto = mapper.map(queryFB, PhotoDto.class);
|
|
@@ -57,6 +60,7 @@ public class PhotoResource extends WebResource {
|
|
|
|
|
|
@GetMapping("/photo/{id}")
|
|
|
@PreAuthorize("hasPermission('photo','read')")
|
|
|
+ @ApiOperation(value = "根据id获取图片信息")
|
|
|
public ResponseData getPhotoById(@PathVariable("id") Long id) {
|
|
|
try {
|
|
|
PhotoVo photoVo = photoService.getPhotoById(id);
|
|
@@ -68,6 +72,7 @@ public class PhotoResource extends WebResource {
|
|
|
|
|
|
@PostMapping("/photo")
|
|
|
@PreAuthorize("hasPermission('photo','edit')")
|
|
|
+ @ApiOperation(value = "新增图片信息")
|
|
|
public ResponseData savePhoto(PhotoFB photoFB) {
|
|
|
try {
|
|
|
validate(photoFB);
|
|
@@ -84,6 +89,7 @@ public class PhotoResource extends WebResource {
|
|
|
|
|
|
@PutMapping("/photo")
|
|
|
@PreAuthorize("hasPermission('photo','edit')")
|
|
|
+ @ApiOperation(value = "编辑图片信息")
|
|
|
public ResponseData updatePhoto(PhotoEditFB photoFB) {
|
|
|
try {
|
|
|
validate(photoFB);
|
|
@@ -98,6 +104,7 @@ public class PhotoResource extends WebResource {
|
|
|
|
|
|
@PutMapping("/photo/{id}")
|
|
|
@PreAuthorize("hasPermission('photo','edit')")
|
|
|
+ @ApiOperation(value = "删除图片信息")
|
|
|
public ResponseData deletePhoto(@PathVariable("id") Long id) {
|
|
|
try {
|
|
|
photoService.deletePhoto(id);
|