DocGroupController.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package com.jjt.doc.controller;
  2. import com.jjt.common.core.utils.poi.ExcelUtil;
  3. import com.jjt.common.core.web.controller.BaseController;
  4. import com.jjt.common.core.web.domain.AjaxResult;
  5. import com.jjt.common.core.web.page.TableDataInfo;
  6. import com.jjt.common.log.annotation.Log;
  7. import com.jjt.common.log.enums.BusinessType;
  8. import com.jjt.common.security.annotation.RequiresPermissions;
  9. import com.jjt.common.security.utils.SecurityUtils;
  10. import com.jjt.doc.domain.DocGroup;
  11. import com.jjt.doc.service.IDocGroupService;
  12. import org.springframework.web.bind.annotation.*;
  13. import javax.annotation.Resource;
  14. import javax.servlet.http.HttpServletResponse;
  15. import java.util.List;
  16. /**
  17. * 分组Controller
  18. *
  19. * @author wukai
  20. * @date 2023-04-20
  21. */
  22. @RestController
  23. @RequestMapping("/group")
  24. public class DocGroupController extends BaseController {
  25. @Resource
  26. private IDocGroupService docGroupService;
  27. /**
  28. * 查询分组列表
  29. */
  30. @GetMapping("/list")
  31. public TableDataInfo list(DocGroup docGroup) {
  32. startPage();
  33. List<DocGroup> list = docGroupService.selectDocGroupList(docGroup);
  34. return getDataTable(list);
  35. }
  36. /**
  37. * 查询分组列表
  38. */
  39. @GetMapping("/select")
  40. public TableDataInfo select(DocGroup docGroup) {
  41. startPage();
  42. docGroup.setGroupManager(SecurityUtils.getUserId());
  43. List<DocGroup> list = docGroupService.getGroupByUid(docGroup);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 查询分组列表
  48. */
  49. @GetMapping("/selectDoc")
  50. public TableDataInfo selectDoc(DocGroup docGroup) {
  51. startPage();
  52. docGroup.setGroupManager(SecurityUtils.getUserId());
  53. //传1则表示 分组成员的查询
  54. docGroup.setSearchValue("1");
  55. List<DocGroup> list = docGroupService.getGroupByUid(docGroup);
  56. return getDataTable(list);
  57. }
  58. /**
  59. * 导出分组列表
  60. */
  61. @Log(title = "分组", businessType = BusinessType.EXPORT)
  62. @PostMapping("/export")
  63. public void export(HttpServletResponse response, DocGroup docGroup) {
  64. List<DocGroup> list = docGroupService.selectDocGroupList(docGroup);
  65. ExcelUtil<DocGroup> util = new ExcelUtil<DocGroup>(DocGroup.class);
  66. util.exportExcel(response, list, "分组数据");
  67. }
  68. /**
  69. * 获取分组详细信息
  70. */
  71. @GetMapping(value = "/{groupId}")
  72. public AjaxResult getInfo(@PathVariable("groupId") Long groupId) {
  73. return success(docGroupService.selectDocGroupByGroupId(groupId));
  74. }
  75. /**
  76. * 新增分组
  77. */
  78. @Log(title = "分组", businessType = BusinessType.INSERT)
  79. @PostMapping
  80. public AjaxResult add(@RequestBody DocGroup docGroup) {
  81. return toAjax(docGroupService.insertDocGroup(docGroup));
  82. }
  83. /**
  84. * 修改分组
  85. */
  86. @Log(title = "分组", businessType = BusinessType.UPDATE)
  87. @PutMapping
  88. public AjaxResult edit(@RequestBody DocGroup docGroup) {
  89. return toAjax(docGroupService.updateDocGroup(docGroup));
  90. }
  91. /**
  92. * 删除分组
  93. */
  94. @Log(title = "分组", businessType = BusinessType.DELETE)
  95. @DeleteMapping("/{groupIds}")
  96. public AjaxResult remove(@PathVariable Long[] groupIds) {
  97. return toAjax(docGroupService.deleteDocGroupByGroupIds(groupIds));
  98. }
  99. }