PoNewsFileController.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package com.ruoyi.web.controller.system;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import io.swagger.annotations.ApiOperation;
  5. import org.springframework.security.access.prepost.PreAuthorize;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.PutMapping;
  10. import org.springframework.web.bind.annotation.DeleteMapping;
  11. import org.springframework.web.bind.annotation.PathVariable;
  12. import org.springframework.web.bind.annotation.RequestBody;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import com.ruoyi.common.annotation.Log;
  16. import com.ruoyi.common.core.controller.BaseController;
  17. import com.ruoyi.common.core.domain.AjaxResult;
  18. import com.ruoyi.common.enums.BusinessType;
  19. import com.ruoyi.system.domain.PoNewsFile;
  20. import com.ruoyi.system.service.IPoNewsFileService;
  21. import com.ruoyi.common.utils.poi.ExcelUtil;
  22. import com.ruoyi.common.core.page.TableDataInfo;
  23. /**
  24. * 信息文件Controller
  25. * @date 2023-01-25
  26. */
  27. @RestController
  28. @RequestMapping("/system/file")
  29. public class PoNewsFileController extends BaseController
  30. {
  31. @Autowired
  32. private IPoNewsFileService poNewsFileService;
  33. /**
  34. * 查询信息文件列表
  35. */
  36. @ApiOperation("查询信息文件列表")
  37. @PreAuthorize("@ss.hasPermi('system:file:list')")
  38. @GetMapping("/list")
  39. public TableDataInfo list(PoNewsFile poNewsFile)
  40. {
  41. startPage();
  42. List<PoNewsFile> list = poNewsFileService.selectPoNewsFileList(poNewsFile);
  43. return getDataTable(list);
  44. }
  45. /**
  46. * 导出信息文件列表
  47. */
  48. @ApiOperation("导出信息文件列表")
  49. @PreAuthorize("@ss.hasPermi('system:file:export')")
  50. @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
  51. @PostMapping("/export")
  52. public void export(HttpServletResponse response, PoNewsFile poNewsFile)
  53. {
  54. List<PoNewsFile> list = poNewsFileService.selectPoNewsFileList(poNewsFile);
  55. ExcelUtil<PoNewsFile> util = new ExcelUtil<PoNewsFile>(PoNewsFile.class);
  56. util.exportExcel(response, list, "信息文件数据");
  57. }
  58. /**
  59. * 获取信息文件详细信息
  60. */
  61. @ApiOperation("获取信息文件详细信息")
  62. @PreAuthorize("@ss.hasPermi('system:file:query')")
  63. @GetMapping(value = "/{fileId}")
  64. public AjaxResult getInfo(@PathVariable("fileId") Long fileId)
  65. {
  66. return success(poNewsFileService.selectPoNewsFileByFileId(fileId));
  67. }
  68. /**
  69. * 新增信息文件
  70. */
  71. @ApiOperation("新增信息文件")
  72. @PreAuthorize("@ss.hasPermi('system:file:add')")
  73. @Log(title = "信息文件", businessType = BusinessType.INSERT)
  74. @PostMapping
  75. public AjaxResult add(@RequestBody PoNewsFile poNewsFile)
  76. {
  77. return toAjax(poNewsFileService.insertPoNewsFile(poNewsFile));
  78. }
  79. /**
  80. * 修改信息文件
  81. */
  82. @ApiOperation("修改信息文件")
  83. @PreAuthorize("@ss.hasPermi('system:file:edit')")
  84. @Log(title = "信息文件", businessType = BusinessType.UPDATE)
  85. @PutMapping
  86. public AjaxResult edit(@RequestBody PoNewsFile poNewsFile)
  87. {
  88. return toAjax(poNewsFileService.updatePoNewsFile(poNewsFile));
  89. }
  90. /**
  91. * 删除信息文件
  92. */
  93. @ApiOperation("删除信息文件")
  94. @PreAuthorize("@ss.hasPermi('system:file:remove')")
  95. @Log(title = "信息文件", businessType = BusinessType.DELETE)
  96. @DeleteMapping("/{fileIds}")
  97. public AjaxResult remove(@PathVariable Long[] fileIds)
  98. {
  99. return toAjax(poNewsFileService.deletePoNewsFileByFileIds(fileIds));
  100. }
  101. }