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.MallPosterSetting; import com.ruoyi.mall.service.IMallPosterSettingService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 海报背景图Controller * * @author ruoyi * @date 2023-11-07 */ @RestController @RequestMapping("/mall/mallPosterSetting") public class MallPosterSettingController extends BaseController { @Autowired private IMallPosterSettingService mallPosterSettingService; /** * 查询海报背景图列表 */ @PreAuthorize("@ss.hasPermi('mall:mallPosterSetting:list')") @GetMapping("/list") public TableDataInfo list(MallPosterSetting mallPosterSetting) { startPage(); List list = mallPosterSettingService.selectMallPosterSettingList(mallPosterSetting); return getDataTable(list); } /** * 导出海报背景图列表 */ @PreAuthorize("@ss.hasPermi('mall:mallPosterSetting:export')") @Log(title = "海报背景图", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, MallPosterSetting mallPosterSetting) { List list = mallPosterSettingService.selectMallPosterSettingList(mallPosterSetting); ExcelUtil util = new ExcelUtil(MallPosterSetting.class); util.exportExcel(response, list, "海报背景图数据"); } /** * 获取海报背景图详细信息 */ @PreAuthorize("@ss.hasPermi('mall:mallPosterSetting:query')") @GetMapping(value = "/{posterId}") public AjaxResult getInfo(@PathVariable("posterId") Integer posterId) { return AjaxResult.success(mallPosterSettingService.selectMallPosterSettingByPosterId(posterId)); } /** * 新增海报背景图 */ @PreAuthorize("@ss.hasPermi('mall:mallPosterSetting:add')") @Log(title = "海报背景图", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody MallPosterSetting mallPosterSetting) { return toAjax(mallPosterSettingService.insertMallPosterSetting(mallPosterSetting)); } /** * 修改海报背景图 */ @PreAuthorize("@ss.hasPermi('mall:mallPosterSetting:edit')") @Log(title = "海报背景图", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody MallPosterSetting mallPosterSetting) { return toAjax(mallPosterSettingService.updateMallPosterSetting(mallPosterSetting)); } /** * 删除海报背景图 */ @PreAuthorize("@ss.hasPermi('mall:mallPosterSetting:remove')") @Log(title = "海报背景图", businessType = BusinessType.DELETE) @DeleteMapping("/{posterIds}") public AjaxResult remove(@PathVariable Integer[] posterIds) { return toAjax(mallPosterSettingService.deleteMallPosterSettingByPosterIds(posterIds)); } }