package com.ruoyi.mall.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; 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.mall.domain.MallArt; import com.ruoyi.mall.service.IMallArtService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 艺术分类Controller * * @author ruoyi * @date 2023-11-02 */ @RestController @RequestMapping("/mall/mallArt") public class MallArtController extends BaseController { @Autowired private IMallArtService mallArtService; /** * 查询艺术分类列表 */ @PreAuthorize("@ss.hasPermi('mall:mallArt:list')") @GetMapping("/list") public TableDataInfo list(MallArt mallArt) { startPage(); List list = mallArtService.selectMallArtList(mallArt); return getDataTable(list); } /** * 导出艺术分类列表 */ @PreAuthorize("@ss.hasPermi('mall:mallArt:export')") @Log(title = "艺术分类", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, MallArt mallArt) { List list = mallArtService.selectMallArtList(mallArt); ExcelUtil util = new ExcelUtil(MallArt.class); util.exportExcel(response, list, "艺术分类数据"); } /** * 获取艺术分类详细信息 */ @PreAuthorize("@ss.hasPermi('mall:mallArt:query')") @GetMapping(value = "/{artId}") public AjaxResult getInfo(@PathVariable("artId") Long artId) { return AjaxResult.success(mallArtService.selectMallArtByArtId(artId)); } /** * 新增艺术分类 */ @PreAuthorize("@ss.hasPermi('mall:mallArt:add')") @Log(title = "艺术分类", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody MallArt mallArt) { return toAjax(mallArtService.insertMallArt(mallArt)); } /** * 修改艺术分类 */ @PreAuthorize("@ss.hasPermi('mall:mallArt:edit')") @Log(title = "艺术分类", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody MallArt mallArt) { return toAjax(mallArtService.updateMallArt(mallArt)); } /** * 删除艺术分类 */ @PreAuthorize("@ss.hasPermi('mall:mallArt:remove')") @Log(title = "艺术分类", businessType = BusinessType.DELETE) @DeleteMapping("/{artIds}") public AjaxResult remove(@PathVariable Long[] artIds) { return toAjax(mallArtService.deleteMallArtByArtIds(artIds)); } }