CmsCateController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.goldenwater.slgc.controller;
  2. import java.util.List;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.DeleteMapping;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6. import org.springframework.web.bind.annotation.PathVariable;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.PutMapping;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import com.goldenwater.common.annotation.Log;
  13. import com.goldenwater.common.core.controller.BaseController;
  14. import com.goldenwater.common.core.domain.AjaxResult;
  15. import com.goldenwater.common.core.page.TableDataInfo;
  16. import com.goldenwater.common.enums.BusinessType;
  17. import com.goldenwater.slgc.domain.CmsCate;
  18. import com.goldenwater.slgc.service.CmsCateService;
  19. import io.swagger.v3.oas.annotations.Operation;
  20. import io.swagger.v3.oas.annotations.tags.Tag;
  21. @Tag(name = "12. 内容分类管理")
  22. @RestController
  23. @RequestMapping("/slgc/cms-cate")
  24. public class CmsCateController extends BaseController {
  25. @Autowired
  26. private CmsCateService cmsCateService;
  27. @Operation(summary = "12.01 查询内容分类列表")
  28. @GetMapping("/list")
  29. public TableDataInfo list(CmsCate cmsCate) {
  30. startPage();
  31. List<CmsCate> list = cmsCateService.selectCmsCateList(cmsCate);
  32. return getDataTable(list);
  33. }
  34. @Operation(summary = "12.02 获取内容分类详细信息")
  35. @GetMapping(value = "/{cateId}")
  36. public AjaxResult getInfo(@PathVariable String cateId) {
  37. return success(cmsCateService.selectCmsCateById(cateId));
  38. }
  39. @Operation(summary = "12.03 新增内容分类")
  40. @Log(title = "内容分类管理", businessType = BusinessType.INSERT)
  41. @PostMapping
  42. public AjaxResult add(@RequestBody CmsCate cmsCate) {
  43. return toAjax(cmsCateService.insertCmsCate(cmsCate));
  44. }
  45. @Operation(summary = "12.04 修改内容分类")
  46. @Log(title = "内容分类管理", businessType = BusinessType.UPDATE)
  47. @PutMapping
  48. public AjaxResult edit(@RequestBody CmsCate cmsCate) {
  49. return toAjax(cmsCateService.updateCmsCate(cmsCate));
  50. }
  51. @Operation(summary = "12.05 删除内容分类")
  52. @Log(title = "内容分类管理", businessType = BusinessType.DELETE)
  53. @DeleteMapping("/{cateIds}")
  54. public AjaxResult remove(@PathVariable String[] cateIds) {
  55. return toAjax(cmsCateService.deleteCmsCateByIds(cateIds));
  56. }
  57. @Operation(summary = "12.06 获取内容分类树")
  58. @GetMapping("/tree")
  59. public AjaxResult getTree() {
  60. return success(cmsCateService.getTree());
  61. }
  62. @Operation(summary = "12.07 查询子分类列表")
  63. @GetMapping("/subList/{catePid}")
  64. public AjaxResult getSubList(@PathVariable String catePid) {
  65. return success(cmsCateService.findSubList(catePid));
  66. }
  67. }