BUGFIX: format;
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ApiModel("分页响应结果")
|
||||
public class PageBaseResponse<T>{
|
||||
public class PageBaseResponse<T> {
|
||||
@ApiModelProperty("页码")
|
||||
private long page;
|
||||
@ApiModelProperty("每页数量")
|
||||
@@ -30,7 +30,6 @@ public class PageBaseResponse<T>{
|
||||
private List<T> content;
|
||||
|
||||
|
||||
|
||||
public PageBaseResponse(List<T> list, long page, long size, long total, long pages) {
|
||||
this.page = page;
|
||||
this.size = size;
|
||||
@@ -39,7 +38,7 @@ public class PageBaseResponse<T>{
|
||||
this.content = list;
|
||||
}
|
||||
|
||||
public static <T> PageBaseResponse<T> success(IPage<T> page){
|
||||
return new PageBaseResponse<>(page.getRecords() , page.getCurrent(), page.getSize(), page.getTotal(), page.getPages());
|
||||
public static <T> PageBaseResponse<T> success(IPage<T> page) {
|
||||
return new PageBaseResponse<>(page.getRecords(), page.getCurrent(), page.getSize(), page.getTotal(), page.getPages());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,8 @@ public class PageResponse<T> extends Response<List<T>> {
|
||||
private List<T> content;
|
||||
|
||||
|
||||
|
||||
public PageResponse(Response<List<T>> response, long page, long size, long total, long pages) {
|
||||
if(response != null) {
|
||||
if (response != null) {
|
||||
this.setData(response.getData());
|
||||
this.setErrCode(response.getErrCode());
|
||||
this.setErrMsg(response.getErrMsg());
|
||||
@@ -45,8 +44,8 @@ public class PageResponse<T> extends Response<List<T>> {
|
||||
this.content = response.getData();
|
||||
}
|
||||
|
||||
public static <T> PageResponse<T> success(IPage<T> page){
|
||||
public static <T> PageResponse<T> success(IPage<T> page) {
|
||||
Response<List<T>> response = success(page.getRecords());
|
||||
return new PageResponse<>(response , page.getCurrent(), page.getSize(), page.getTotal(), page.getPages());
|
||||
return new PageResponse<>(response, page.getCurrent(), page.getSize(), page.getTotal(), page.getPages());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,28 +27,27 @@ public class Response<T> implements Serializable {
|
||||
@ApiModelProperty("数据结果")
|
||||
private T data;
|
||||
|
||||
public static <T> Response<T> success(){
|
||||
public static <T> Response<T> success() {
|
||||
return success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMsg(), null);
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(String msg){
|
||||
public static <T> Response<T> success(String msg) {
|
||||
return success(ResultEnum.SUCCESS.getCode(), msg, null);
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(T data){
|
||||
public static <T> Response<T> success(T data) {
|
||||
return success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMsg(), data);
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(int code, T data){
|
||||
public static <T> Response<T> success(int code, T data) {
|
||||
return success(code, ResultEnum.SUCCESS.getMsg(), data);
|
||||
}
|
||||
|
||||
public static <T> Response<T> success(int code, String msg, T data){
|
||||
public static <T> Response<T> success(int code, String msg, T data) {
|
||||
return getResponse(code, msg, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static <T> Response<T> fail(String msg) {
|
||||
return fail(ResultEnum.FAIL.getCode(), msg);
|
||||
}
|
||||
@@ -85,7 +84,7 @@ public class Response<T> implements Serializable {
|
||||
return getResponse(code, msg, data);
|
||||
}
|
||||
|
||||
private static <T> Response<T> getResponse(int code, String msg, T data){
|
||||
private static <T> Response<T> getResponse(int code, String msg, T data) {
|
||||
return new Response<>(code, msg, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,16 @@ public enum ResultEnum {
|
||||
ERROR(false, -1, "system error!"),
|
||||
PARAMETER_ERROR(false, -2, "parameter error!"),
|
||||
|
||||
NO_LOGIN(false,-100,"User not logged in"),
|
||||
NO_PERMISSION(false,-200,"No access"),
|
||||
ACCOUNT_LOCK(false,-300,"Account frozen");
|
||||
NO_LOGIN(false, -100, "User not logged in"),
|
||||
NO_PERMISSION(false, -200, "No access"),
|
||||
ACCOUNT_LOCK(false, -300, "Account frozen");
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
private boolean isOK;
|
||||
|
||||
|
||||
|
||||
ResultEnum(boolean isOK, int code, String msg){
|
||||
ResultEnum(boolean isOK, int code, String msg) {
|
||||
this.isOK = isOK;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
|
||||
Reference in New Issue
Block a user