PostCollectionsSystemController.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. package com.ruoyi.web.controller.system;
  2. import java.util.Date;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import com.ruoyi.common.utils.DateUtils;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.security.access.prepost.PreAuthorize;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import com.ruoyi.common.annotation.Log;
  12. import com.ruoyi.common.core.controller.BaseController;
  13. import com.ruoyi.common.core.domain.AjaxResult;
  14. import com.ruoyi.common.enums.BusinessType;
  15. import com.ruoyi.system.domain.PostCollectionsSystem;
  16. import com.ruoyi.system.service.IPostCollectionsSystemService;
  17. import com.ruoyi.common.utils.poi.ExcelUtil;
  18. import com.ruoyi.common.core.page.TableDataInfo;
  19. /**
  20. * 藏品套系Controller
  21. *
  22. * @author ruoyi
  23. * @date 2023-02-15
  24. */
  25. @Api(tags = "PostCollectionsSystemController",description = "藏品套系")
  26. @RestController
  27. @RequestMapping("/system/system")
  28. public class PostCollectionsSystemController extends BaseController
  29. {
  30. @Autowired
  31. private IPostCollectionsSystemService postCollectionsSystemService;
  32. /**
  33. * 查询藏品套系列表
  34. */
  35. @ApiOperation("查询藏品套系列表")
  36. @PreAuthorize("@ss.hasPermi('system:system:list')")
  37. @GetMapping("/list")
  38. public TableDataInfo list(PostCollectionsSystem postCollectionsSystem)
  39. {
  40. startPage();
  41. List<PostCollectionsSystem> list = postCollectionsSystemService.selectPostCollectionsSystemList(postCollectionsSystem);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 导出藏品套系列表
  46. */
  47. @ApiOperation("导入藏品套系列表")
  48. @PreAuthorize("@ss.hasPermi('system:system:export')")
  49. @Log(title = "藏品套系", businessType = BusinessType.EXPORT)
  50. @PostMapping("/export")
  51. public void export(HttpServletResponse response, PostCollectionsSystem postCollectionsSystem)
  52. {
  53. List<PostCollectionsSystem> list = postCollectionsSystemService.selectPostCollectionsSystemList(postCollectionsSystem);
  54. ExcelUtil<PostCollectionsSystem> util = new ExcelUtil<PostCollectionsSystem>(PostCollectionsSystem.class);
  55. util.exportExcel(response, list, "藏品套系数据");
  56. }
  57. /**
  58. * 获取藏品套系详细信息
  59. */
  60. @ApiOperation("获取藏品套系详细信息")
  61. @PreAuthorize("@ss.hasPermi('system:system:query')")
  62. @GetMapping(value = "/{id}")
  63. public AjaxResult getInfo(@PathVariable("id") Long id)
  64. {
  65. return success(postCollectionsSystemService.selectPostCollectionsSystemById(id));
  66. }
  67. /**
  68. * 新增藏品套系
  69. */
  70. @ApiOperation("新增藏品套系")
  71. @PreAuthorize("@ss.hasPermi('system:system:add')")
  72. @Log(title = "藏品套系", businessType = BusinessType.INSERT)
  73. @PostMapping
  74. public AjaxResult add(@RequestBody PostCollectionsSystem postCollectionsSystem)
  75. {
  76. if (!getUsername().equals("admin")){
  77. return error("仅管理员拥有该权限");
  78. }
  79. //补充字段
  80. postCollectionsSystem.setCreateBy(getUsername());
  81. postCollectionsSystem.setCreateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
  82. postCollectionsSystem.setUpdateBy(getUsername());
  83. postCollectionsSystem.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
  84. return toAjax(postCollectionsSystemService.insertPostCollectionsSystem(postCollectionsSystem));
  85. }
  86. /**
  87. * 修改藏品套系
  88. */
  89. @ApiOperation("修改藏品套系")
  90. @PreAuthorize("@ss.hasPermi('system:system:edit')")
  91. @Log(title = "藏品套系", businessType = BusinessType.UPDATE)
  92. @PutMapping
  93. public AjaxResult edit(@RequestBody PostCollectionsSystem postCollectionsSystem)
  94. {
  95. //补充字段
  96. postCollectionsSystem.setUpdateBy(getUsername());
  97. postCollectionsSystem.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
  98. return toAjax(postCollectionsSystemService.updatePostCollectionsSystem(postCollectionsSystem));
  99. }
  100. /**
  101. * 删除藏品套系
  102. */
  103. @ApiOperation("删除藏品套系")
  104. @PreAuthorize("@ss.hasPermi('system:system:remove')")
  105. @Log(title = "藏品套系", businessType = BusinessType.DELETE)
  106. @DeleteMapping("/{ids}")
  107. public AjaxResult remove(@PathVariable Long[] ids)
  108. {
  109. return toAjax(postCollectionsSystemService.deletePostCollectionsSystemByIds(ids));
  110. }
  111. /**
  112. * 根据套系名称进行查询
  113. * @param title
  114. * @param TimeLeft
  115. * @param TimeRight
  116. * @return
  117. */
  118. @ApiOperation("根据套系名称进行查询")
  119. @PreAuthorize("@ss.hasPermi('system:collections:queryCollections')")
  120. @GetMapping("/queryCollections")
  121. public TableDataInfo list(@RequestParam(value="title",required = false)String title,
  122. @RequestParam(value="TimeLeft",required = false) Date TimeLeft,
  123. @RequestParam(value="TimeRight",required = false) Date TimeRight)
  124. {
  125. startPage();
  126. List<PostCollectionsSystem> list= postCollectionsSystemService.selectByTitleAndTime(title,TimeLeft,TimeRight);
  127. return getDataTable(list);
  128. }
  129. }