Blame view

ClassDictController.java 4.06 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.service.ClassDictService;
import com.subsidy.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>
 * 班级id 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-10-12
 */
@RestController
@Api(tags = "班级")
@RequestMapping("/classDict")
public class ClassDictController {

    @Autowired
    private ClassDictService classDictService;

    @PostMapping("getAllClasses")
    @ApiOperation("获取某老师下的所有课程 ** companyId 所选企业id className 班级名称")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
    }

    @PostMapping("deleteClasses")
    @ApiOperation("删除课程 id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteClasses(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.deleteClasses(classDictDO));
    }

    @PostMapping("addClass")
    @ApiOperation("添加课程 ** userId:登录人id  companyId courseId className startDate endDate")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addClass(@RequestBody AddClassDTO addClassDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.addClass(addClassDTO));
    }

    @PostMapping("updateClass")
    @ApiOperation("修改课程 id  ** companyId courseId className startDate endDate")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateClass(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.updateClass(classDictDO));
    }

    @PostMapping("classDetail")
    @ApiOperation("获取一个班级详情  id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO classDetail(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.classDetail(classDictDO));
    }

    @PostMapping("removeMember")
    @ApiOperation("移除班级  classId  班级id  memberId人员id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO removeMember(@RequestBody ClassMemberMappingDO classMemberMappingDO){
        return ResponseData.generateCreatedResponse(0,classDictService.removeMember(classMemberMappingDO));
    }

    @PostMapping("getSpareMembers")
    @ApiOperation("获取不在某班级的某企业里所有成员   ** companyId 企业id  classId 班级id")
    //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO));
    }

    @PostMapping("addMemberToClass")
    @ApiOperation("将某个成员加入到某个班级里   classId  memberIds []")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addMemberToClass(@RequestBody AddMemberToClassDTO addMemberToClassDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO));
    }


}