UserPlanController.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package com.zhongzheng.controller.plan;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import lombok.RequiredArgsConstructor;
  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.zhongzheng.common.annotation.Log;
  16. import com.zhongzheng.common.core.controller.BaseController;
  17. import com.zhongzheng.common.core.domain.AjaxResult;
  18. import com.zhongzheng.common.enums.BusinessType;
  19. import com.zhongzheng.modules.user.vo.UserPlanVo;
  20. import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
  21. import com.zhongzheng.modules.user.bo.UserPlanAddBo;
  22. import com.zhongzheng.modules.user.bo.UserPlanEditBo;
  23. import com.zhongzheng.modules.user.service.IUserPlanService;
  24. import com.zhongzheng.common.utils.poi.ExcelUtil;
  25. import com.zhongzheng.common.core.page.TableDataInfo;
  26. import io.swagger.annotations.Api;
  27. import io.swagger.annotations.ApiOperation;
  28. /**
  29. * 学习计划Controller
  30. *
  31. * @author ruoyi
  32. * @date 2021-12-08
  33. */
  34. @Api(value = "学习计划控制器", tags = {"学习计划管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/system/plan")
  38. public class UserPlanController extends BaseController {
  39. private final IUserPlanService iUserPlanService;
  40. /**
  41. * 查询学习计划列表
  42. */
  43. @ApiOperation("查询学习计划列表")
  44. @PreAuthorize("@ss.hasPermi('system:plan:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo<UserPlanVo> list(UserPlanQueryBo bo) {
  47. startPage();
  48. List<UserPlanVo> list = iUserPlanService.queryList(bo);
  49. return getDataTable(list);
  50. }
  51. /**
  52. * 获取学习计划详细信息
  53. */
  54. @ApiOperation("获取学习计划详细信息")
  55. @PreAuthorize("@ss.hasPermi('system:plan:query')")
  56. @GetMapping("/{planId}")
  57. public AjaxResult<UserPlanVo> getInfo(@PathVariable("planId" ) Long planId) {
  58. return AjaxResult.success(iUserPlanService.queryById(planId));
  59. }
  60. /**
  61. * 新增学习计划
  62. */
  63. @ApiOperation("新增学习计划")
  64. @PreAuthorize("@ss.hasPermi('system:plan:add')")
  65. @Log(title = "学习计划", businessType = BusinessType.INSERT)
  66. @PostMapping()
  67. public AjaxResult<Void> add(@RequestBody UserPlanAddBo bo) {
  68. return toAjax(iUserPlanService.insertByAddBo(bo) ? 1 : 0);
  69. }
  70. /**
  71. * 修改学习计划
  72. */
  73. @ApiOperation("修改学习计划")
  74. @PreAuthorize("@ss.hasPermi('system:plan:edit')")
  75. @Log(title = "学习计划", businessType = BusinessType.UPDATE)
  76. @PutMapping()
  77. public AjaxResult<Void> edit(@RequestBody UserPlanEditBo bo) {
  78. return toAjax(iUserPlanService.updateByEditBo(bo) ? 1 : 0);
  79. }
  80. /**
  81. * 查询学习计划列表
  82. */
  83. @ApiOperation("获得展示的日历学习计划,不添加到数据库")
  84. @PreAuthorize("@ss.hasPermi('system:plan:list')")
  85. @GetMapping("/listPlan")
  86. public TableDataInfo<UserPlanVo> listPlan(UserPlanQueryBo bo) {
  87. startPage();
  88. List<UserPlanVo> list = iUserPlanService.queryList(bo);
  89. return getDataTable(list);
  90. }
  91. }