init_object,增加了不完全的登录API,完善数据库设计
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CommonResult<T> {
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
private T data;
|
||||
|
||||
public CommonResult(Integer code, String message){
|
||||
this(code,message, null);
|
||||
}
|
||||
|
||||
public static CommonResult<String> success(){
|
||||
return new CommonResult(200,"请求成功",null);
|
||||
}
|
||||
|
||||
public static CommonResult<String> success(String message){
|
||||
return new CommonResult(200,message,null);
|
||||
}
|
||||
|
||||
public static CommonResult<Object> success(String message,Object data){
|
||||
return new CommonResult(200,"请求成功,"+message,data);
|
||||
}
|
||||
|
||||
public static CommonResult success(Object data){
|
||||
return new CommonResult(200,"请求成功",data);
|
||||
}
|
||||
|
||||
public static CommonResult<String> error(String message){
|
||||
return new CommonResult<>(400,message,null);
|
||||
}
|
||||
|
||||
public static CommonResult<String> notFind(){
|
||||
return new CommonResult<>(404,"请求的资源不存在",null);
|
||||
}
|
||||
public static CommonResult<String> notFind(String message){
|
||||
return new CommonResult<>(404,message,null);
|
||||
}
|
||||
|
||||
public static CommonResult<String> serverError(String message){
|
||||
return new CommonResult<>(500,message,null);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user