SysNoticeController.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package com.ruoyi.web.controller.system;
  2. import java.util.List;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.security.access.prepost.PreAuthorize;
  5. import org.springframework.validation.annotation.Validated;
  6. import org.springframework.web.bind.annotation.DeleteMapping;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PathVariable;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.PutMapping;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import com.ruoyi.common.annotation.Log;
  15. import com.ruoyi.common.core.controller.BaseController;
  16. import com.ruoyi.common.core.domain.AjaxResult;
  17. import com.ruoyi.common.core.page.TableDataInfo;
  18. import com.ruoyi.common.enums.BusinessType;
  19. import com.ruoyi.common.utils.SecurityUtils;
  20. import com.ruoyi.system.domain.SysNotice;
  21. import com.ruoyi.system.service.ISysNoticeService;
  22. /**
  23. * 公告 信息操作处理
  24. *
  25. * @author ruoyi
  26. */
  27. @RestController
  28. @RequestMapping("/system/notice")
  29. public class SysNoticeController extends BaseController
  30. {
  31. @Autowired
  32. private ISysNoticeService noticeService;
  33. /**
  34. * 获取通知公告列表
  35. */
  36. @PreAuthorize("@ss.hasPermi('system:notice:list')")
  37. @GetMapping("/list")
  38. public TableDataInfo list(SysNotice notice)
  39. {
  40. startPage();
  41. List<SysNotice> list = noticeService.selectNoticeList(notice);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 根据通知公告编号获取详细信息
  46. */
  47. @PreAuthorize("@ss.hasPermi('system:notice:query')")
  48. @GetMapping(value = "/{noticeId}")
  49. public AjaxResult getInfo(@PathVariable Long noticeId)
  50. {
  51. return AjaxResult.success(noticeService.selectNoticeById(noticeId));
  52. }
  53. /**
  54. * 新增通知公告
  55. */
  56. @PreAuthorize("@ss.hasPermi('system:notice:add')")
  57. @Log(title = "通知公告", businessType = BusinessType.INSERT)
  58. @PostMapping
  59. public AjaxResult add(@Validated @RequestBody SysNotice notice)
  60. {
  61. return toAjax(noticeService.insertNotice(notice));
  62. }
  63. /**
  64. * 修改通知公告
  65. */
  66. @PreAuthorize("@ss.hasPermi('system:notice:edit')")
  67. @Log(title = "通知公告", businessType = BusinessType.UPDATE)
  68. @PutMapping
  69. public AjaxResult edit(@Validated @RequestBody SysNotice notice)
  70. {
  71. return toAjax(noticeService.updateNotice(notice));
  72. }
  73. /**
  74. * 删除通知公告
  75. */
  76. @PreAuthorize("@ss.hasPermi('system:notice:remove')")
  77. @Log(title = "通知公告", businessType = BusinessType.DELETE)
  78. @DeleteMapping("/{noticeIds}")
  79. public AjaxResult remove(@PathVariable Long[] noticeIds)
  80. {
  81. return toAjax(noticeService.deleteNoticeByIds(noticeIds));
  82. }
  83. }