ZbGalleryImgController.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package com.ruoyi.web.controller.gallery;
  2. import java.util.Arrays;
  3. import java.util.List;
  4. import com.ruoyi.system.domain.grallery.ZbGalleryImg;
  5. import lombok.RequiredArgsConstructor;
  6. import org.springframework.security.access.prepost.PreAuthorize;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.PutMapping;
  11. import org.springframework.web.bind.annotation.DeleteMapping;
  12. import org.springframework.web.bind.annotation.PathVariable;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. import com.ruoyi.common.annotation.Log;
  17. import com.ruoyi.common.core.controller.BaseController;
  18. import com.ruoyi.common.core.domain.AjaxResult;
  19. import com.ruoyi.common.enums.BusinessType;
  20. import com.ruoyi.system.service.IZbGalleryImgService;
  21. import com.ruoyi.common.utils.poi.ExcelUtil;
  22. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * 【请填写功能名称】Controller
  26. *
  27. * @author ruoyi
  28. * @date 2020-11-20
  29. */
  30. @RestController
  31. @RequestMapping("/gallery/img")
  32. @RequiredArgsConstructor
  33. public class ZbGalleryImgController extends BaseController {
  34. private final IZbGalleryImgService zbGalleryImgService;
  35. /**
  36. * 查询【请填写功能名称】列表
  37. */
  38. @PreAuthorize("@ss.hasPermi('system:img:list')")
  39. @GetMapping("/list")
  40. public TableDataInfo list(ZbGalleryImg zbGalleryImg) {
  41. Page<ZbGalleryImg> page = startPage(ZbGalleryImg.class);
  42. List<ZbGalleryImg> list = zbGalleryImgService.selectZbGalleryImgList(zbGalleryImg, page);
  43. return getDataTable(list, page);
  44. }
  45. /**
  46. * 导出【请填写功能名称】列表
  47. */
  48. @PreAuthorize("@ss.hasPermi('system:img:export')")
  49. @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
  50. @GetMapping("/export")
  51. public AjaxResult export(ZbGalleryImg zbGalleryImg) {
  52. Page<ZbGalleryImg> page = startPage(ZbGalleryImg.class);
  53. List<ZbGalleryImg> list = zbGalleryImgService.selectZbGalleryImgList(zbGalleryImg, page);
  54. ExcelUtil<ZbGalleryImg> util = new ExcelUtil<ZbGalleryImg>(ZbGalleryImg. class);
  55. return util.exportExcel(list, "img");
  56. }
  57. /**
  58. * 获取【请填写功能名称】详细信息
  59. */
  60. @PreAuthorize("@ss.hasPermi('system:img:query')")
  61. @GetMapping(value = "/{id}")
  62. public AjaxResult getInfo(@PathVariable("id") Long id) {
  63. return AjaxResult.success(zbGalleryImgService.getById(id));
  64. }
  65. /**
  66. * 新增【请填写功能名称】
  67. */
  68. @PreAuthorize("@ss.hasPermi('system:img:add')")
  69. @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
  70. @PostMapping
  71. public AjaxResult add(@RequestBody ZbGalleryImg zbGalleryImg) {
  72. return toAjax(zbGalleryImgService.insertZbGalleryImg(zbGalleryImg));
  73. }
  74. /**
  75. * 修改【请填写功能名称】
  76. */
  77. @PreAuthorize("@ss.hasPermi('system:img:edit')")
  78. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  79. @PutMapping
  80. public AjaxResult edit(@RequestBody ZbGalleryImg zbGalleryImg) {
  81. return toAjax(zbGalleryImgService.updateZbGalleryImg(zbGalleryImg));
  82. }
  83. /**
  84. * 删除【请填写功能名称】
  85. */
  86. @PreAuthorize("@ss.hasPermi('system:img:remove')")
  87. @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
  88. @DeleteMapping("/{ids}")
  89. public AjaxResult remove(@PathVariable Long[] ids) {
  90. if (ids == null || ids.length == 0) {
  91. return AjaxResult.error("参数不正确");
  92. }
  93. return toAjax(zbGalleryImgService.removeByIds(Arrays.asList(ids)));
  94. }
  95. }