TNoticeMessageController.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package com.ruoyi.web.pcApi.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import org.springframework.security.access.prepost.PreAuthorize;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.PutMapping;
  9. import org.springframework.web.bind.annotation.DeleteMapping;
  10. import org.springframework.web.bind.annotation.PathVariable;
  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.enums.BusinessType;
  18. import com.ruoyi.web.pcApi.domain.TNoticeMessage;
  19. import com.ruoyi.web.pcApi.service.ITNoticeMessageService;
  20. import com.ruoyi.common.utils.poi.ExcelUtil;
  21. import com.ruoyi.common.core.page.TableDataInfo;
  22. /**
  23. * 通知消息Controller
  24. *
  25. * @author ruoyi
  26. * @date 2022-08-24
  27. */
  28. @RestController
  29. @RequestMapping("/noticeMessage/noticeMessage")
  30. public class TNoticeMessageController extends BaseController
  31. {
  32. @Autowired
  33. private ITNoticeMessageService tNoticeMessageService;
  34. /**
  35. * 查询通知消息列表
  36. */
  37. @PreAuthorize("@ss.hasPermi('noticeMessage:noticeMessage:list')")
  38. @GetMapping("/list")
  39. public TableDataInfo list(TNoticeMessage tNoticeMessage)
  40. {
  41. startPage();
  42. List<TNoticeMessage> list = tNoticeMessageService.selectTNoticeMessageList(tNoticeMessage);
  43. return getDataTable(list);
  44. }
  45. /**
  46. * 导出通知消息列表
  47. */
  48. @PreAuthorize("@ss.hasPermi('noticeMessage:noticeMessage:export')")
  49. @Log(title = "通知消息", businessType = BusinessType.EXPORT)
  50. @PostMapping("/export")
  51. public void export(HttpServletResponse response, TNoticeMessage tNoticeMessage)
  52. {
  53. List<TNoticeMessage> list = tNoticeMessageService.selectTNoticeMessageList(tNoticeMessage);
  54. ExcelUtil<TNoticeMessage> util = new ExcelUtil<TNoticeMessage>(TNoticeMessage.class);
  55. util.exportExcel(response, list, "通知消息数据");
  56. }
  57. /**
  58. * 获取通知消息详细信息
  59. */
  60. @PreAuthorize("@ss.hasPermi('noticeMessage:noticeMessage:query')")
  61. @GetMapping(value = "/{id}")
  62. public AjaxResult getInfo(@PathVariable("id") Long id)
  63. {
  64. return AjaxResult.success(tNoticeMessageService.selectTNoticeMessageById(id));
  65. }
  66. /**
  67. * 新增通知消息
  68. */
  69. @PreAuthorize("@ss.hasPermi('noticeMessage:noticeMessage:add')")
  70. @Log(title = "通知消息", businessType = BusinessType.INSERT)
  71. @PostMapping
  72. public AjaxResult add(@RequestBody TNoticeMessage tNoticeMessage)
  73. {
  74. tNoticeMessage.setDeptId(getDeptId());
  75. tNoticeMessage.setCreateBy(getUsername());
  76. return toAjax(tNoticeMessageService.insertTNoticeMessage(tNoticeMessage));
  77. }
  78. /**
  79. * 修改通知消息
  80. */
  81. @PreAuthorize("@ss.hasPermi('noticeMessage:noticeMessage:edit')")
  82. @Log(title = "通知消息", businessType = BusinessType.UPDATE)
  83. @PutMapping
  84. public AjaxResult edit(@RequestBody TNoticeMessage tNoticeMessage)
  85. {
  86. tNoticeMessage.setUpdateBy(getUsername());
  87. return toAjax(tNoticeMessageService.updateTNoticeMessage(tNoticeMessage));
  88. }
  89. /**
  90. * 删除通知消息
  91. */
  92. @PreAuthorize("@ss.hasPermi('noticeMessage:noticeMessage:remove')")
  93. @Log(title = "通知消息", businessType = BusinessType.DELETE)
  94. @DeleteMapping("/{ids}")
  95. public AjaxResult remove(@PathVariable Long[] ids)
  96. {
  97. return toAjax(tNoticeMessageService.deleteTNoticeMessageByIds(ids));
  98. }
  99. }