wl
2022-11-08 bdb4a481d7ab7085a0832a7f1c0f5295596d498c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.ycl.controller.resources;
 
 
import com.ycl.annotation.LogSave;
import com.ycl.api.CommonResult;
import com.ycl.controller.BaseController;
import com.ycl.entity.resources.ImageResources;
import com.ycl.service.resources.IImageResourcesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lyq
 * @since 2022-11-08
 */
@RestController
@RequestMapping("/image_resources")
@Api(tags = "图片资源管理")
public class ImageResourcesController extends BaseController {
 
    @Autowired
    IImageResourcesService iImageResourcesService;
 
    @GetMapping("/query")
    @ApiOperation("查询")
    public CommonResult search(@RequestParam(required = false) Integer type,
                               @RequestParam(required = false) String startTime,
                               @RequestParam(required = false) String endTime,
                               @RequestParam Long size,
                               @RequestParam Long current) {
        return CommonResult.success(iImageResourcesService.selectImages(type, startTime, endTime, size, current));
    }
 
    @PutMapping("modification")
    @ApiOperation("修改图片")
    @LogSave(operationType = "图片管理",contain = "修改图片")
    public CommonResult modify(@RequestBody ImageResources imageResources) {
        return CommonResult.success(iImageResourcesService.updateById(imageResources));
    }
 
    @DeleteMapping("deletion")
    @ApiOperation("删除")
    @LogSave(operationType = "图片管理",contain = "删除图片")
    public CommonResult delete(@RequestParam Integer id) {
        return CommonResult.success(iImageResourcesService.removeById(id));
    }
 
    @PostMapping("addition")
    @ApiOperation("添加")
    @LogSave(operationType = "图片管理",contain = "添加图片")
    public CommonResult add(@RequestBody ImageResources imageResources) {
        return CommonResult.success(iImageResourcesService.save(imageResources));
    }
 
    @DeleteMapping("deletion_batch")
    @ApiOperation("批量删除")
    @LogSave(operationType = "图片管理",contain = "批量删除图片")
    public CommonResult delete(@RequestParam List<Integer> ids) {
        return CommonResult.success(iImageResourcesService.removeBatchByIds(ids));
    }
 
}