package com.ruoyi.system.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.system.domain.SiteDelivery; 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.domain.AdvImg; import com.ruoyi.system.service.IAdvImgService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 广告配置Controller * * @author ruoyi * @date 2025-05-26 */ @RestController @RequestMapping("/system/AdvImg") public class AdvImgController extends BaseController { @Autowired private IAdvImgService advImgService; /** * 查询广告配置列表 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:list')") @GetMapping("/list") public TableDataInfo list(AdvImg advImg) { startPage(); List list = advImgService.selectAdvImgList(advImg); return getDataTable(list); } /** * 导出广告配置列表 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:export')") @Log(title = "广告配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, AdvImg advImg) { List list = advImgService.selectAdvImgList(advImg); ExcelUtil util = new ExcelUtil(AdvImg.class); util.exportExcel(response, list, "广告配置数据"); } /** * 获取广告配置详细信息 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(advImgService.selectAdvImgById(id)); } /** * 新增广告配置 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:add')") @Log(title = "广告配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody AdvImg advImg) { return toAjax(advImgService.insertAdvImg(advImg)); } /** * 修改广告配置 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:edit')") @Log(title = "广告配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody AdvImg advImg) { return toAjax(advImgService.updateAdvImg(advImg)); } /** * 定时任务状态修改 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:changeStatus')") @Log(title = "修改状态", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody AdvImg advImg) { AdvImg newAdvImg = advImgService.selectAdvImgById(advImg.getId()); newAdvImg.setStatus(advImg.getStatus()); return toAjax(advImgService.updateAdvImg(newAdvImg)); } /** * 删除广告配置 */ @PreAuthorize("@ss.hasPermi('system:AdvImg:remove')") @Log(title = "广告配置", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(advImgService.deleteAdvImgByIds(ids)); } }