Commit 5ac447b9 by “zcwang”

change: 返回结构兼容

parent 79664b19
package com.netease.mail.yanxuan.change.biz.meta;
import java.util.LinkedHashMap;
/**
* @author lwtang
*/
public class AjaxResult extends LinkedHashMap<String, Object> {
public class AjaxResult<T> {
private static final long serialVersionUID = 5451316194035153776L;
private static final long serialVersionUID = 1L;
private Integer code;
private String msg;
private T data;
private Exception e;
public AjaxResult() {
setCode(ResponseCode.SUCCESS);
public Boolean isSuccess() {
return this.code.equals(ResponseCodeEnum.SUCCESS.getCode());
}
public AjaxResult(int code, String msg) {
setCodeInt(code);
put(MSG, msg);
public Boolean isFail() {
return !this.isSuccess();
}
public AjaxResult(ResponseCode responseCode) {
setCode(responseCode);
public static <R> AjaxResult<R> success() {
return of(ResponseCodeEnum.SUCCESS);
}
public AjaxResult(ResponseCode responseCode, Object result) {
setCode(responseCode);
put(RESULT, result);
public static <R> AjaxResult<R> success(R data) {
return of(ResponseCodeEnum.SUCCESS).setData(data);
}
/**
* 响应code,默认<code>ResponseCode.SUCCESS</code>
*/
public static final String CODE = "code";
public static <R> AjaxResult<R> error() {
return of(ResponseCodeEnum.INTERNAL_ERROR);
}
/**
* 消息
*/
public static final String MSG = "msg";
public static <R> AjaxResult<R> error(Exception e) {
return of(ResponseCodeEnum.INTERNAL_ERROR).setE(e);
}
/**
* 结果
*/
public static final String RESULT = "data";
public static <R> AjaxResult<R> badRequest() {
return of(ResponseCodeEnum.BAD_REQUEST);
}
public static <R> AjaxResult<R> badRequest(String msg) {
return of(ResponseCodeEnum.BAD_REQUEST).setMsg(msg);
}
public static <R> AjaxResult<R> badRequest(Exception e) {
return of(ResponseCodeEnum.BAD_REQUEST).setE(e);
}
public static <R> AjaxResult<R> badRequest(String msg, Exception e) {
return of(ResponseCodeEnum.BAD_REQUEST).setMsg(msg).setE(e);
}
public static <R> AjaxResult<R> of(ResponseCodeEnum code) {
return (new AjaxResult()).setCode(code.getCode()).setMsg(code.getMsg());
}
public static <R> AjaxResult<R> of(Integer code, String msg) {
return (new AjaxResult()).setCode(code).setMsg(msg);
}
public static <R> AjaxResult<R> of(Integer code, String msg, R data) {
return of(code, msg).setData(data);
}
public static <R> AjaxResult<R> of(Integer code, String msg, R data, Exception e) {
return of(code, msg, data).setE(e);
}
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (!(o instanceof AjaxResult)) {
return false;
} else {
AjaxResult<?> other = (AjaxResult)o;
if (!other.canEqual(this)) {
return false;
} else if (!super.equals(o)) {
return false;
} else {
label61: {
Object this$code = this.getCode();
Object other$code = other.getCode();
if (this$code == null) {
if (other$code == null) {
break label61;
}
} else if (this$code.equals(other$code)) {
break label61;
}
return false;
}
label54: {
Object this$msg = this.getMsg();
Object other$msg = other.getMsg();
if (this$msg == null) {
if (other$msg == null) {
break label54;
}
} else if (this$msg.equals(other$msg)) {
break label54;
}
return false;
}
Object this$data = this.getData();
Object other$data = other.getData();
if (this$data == null) {
if (other$data != null) {
return false;
}
} else if (!this$data.equals(other$data)) {
return false;
}
Object this$e = this.getE();
Object other$e = other.getE();
if (this$e == null) {
if (other$e != null) {
return false;
}
} else if (!this$e.equals(other$e)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(Object other) {
return other instanceof AjaxResult;
}
public int hashCode() {
int PRIME = true;
int result = super.hashCode();
Object $code = this.getCode();
result = result * 59 + ($code == null ? 43 : $code.hashCode());
Object $msg = this.getMsg();
result = result * 59 + ($msg == null ? 43 : $msg.hashCode());
Object $data = this.getData();
result = result * 59 + ($data == null ? 43 : $data.hashCode());
Object $e = this.getE();
result = result * 59 + ($e == null ? 43 : $e.hashCode());
return result;
}
public AjaxResult() {
}
public Integer getCode() {
return this.code;
}
public String getMsg() {
return this.msg;
}
public void setCode(ResponseCode code) {
put(CODE, code.getCode());
public T getData() {
return this.data;
}
public void setMsg(String msg) {
put(MSG, msg);
public Exception getE() {
return this.e;
}
public void setCodeInt(int code) {
put(CODE, code);
public AjaxResult<T> setCode(Integer code) {
this.code = code;
return this;
}
public ResponseCode getCode() {
return (ResponseCode) get(CODE);
public AjaxResult<T> setMsg(String msg) {
this.msg = msg;
return this;
}
public Object getResult() {
return (String) get(RESULT);
public AjaxResult<T> setData(T data) {
this.data = data;
return this;
}
public void setResult(Object result) {
put(RESULT, result);
public AjaxResult<T> setE(Exception e) {
this.e = e;
return this;
}
public static AjaxResult with(Object result) {
return new AjaxResult(ResponseCode.SUCCESS, result);
public String toString() {
return "AjaxResult(code=" + this.getCode() + ", msg=" + this.getMsg() + ", data=" + this.getData() + ", e=" + this.getE() + ")";
}
}
......@@ -18,7 +18,7 @@ public class AdminChangeConfigServiceImpl implements AdminChangeConfigService {
@Override
public AjaxResult queryChanges(ChangeConfigQueryReq changeConfigQueryReq) {
if (changeConfigQueryReq == null){
return AjaxResult.with(ResponseCode.BAD_REQUEST);
// return AjaxResult.with(ResponseCode.BAD_REQUEST);
}
//BeanUtils.copyProperties() 参数转换器
return null;
......@@ -27,7 +27,7 @@ public class AdminChangeConfigServiceImpl implements AdminChangeConfigService {
@Override
public AjaxResult queryDetail(Long id, Long sonChangeClassId) {
if (id == null || sonChangeClassId == null){
return AjaxResult.with(ResponseCode.BAD_REQUEST);
// return AjaxResult.with(ResponseCode.BAD_REQUEST);
}
//尝试从reids里面 获取 如果获取到了直接返回
......
/**
* @(#)ChangeFlowController.java, 2022/11/14.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.web.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.netease.mail.yanxuan.change.biz.meta.AjaxResult;
/**
* @Author zcwang
* @Date 2022/11/14
*/
@RestController
@RequestMapping("/change/flow")
public class ChangeFlowController {
@GetMapping("/detail")
public AjaxResult<String> detail() {
}
public AjaxResult
}
\ No newline at end of file
......@@ -5,10 +5,15 @@ import com.netease.mail.yanxuan.change.dal.meta.model.po.ChangeConfigPo;
import java.util.List;
import lombok.Builder;
import lombok.Data;
/**
* @author WangJiaXiang
* @date 2022/11/11/011$
*/
@Data
@Builder
public class ChangeConfigVO {
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment