学生管理账号校验

hehai
shijie 4 years ago
parent fbb1f8ec46
commit 5c848e0ea5
  1. 5
      src/main/java/com/msdw/tms/controller/StudentController.java
  2. 2
      src/main/java/com/msdw/tms/entity/vo/StudentVo.java

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
@ -46,7 +47,7 @@ public class StudentController implements StudentControllerApi{
@Transactional
@Override
@PostMapping("/addStudent")
public R addStudent(@RequestBody StudentVo studentVo){
public R addStudent(@RequestBody @Valid StudentVo studentVo){
studentVo.setSchoolId(ConstantUtils.Keda_schoolId);
String account = studentVo.getAccount();
String phone = studentVo.getPhone();
@ -130,7 +131,7 @@ public class StudentController implements StudentControllerApi{
@Override
@Transactional
@PutMapping("/updateStudent")
public R updateStudent(@RequestBody StudentVo studentVo) {
public R updateStudent(@RequestBody @Valid StudentVo studentVo) {
studentVo.setSchoolId(ConstantUtils.Keda_schoolId);//设定学校id
Integer studentId = studentVo.getStudentId();

@ -5,6 +5,7 @@ import com.msdw.tms.entity.UserInfoEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.Pattern;
import java.util.List;
/**
@ -19,6 +20,7 @@ public class StudentVo extends StudentEntity {
//用户姓名
private String userName;
//用户账号
@Pattern(regexp = "^[0-9a-zA-Z]*$",message = "账号只能为数字或字母!")
private String account;
//密码
private String password;

Loading…
Cancel
Save