yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package com.qianwen.smartman.modules.system.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.mp.support.Condition;
import com.qianwen.core.mp.support.Query;
import com.qianwen.core.scanner.modular.annotation.DeleteResource;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.system.convert.GalleryItemConvert;
import com.qianwen.smartman.modules.system.dto.GalleryItemDTO;
import com.qianwen.smartman.modules.system.entity.GalleryItem;
import com.qianwen.smartman.modules.system.service.IGalleryItemService;
import com.qianwen.smartman.modules.system.vo.GalleryItemVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
 
@Api(value = "图库图片管理", tags = {"图库图片管理"})
@ApiResource({"blade-system/gallery-item"})
@RestController
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/controller/GalleryItemController.class */
public class GalleryItemController extends BladeController {
    private IGalleryItemService galleryItemService;
 
    public GalleryItemController(final IGalleryItemService galleryItemService) {
        this.galleryItemService = galleryItemService;
    }
 
    @ApiOperationSupport(order = 1)
    @GetResource({"/get/{id}"})
    @ApiOperation(value = "图库图片详情", notes = "传入galleryItem")
    public R<GalleryItemVO> detail(@PathVariable String id) {
        GalleryItem galleryItem = (GalleryItem) this.galleryItemService.getById(id);
        return R.data(GalleryItemConvert.INSTANCE.convert(galleryItem));
    }
 
    @ApiOperationSupport(order = 2)
    @ApiImplicitParams({@ApiImplicitParam(name = "galleryId", value = "图库图片类别ID", paramType = "query", dataType = "string")})
    @GetResource({"/list"})
    @ApiOperation(value = "图库图片列表", notes = "传入map")
    public R<List<GalleryItemVO>> list(@RequestParam @ApiIgnore Map<String, Object> params) {
        List<GalleryItem> list = this.galleryItemService.list(Condition.getQueryWrapper(params, GalleryItem.class));
        return R.data(GalleryItemConvert.INSTANCE.convert(list));
    }
 
    @ApiOperationSupport(order = 2)
    @GetResource({"/count"})
    @ApiOperation(value = "图库图片统计值", notes = "传入map")
    public R<Long> count(@RequestParam @ApiIgnore Map<String, Object> params) {
        Long count = Long.valueOf(this.galleryItemService.count(Condition.getQueryWrapper(params, GalleryItem.class)));
        return R.data(count);
    }
 
    @ApiOperationSupport(order = 3)
    @ApiImplicitParams({@ApiImplicitParam(name = "galleryId", value = "图库图片类别ID", paramType = "query", dataType = "string")})
    @GetResource({"/page"})
    @ApiOperation(value = "图库图片分页", notes = "传入map")
    public R<IPage<GalleryItemVO>> page(@RequestParam @ApiIgnore Map<String, Object> params, Query query) {
        IPage<GalleryItem> pages = this.galleryItemService.page(Condition.getPage(query), Condition.getQueryWrapper(params, GalleryItem.class));
        return R.data(GalleryItemConvert.INSTANCE.convert(pages));
    }
 
    @ApiOperationSupport(order = 4)
    @PostResource({"/insert"})
    @ApiOperation(value = "图库图片新增", notes = "传入galleryItemVO")
    public R<GalleryItemVO> insert(@RequestParam("file") MultipartFile file, GalleryItemDTO galleryItemDTO) throws IOException {
        GalleryItem galleryItem = this.galleryItemService.save(file, galleryItemDTO);
        return R.data(GalleryItemConvert.INSTANCE.convert(galleryItem));
    }
 
    @ApiOperationSupport(order = 6)
    @DeleteResource({"/remove"})
    @ApiOperation(value = "图库图片删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键", required = true) @RequestBody List<String> ids) {
        if (ids.isEmpty()) {
            return R.status(false);
        }
        return R.status(this.galleryItemService.remove(ids));
    }
}