123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- 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<UserPlanVo> list(UserPlanQueryBo bo) {
- startPage();
- List<UserPlanVo> list = iUserPlanService.queryList(bo);
- return getDataTable(list);
- }
-
- /**
- * 获取学习计划详细信息
- */
- @ApiOperation("获取学习计划详细信息")
- @PreAuthorize("@ss.hasPermi('system:plan:query')")
- @GetMapping("/{planId}")
- public AjaxResult<UserPlanVo> 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<Void> 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<Void> edit(@RequestBody UserPlanEditBo bo) {
- return toAjax(iUserPlanService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 查询学习计划列表
- */
- @ApiOperation("获得展示的日历学习计划,不添加到数据库")
- @PreAuthorize("@ss.hasPermi('system:plan:list')")
- @GetMapping("/listPlan")
- public TableDataInfo<UserPlanVo> listPlan(UserPlanQueryBo bo) {
- startPage();
- List<UserPlanVo> list = iUserPlanService.queryList(bo);
- return getDataTable(list);
- }
- }
|