package com.zhongzheng.controller.plan; import java.util.List; import java.util.Arrays; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.modules.user.vo.UserPlanVo; import com.zhongzheng.modules.user.bo.UserPlanQueryBo; import com.zhongzheng.modules.user.bo.UserPlanAddBo; import com.zhongzheng.modules.user.bo.UserPlanEditBo; import com.zhongzheng.modules.user.service.IUserPlanService; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; /** * 学习计划Controller * * @author ruoyi * @date 2021-12-08 */ @Api(value = "学习计划控制器", tags = {"学习计划管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/plan") public class UserPlanController extends BaseController { private final IUserPlanService iUserPlanService; /** * 查询学习计划列表 */ @ApiOperation("查询学习计划列表") @PreAuthorize("@ss.hasPermi('system:plan:list')") @GetMapping("/list") public TableDataInfo list(UserPlanQueryBo bo) { startPage(); List list = iUserPlanService.queryList(bo); return getDataTable(list); } /** * 获取学习计划详细信息 */ @ApiOperation("获取学习计划详细信息") @PreAuthorize("@ss.hasPermi('system:plan:query')") @GetMapping("/{planId}") public AjaxResult getInfo(@PathVariable("planId" ) Long planId) { return AjaxResult.success(iUserPlanService.queryById(planId)); } /** * 新增学习计划 */ @ApiOperation("新增学习计划") @PreAuthorize("@ss.hasPermi('system:plan:add')") @Log(title = "学习计划", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody UserPlanAddBo bo) { return toAjax(iUserPlanService.insertByAddBo(bo) ? 1 : 0); } /** * 修改学习计划 */ @ApiOperation("修改学习计划") @PreAuthorize("@ss.hasPermi('system:plan:edit')") @Log(title = "学习计划", businessType = BusinessType.UPDATE) @PutMapping() public AjaxResult edit(@RequestBody UserPlanEditBo bo) { return toAjax(iUserPlanService.updateByEditBo(bo) ? 1 : 0); } /** * 查询学习计划列表 */ @ApiOperation("获得展示的日历学习计划,不添加到数据库") @PreAuthorize("@ss.hasPermi('system:plan:list')") @GetMapping("/listPlan") public TableDataInfo listPlan(UserPlanQueryBo bo) { startPage(); List list = iUserPlanService.queryList(bo); return getDataTable(list); } }