KnowledgeSubjectDictController.java 4.13 KB
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.GetSubjectAdministerDTO;
import com.meishu.dto.subject.GetSubjectTreeDTO;
import com.meishu.dto.subject.GetSubjectsDTO;
import com.meishu.model.KnowledgeSubjectDictDO;
import com.meishu.service.KnowledgeSubjectDictService;
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("/subjectDict")
public class KnowledgeSubjectDictController {

    @Autowired
    private KnowledgeSubjectDictService knowledgeSubjectDictService;

    @PostMapping("getSubjects")
    @ApiOperation("获取所有学科 {userId登录人id  subjectType:学科类型  subjectName 学科名称 pageSize pageNum}")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getSubjects(@RequestBody GetSubjectsDTO getSubjectsDTO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.getSubjects(getSubjectsDTO));
    }

    @PostMapping("getAllSubjects")
    @ApiOperation("获取所有学科 {subjectType:学科类型  subjectName 学科名称 }")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAllSubjects(@RequestBody GetSubjectsDTO getSubjectsDTO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.getAllSubjects(getSubjectsDTO));
    }

    @PostMapping("updateSubject")
    @ApiOperation("编辑学科 { id  subjectName 学科名称  subjectType:学科类型}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateSubject(@RequestBody KnowledgeSubjectDictDO subjectDictDO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.updateSubject(subjectDictDO));
    }

    @PostMapping("addSubject")
    @ApiOperation("添加学科 {subjectName 学科名称  subjectType:学科类型}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addSubject(@RequestBody KnowledgeSubjectDictDO subjectDictDO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.addSubject(subjectDictDO));
    }

    @PostMapping("deleteSubject")
    @ApiOperation("删除学科 {id}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteSubject(@RequestBody KnowledgeSubjectDictDO subjectDictDO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.deleteSubject(subjectDictDO));
    }

    @PostMapping("getSubjectTree")
    @ApiOperation("获取某个学科下的知识树  {subjectId 科目id  userId }")
//    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getSubjectTree(@RequestBody GetSubjectTreeDTO getSubjectTreeDTO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.getSubjectTree(getSubjectTreeDTO));
    }

    @PostMapping("getSubject")
    @ApiOperation("获取学科详情  id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getSubject(@RequestBody KnowledgeSubjectDictDO subjectDictDO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.getSubject(subjectDictDO));
    }

    @PostMapping("getSubjectAdminister")
    @ApiOperation("获取某个科目下的老师   subjectId 科目id  userName名字")
    public ResponseVO getSubjectAdminister(@RequestBody GetSubjectAdministerDTO getSubjectAdministerDTO){
        return ResponseData.generateCreatedResponse(0,knowledgeSubjectDictService.getSubjectAdminister(getSubjectAdministerDTO));
    }

}