VoteThemeController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.ruoyi.web.controller.vote;
  2. import com.ruoyi.common.annotation.Log;
  3. import com.ruoyi.common.core.controller.BaseController;
  4. import com.ruoyi.common.core.domain.AjaxResult;
  5. import com.ruoyi.common.core.page.TableDataInfo;
  6. import com.ruoyi.common.enums.BusinessType;
  7. import com.ruoyi.common.utils.poi.ExcelUtil;
  8. import com.ruoyi.system.domain.VoteTheme;
  9. import com.ruoyi.system.service.IVoteThemeService;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.web.bind.annotation.*;
  13. import javax.servlet.http.HttpServletResponse;
  14. import java.util.List;
  15. /**
  16. * 投票主题Controller
  17. *
  18. * @author boman
  19. * @date 2024-11-15
  20. */
  21. @RestController
  22. @RequestMapping("/theme")
  23. public class VoteThemeController extends BaseController {
  24. @Autowired
  25. private IVoteThemeService voteThemeService;
  26. /**
  27. * 查询投票主题列表
  28. */
  29. @PreAuthorize("@ss.hasPermi('system:theme:list')")
  30. @GetMapping("/list")
  31. public TableDataInfo list(VoteTheme voteTheme) {
  32. startPage();
  33. List<VoteTheme> list = voteThemeService.selectVoteThemeList(voteTheme);
  34. return getDataTable(list);
  35. }
  36. /**
  37. * 导出投票主题列表
  38. */
  39. @PreAuthorize("@ss.hasPermi('system:theme:export')")
  40. @Log(title = "投票主题", businessType = BusinessType.EXPORT)
  41. @PostMapping("/export")
  42. public void export(HttpServletResponse response, VoteTheme voteTheme) {
  43. List<VoteTheme> list = voteThemeService.selectVoteThemeList(voteTheme);
  44. ExcelUtil<VoteTheme> util = new ExcelUtil<VoteTheme>(VoteTheme.class);
  45. util.exportExcel(response, list, "投票主题数据");
  46. }
  47. /**
  48. * 获取投票主题详细信息
  49. */
  50. @PreAuthorize("@ss.hasPermi('system:theme:query')")
  51. @GetMapping(value = "/{themeId}")
  52. public AjaxResult getInfo(@PathVariable("themeId") Long themeId) {
  53. return success(voteThemeService.selectVoteThemeByThemeId(themeId));
  54. }
  55. /**
  56. * 新增投票主题
  57. */
  58. @PreAuthorize("@ss.hasPermi('system:theme:add')")
  59. @Log(title = "投票主题", businessType = BusinessType.INSERT)
  60. @PostMapping
  61. public AjaxResult add(@RequestBody VoteTheme voteTheme) {
  62. return voteThemeService.insertVoteTheme(voteTheme);
  63. }
  64. /**
  65. * 修改投票主题
  66. */
  67. @PreAuthorize("@ss.hasPermi('system:theme:edit')")
  68. @Log(title = "投票主题", businessType = BusinessType.UPDATE)
  69. @PostMapping("/put")
  70. public AjaxResult edit(@RequestBody VoteTheme voteTheme) {
  71. return toAjax(voteThemeService.updateVoteTheme(voteTheme));
  72. }
  73. /**
  74. * 删除投票主题
  75. */
  76. @PreAuthorize("@ss.hasPermi('system:theme:remove')")
  77. @Log(title = "投票主题", businessType = BusinessType.DELETE)
  78. @GetMapping("/delete/{themeIds}")
  79. public AjaxResult remove(@PathVariable Long[] themeIds) {
  80. return toAjax(voteThemeService.deleteVoteThemeByThemeIds(themeIds));
  81. }
  82. }