parent
b320b3e34c
commit
ba7d5d8709
@ -1,19 +1,20 @@
|
||||
package jty.expressdistributionsystem.DTO;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserLoginByAccountDTO {
|
||||
@NotBlank(message = "账号不能为空")
|
||||
@Pattern(regexp = "^(?!\\s)([A-Za-z0-9]{1,10})$")
|
||||
@Pattern(regexp = "^(?!\\s)([A-Za-z0-9]{1,10})$", message = "账号长度在1-10位之间")
|
||||
private String account;
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Pattern(regexp = "^.+$")
|
||||
@Pattern(regexp = "^.+$", message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "请选择你的登录任务")
|
||||
@NotNull
|
||||
private Integer mark;
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package jty.expressdistributionsystem.interceptors;
|
||||
|
||||
import jty.expressdistributionsystem.entity.Result;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result handleException(Exception e){
|
||||
e.printStackTrace();
|
||||
return new Result(500, StringUtils.hasLength(e.getMessage()) ? e.getMessage() : "操作失败", "");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue