Blame view

SubjectTreeController.java 3.15 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.subject.GetSubjectTreeDTO;
import com.meishu.dto.subject.UpdateTreeOrderDTO;
import com.meishu.model.SubjectTreeDO;
import com.meishu.service.SubjectTreeService;
import com.meishu.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-04-27
 */
@RestController
@Api(tags = "知识树")
@RequestMapping("/subjectTree")
public class SubjectTreeController {

    @Autowired
    private SubjectTreeService subjectTreeService;

    @PostMapping("updateSubjectTree")
    @ApiOperation("更新知识树子节点  id   treeName:知识点名称  parentId父节点id  treeNode 编号")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateSubjectTree(@RequestBody SubjectTreeDO subjectTreeDO){
        return ResponseData.generateCreatedResponse(0,subjectTreeService.updateSubjectTree(subjectTreeDO));
    }

    @PostMapping("addSubjectTree")
    @ApiOperation("添加知识树节点 subjectId 科目id parentId:父节点  treeName:知识点名称 " +
            "treeNode 编号 ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addSubjectTree(@RequestBody SubjectTreeDO subjectTreeDO){
        return ResponseData.generateCreatedResponse(0,subjectTreeService.addSubjectTree(subjectTreeDO));
    }

    @PostMapping("deleteSubjectTree")
    @ApiOperation("删除子节点(递归删除) {id}")
    //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteSubjectTree(@RequestBody SubjectTreeDO subjectTreeDO){
        return ResponseData.generateCreatedResponse(0,subjectTreeService.deleteSubjectTree(subjectTreeDO));
    }

    @PostMapping("updateTreeOrder")
    @ApiOperation("知识点排序  {ids[]知识树id  parentId  }")
    public ResponseVO updateTreeOrder(@RequestBody UpdateTreeOrderDTO updateTreeOrderDTO){
        return ResponseData.generateCreatedResponse(0,subjectTreeService.updateTreeOrder(updateTreeOrderDTO));
    }

    @PostMapping("getTreesCnt")
    @ApiOperation("获取知识树+ 题目视频数  subjectId userId")
    public ResponseVO getTreesCnt(@RequestBody GetSubjectTreeDTO getSubjectTreeDTO){
        return ResponseData.generateCreatedResponse(0,subjectTreeService.getTreesCnt(getSubjectTreeDTO));
    }

    @PostMapping("getTreesCheckCnt")
    @ApiOperation("获取知识树+ 视频题目审核数  subjectId userId  shareStatus 2:待审核   1已审核")
    public ResponseVO getTreesCheckCnt(@RequestBody GetSubjectTreeDTO getSubjectTreeDTO){
        return ResponseData.generateCreatedResponse(0,subjectTreeService.getTreesCheckCnt(getSubjectTreeDTO));
    }


}