SysNoticeController.java 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package com.emato.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.emato.common.annotation.Log;
  15. import com.emato.common.core.controller.BaseController;
  16. import com.emato.common.core.domain.AjaxResult;
  17. import com.emato.common.core.page.TableDataInfo;
  18. import com.emato.common.enums.BusinessType;
  19. import com.emato.common.utils.SecurityUtils;
  20. import com.emato.system.domain.SysNotice;
  21. import com.emato.system.service.ISysNoticeService;
  22. /**
  23. * 公告 信息操作处理
  24. *
  25. * @author cadmin
  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. notice.setCreateBy(SecurityUtils.getUsername());
  62. return toAjax(noticeService.insertNotice(notice));
  63. }
  64. /**
  65. * 修改通知公告
  66. */
  67. @PreAuthorize("@ss.hasPermi('system:notice:edit')")
  68. @Log(title = "通知公告", businessType = BusinessType.UPDATE)
  69. @PutMapping
  70. public AjaxResult edit(@Validated @RequestBody SysNotice notice)
  71. {
  72. notice.setUpdateBy(SecurityUtils.getUsername());
  73. return toAjax(noticeService.updateNotice(notice));
  74. }
  75. /**
  76. * 删除通知公告
  77. */
  78. @PreAuthorize("@ss.hasPermi('system:notice:remove')")
  79. @Log(title = "通知公告", businessType = BusinessType.DELETE)
  80. @DeleteMapping("/{noticeIds}")
  81. public AjaxResult remove(@PathVariable Long[] noticeIds)
  82. {
  83. return toAjax(noticeService.deleteNoticeByIds(noticeIds));
  84. }
  85. }