package com.ruoyi.web.controller.vote; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.VoteTheme; import com.ruoyi.system.service.IVoteThemeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 投票主题Controller * * @author boman * @date 2024-11-15 */ @RestController @RequestMapping("/theme") public class VoteThemeController extends BaseController { @Autowired private IVoteThemeService voteThemeService; /** * 查询投票主题列表 */ @PreAuthorize("@ss.hasPermi('system:theme:list')") @GetMapping("/list") public TableDataInfo list(VoteTheme voteTheme) { startPage(); List list = voteThemeService.selectVoteThemeList(voteTheme); return getDataTable(list); } /** * 导出投票主题列表 */ @PreAuthorize("@ss.hasPermi('system:theme:export')") @Log(title = "投票主题", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, VoteTheme voteTheme) { List list = voteThemeService.selectVoteThemeList(voteTheme); ExcelUtil util = new ExcelUtil(VoteTheme.class); util.exportExcel(response, list, "投票主题数据"); } /** * 获取投票主题详细信息 */ @PreAuthorize("@ss.hasPermi('system:theme:query')") @GetMapping(value = "/{themeId}") public AjaxResult getInfo(@PathVariable("themeId") Long themeId) { return success(voteThemeService.selectVoteThemeByThemeId(themeId)); } /** * 新增投票主题 */ @PreAuthorize("@ss.hasPermi('system:theme:add')") @Log(title = "投票主题", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody VoteTheme voteTheme) { return voteThemeService.insertVoteTheme(voteTheme); } /** * 修改投票主题 */ @PreAuthorize("@ss.hasPermi('system:theme:edit')") @Log(title = "投票主题", businessType = BusinessType.UPDATE) @PostMapping("/put") public AjaxResult edit(@RequestBody VoteTheme voteTheme) { return toAjax(voteThemeService.updateVoteTheme(voteTheme)); } /** * 删除投票主题 */ @PreAuthorize("@ss.hasPermi('system:theme:remove')") @Log(title = "投票主题", businessType = BusinessType.DELETE) @GetMapping("/delete/{themeIds}") public AjaxResult remove(@PathVariable Long[] themeIds) { return toAjax(voteThemeService.deleteVoteThemeByThemeIds(themeIds)); } }