SysKnowledgeController.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package com.xunmei.system.controller;
  2. import java.util.List;
  3. import java.io.IOException;
  4. import javax.servlet.http.HttpServletResponse;
  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.xunmei.common.log.annotation.Log;
  15. import com.xunmei.common.log.enums.BusinessType;
  16. import com.xunmei.common.security.annotation.RequiresPermissions;
  17. import com.xunmei.system.domain.SysKnowledge;
  18. import com.xunmei.system.service.ISysKnowledgeService;
  19. import com.xunmei.common.core.web.controller.BaseController;
  20. import com.xunmei.common.core.web.domain.AjaxResult;
  21. import io.swagger.annotations.Api;
  22. import io.swagger.annotations.ApiOperation;
  23. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  24. import com.xunmei.common.core.web.page.TableDataInfo;
  25. /**
  26. * 知识库标签Controller
  27. *
  28. * @author xunmei
  29. * @date 2023-08-21
  30. */
  31. @Api(tags = {"SysKnowledge" })
  32. @RestController
  33. @RequestMapping("/knowledge")
  34. public class SysKnowledgeController extends BaseController {
  35. @Autowired
  36. private ISysKnowledgeService sysKnowledgeService;
  37. /**
  38. * 查询知识库标签列表
  39. */
  40. @ApiOperation(value = "查询SysKnowledge列表")
  41. @RequiresPermissions("system:knowledge:list")
  42. @GetMapping("/list")
  43. public TableDataInfo list(SysKnowledge sysKnowledge) {
  44. return sysKnowledgeService.selectPage( sysKnowledge);
  45. }
  46. /**
  47. * 获取知识库标签详细信息
  48. */
  49. @ApiOperation(value = "获取SysKnowledge详细信息")
  50. @RequiresPermissions("system:knowledge:query")
  51. @GetMapping(value = "/{id}")
  52. public AjaxResult getInfo(@PathVariable("id") Long id) {
  53. return success(sysKnowledgeService.selectSysKnowledgeById(id));
  54. }
  55. /**
  56. * 新增知识库标签
  57. */
  58. @ApiOperation(value = "新增SysKnowledge")
  59. @RequiresPermissions("system:knowledge:add")
  60. @Log(title = "知识库标签" , businessType = BusinessType.INSERT)
  61. @PostMapping
  62. public AjaxResult add(@RequestBody SysKnowledge sysKnowledge) {
  63. return toAjax(sysKnowledgeService.insertSysKnowledge(sysKnowledge));
  64. }
  65. /**
  66. * 修改知识库标签
  67. */
  68. @ApiOperation(value = "修改SysKnowledge")
  69. @RequiresPermissions("system:knowledge:edit")
  70. @Log(title = "知识库标签" , businessType = BusinessType.UPDATE)
  71. @PutMapping
  72. public AjaxResult edit(@RequestBody SysKnowledge sysKnowledge) {
  73. return toAjax(sysKnowledgeService.updateSysKnowledge(sysKnowledge));
  74. }
  75. /**
  76. * 删除知识库标签
  77. */
  78. @ApiOperation(value = "删除SysKnowledge")
  79. @RequiresPermissions("system:knowledge:remove")
  80. @Log(title = "知识库标签" , businessType = BusinessType.DELETE)
  81. @DeleteMapping("/{ids}")
  82. public AjaxResult remove(@PathVariable Long[] ids) {
  83. return toAjax(sysKnowledgeService.deleteSysKnowledgeByIds(ids));
  84. }
  85. }