package com.ruoyi.web.controller.gallery; import java.util.Arrays; import java.util.List; import com.ruoyi.system.domain.grallery.ZbGalleryImg; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.service.IZbGalleryImgService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.page.TableDataInfo; /** * 【请填写功能名称】Controller * * @author ruoyi * @date 2020-11-20 */ @RestController @RequestMapping("/gallery/img") @RequiredArgsConstructor public class ZbGalleryImgController extends BaseController { private final IZbGalleryImgService zbGalleryImgService; /** * 查询【请填写功能名称】列表 */ @PreAuthorize("@ss.hasPermi('system:img:list')") @GetMapping("/list") public TableDataInfo list(ZbGalleryImg zbGalleryImg) { Page page = startPage(ZbGalleryImg.class); List list = zbGalleryImgService.selectZbGalleryImgList(zbGalleryImg, page); return getDataTable(list, page); } /** * 导出【请填写功能名称】列表 */ @PreAuthorize("@ss.hasPermi('system:img:export')") @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(ZbGalleryImg zbGalleryImg) { Page page = startPage(ZbGalleryImg.class); List list = zbGalleryImgService.selectZbGalleryImgList(zbGalleryImg, page); ExcelUtil util = new ExcelUtil(ZbGalleryImg. class); return util.exportExcel(list, "img"); } /** * 获取【请填写功能名称】详细信息 */ @PreAuthorize("@ss.hasPermi('system:img:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(zbGalleryImgService.getById(id)); } /** * 新增【请填写功能名称】 */ @PreAuthorize("@ss.hasPermi('system:img:add')") @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ZbGalleryImg zbGalleryImg) { return toAjax(zbGalleryImgService.insertZbGalleryImg(zbGalleryImg)); } /** * 修改【请填写功能名称】 */ @PreAuthorize("@ss.hasPermi('system:img:edit')") @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ZbGalleryImg zbGalleryImg) { return toAjax(zbGalleryImgService.updateZbGalleryImg(zbGalleryImg)); } /** * 删除【请填写功能名称】 */ @PreAuthorize("@ss.hasPermi('system:img:remove')") @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { if (ids == null || ids.length == 0) { return AjaxResult.error("参数不正确"); } return toAjax(zbGalleryImgService.removeByIds(Arrays.asList(ids))); } }