PartyNewsController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package com.ruoyi.web.controller.partyNews;
  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.partyNews.PartyNews;
  9. import com.ruoyi.system.service.IPartyNewsService;
  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 2025-02-14
  20. */
  21. @RestController
  22. @RequestMapping("/wuYe/partyNews")
  23. public class PartyNewsController extends BaseController {
  24. @Autowired
  25. private IPartyNewsService partyNewsService;
  26. /**
  27. * 查询党建资讯列表
  28. */
  29. @PreAuthorize("@ss.hasPermi('wuYe:partyNews:list')")
  30. @GetMapping("/list")
  31. public TableDataInfo list(PartyNews partyNews) {
  32. startPage();
  33. List<PartyNews> list = partyNewsService.selectPartyNewsList(partyNews);
  34. return getDataTable(list);
  35. }
  36. /**
  37. * 导出党建资讯列表
  38. */
  39. @PreAuthorize("@ss.hasPermi('wuYe:partyNews:export')")
  40. @Log(title = "党建资讯", businessType = BusinessType.EXPORT)
  41. @PostMapping("/export")
  42. public void export(HttpServletResponse response, PartyNews partyNews) {
  43. List<PartyNews> list = partyNewsService.selectPartyNewsList(partyNews);
  44. ExcelUtil<PartyNews> util = new ExcelUtil<PartyNews>(PartyNews.class);
  45. util.exportExcel(response, list, "党建资讯数据");
  46. }
  47. /**
  48. * 获取党建资讯详细信息
  49. */
  50. @PreAuthorize("@ss.hasPermi('wuYe:partyNews:query')")
  51. @GetMapping(value = "/{partyId}")
  52. public AjaxResult getInfo(@PathVariable("partyId") Long partyId) {
  53. return success(partyNewsService.selectPartyNewsByPartyId(partyId));
  54. }
  55. /**
  56. * 新增党建资讯
  57. */
  58. @PreAuthorize("@ss.hasPermi('wuYe:partyNews:add')")
  59. @Log(title = "党建资讯", businessType = BusinessType.INSERT)
  60. @PostMapping
  61. public AjaxResult add(@RequestBody PartyNews partyNews) {
  62. return toAjax(partyNewsService.insertPartyNews(partyNews));
  63. }
  64. /**
  65. * 修改党建资讯
  66. */
  67. @PreAuthorize("@ss.hasPermi('wuYe:partyNews:edit')")
  68. @Log(title = "党建资讯", businessType = BusinessType.UPDATE)
  69. @PostMapping("/put")
  70. public AjaxResult edit(@RequestBody PartyNews partyNews) {
  71. return toAjax(partyNewsService.updatePartyNews(partyNews));
  72. }
  73. /**
  74. * 批量关闭党建资讯
  75. * @param partyIds
  76. * @return
  77. */
  78. @PreAuthorize("@ss.hasPermi('wuYe:partyNews:remove')")
  79. @Log(title = "党建资讯", businessType = BusinessType.DELETE)
  80. @GetMapping("/delete/{partyIds}")
  81. public AjaxResult remove(@PathVariable Long[] partyIds) {
  82. return toAjax(partyNewsService.deletePartyNewsByPartyIds(partyIds));
  83. }
  84. }