Blame view

StudentController.java 3.2 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
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.campus.BatchUpdateStatusDTO;
import com.meishu.dto.student.*;
import com.meishu.dto.subject.BatchStatusOprDTO;
import com.meishu.model.*;
import com.meishu.service.StudentService;
import com.meishu.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
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>
 * 白名单 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-04-25
 */
@RestController
@RequestMapping("/student")
@Api(tags = "学生端")
public class StudentController {


    @Autowired
    private StudentService studentService;

    @PostMapping("sendMsg")
    @ApiOperation("小程序---发送短信验证码  {telephone}")
    public ResponseVO sendMsg(@RequestBody StudentDO studentDO){
        return ResponseData.generateCreatedResponse(0,studentService.sendMsg(studentDO));
    }

    @PostMapping("login")
    @ApiOperation("小程序---验证短信验证码  {telephone code}")
    public ResponseVO login(@RequestBody SmsCodeDO smsCodeDO){
        return ResponseData.generateCreatedResponse(0,studentService.login(smsCodeDO));
    }

    @PostMapping("addStudent")
    @ApiOperation("添加学生  {telephone,username,parentTelephone,campusId}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addStudent(@RequestBody StudentDO studentDO){
        return ResponseData.generateCreatedResponse(0,studentService.addStudent(studentDO));
    }

    @PostMapping("updateStudent" )
    @ApiOperation("修改学生  id,username,parentTelephone,campusId,status 0:禁用  1:启用")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateStudent(@RequestBody StudentDO studentDO){
        return ResponseData.generateCreatedResponse(0,studentService.updateStudent(studentDO));
    }

    @PostMapping("batchUpdateStudent")
    @ApiOperation("批量修改学生状态   ids[]  status")
    public ResponseVO batchUpdateStudent(@RequestBody BatchStatusOprDTO batchStatusOprDTO){
        return ResponseData.generateCreatedResponse(0,studentService.batchUpdateStudent(batchStatusOprDTO));
    }

    @PostMapping("deleteStudent")
    @ApiOperation("删除学生  {ids[]}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteStudent(@RequestBody DeleteStudentDTO deleteStudentDTO){
        return ResponseData.generateCreatedResponse(0,studentService.deleteStudent(deleteStudentDTO));
    }

    @PostMapping("queryStudent")
    @ApiOperation("查询单个学生   id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO queryStudent(@RequestBody StudentDO studentDO){
        return ResponseData.generateCreatedResponse(0,studentService.queryStudent(studentDO));
    }



}