ClassDictController.java 4.39 KB
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.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.Api;
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;

/**
 * <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 classType className startDate endDate isOrder 是否按照顺序播放 isFastPlay 是否快进 memberId [] 班级学员 classNoticeDOS[noticeType  isAuto noticeTime]")
    @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));
    }

    @PostMapping("batchSms")
    @ApiOperation(" 批量发送班级短信  {id 班级id}")
    public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO));
    }


}