Blame view

UserRoleController.java 3.78 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
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.dto.sms.VerifyCodeDTO;
import com.meishu.dto.userrole.AccountLoginDTO;
import com.meishu.dto.userrole.AddStudentsDTO;
import com.meishu.dto.userrole.QueryStudentsDTO;
import com.meishu.model.UserRoleDO;
import com.meishu.service.UserRoleService;
import com.meishu.util.excel.ExcelUtil;
import com.meishu.vo.semester.GetSemesterScoreVO;
import com.meishu.vo.student.QueryStudentVO;
import com.meishu.vo.userrole.QueryStudentsVO;
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;

import java.util.List;

/**
 * <p>
 * 学生表 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-08-16
 */
@RestController
@Api(tags = "学生表")
@RequestMapping("/userRole")
public class UserRoleController {

    @Autowired
    private UserRoleService userRoleService;

    @PostMapping(value = "/login")
    @ApiOperation("手机端:实验室预约登录:phone/手机号, verifyCode/验证码")
    public ResponseVO login(@RequestBody VerifyCodeDTO verifyCodeDTO) {
        return ResponseData.generateCreatedResponse(0, userRoleService.login(verifyCodeDTO));
    }

    @PostMapping(value = "/accountLogin")
    @ApiOperation("手机端:实验室预约账户登录:idCard/身份证, password/密码")
    public ResponseVO accountLogin(@RequestBody AccountLoginDTO accountLoginDTO) {
        return ResponseData.generateCreatedResponse(0, userRoleService.accountLogin(accountLoginDTO));
    }

    @PostMapping(value = "/userInfo")
    @ApiOperation("获取用户信息:id/学生ID")
    public ResponseVO userInfo(@RequestBody UserRoleDO userRoleDO) {
        return ResponseData.generateCreatedResponse(0, userRoleService.userInfo(userRoleDO.getUserId()));
    }

    @PostMapping("queryStudents")
    @ApiOperation("学生管理--查询所有学生    {pageSize  pageNum userName 学生名称 grade 年级 session 入读时间  userStatus 状态 }")
    public ResponseVO queryStudents(@RequestBody QueryStudentsDTO queryStudentsDTO){
        return ResponseData.generateCreatedResponse(0,userRoleService.queryStudents(queryStudentsDTO));
    }

    @PostMapping("addStudents")
    @ApiOperation("学生管理--添加学生  {userName:学生姓名 studyCode:学籍号 phone:手机号  idCard:身份证号 session:入学年份 gender:性别 email:邮箱 }")
    public ResponseVO addStudents(@RequestBody UserRoleDO userRoleDO){
        return ResponseData.generateCreatedResponse(0,userRoleService.addStudents(userRoleDO));
    }

    @PostMapping("updateStudent")
    @ApiOperation("学生管理--编辑学生 {id userName:学生姓名 studyCode:学籍号 phone:手机号  idCard:身份证号 session:入学年份 gender:性别 email:邮箱}")
    public ResponseVO updateStudent(@RequestBody UserRoleDO userRoleDO){
        return ResponseData.generateCreatedResponse(0,userRoleService.updateStudent(userRoleDO));
    }

    @PostMapping("exportStudents")
    @ApiOperation("学生管理--导出  { userName 学生名称 grade 年级 session 入读时间  userStatus 状态 0:归档  1:在读 2:休学}")
    public void exportStudents(@RequestBody QueryStudentsDTO queryStudentsDTO){
        List<QueryStudentsVO> queryStudentsVOS = userRoleService.exportStudents(queryStudentsDTO);
        ExcelUtil.writeExcel(queryStudentsVOS, QueryStudentsVO.class);
    }

    @PostMapping("studycode")
    public void studycode(){
        userRoleService.studycode();
    }

}