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));
|
}
|
}
|