12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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<VoteTheme> 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<VoteTheme> list = voteThemeService.selectVoteThemeList(voteTheme);
- ExcelUtil<VoteTheme> util = new ExcelUtil<VoteTheme>(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));
- }
- }
|