调整 pom 结构
This commit is contained in:
parent
a041d2bfe9
commit
7064668ae5
|
|
@ -6,7 +6,7 @@ import lombok.Getter;
|
|||
* @author GYJoker
|
||||
*/
|
||||
@Getter
|
||||
public enum RespCode {
|
||||
public enum CzgRespCode {
|
||||
SUCCESS(200, "操作成功"),
|
||||
FAILURE(500, "操作失败"),
|
||||
SYSTEM_ERROR(555, "系统内部错误"),
|
||||
|
|
@ -18,7 +18,7 @@ public enum RespCode {
|
|||
private final int code;
|
||||
private final String msg;
|
||||
|
||||
RespCode(int code, String msg) {
|
||||
CzgRespCode(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import java.io.Serializable;
|
|||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> implements Serializable {
|
||||
public class CzgResult<T> implements Serializable {
|
||||
|
||||
private int code;
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ public class Result<T> implements Serializable {
|
|||
private T data;
|
||||
|
||||
// 私有构造函数,用于在类内部创建实例,强制通过静态方法来获取Result对象
|
||||
private Result(int code, String msg, T data) {
|
||||
private CzgResult(int code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
|
|
@ -27,36 +27,36 @@ public class Result<T> implements Serializable {
|
|||
// 以下是三个静态方法,分别用于创建不同状态的Result对象
|
||||
|
||||
// 创建成功的响应结果对象,默认消息和无数据情况
|
||||
public static <T> Result<T> success() {
|
||||
return new Result<>(200, "操作成功", null);
|
||||
public static <T> CzgResult<T> success() {
|
||||
return new CzgResult<>(200, "操作成功", null);
|
||||
}
|
||||
|
||||
// 创建成功的响应结果对象,携带指定的数据
|
||||
public static <T> Result<T> success(T data) {
|
||||
return new Result<>(200, "操作成功", data);
|
||||
public static <T> CzgResult<T> success(T data) {
|
||||
return new CzgResult<>(200, "操作成功", data);
|
||||
}
|
||||
|
||||
// 创建带有自定义消息的成功响应结果对象,携带指定的数据
|
||||
public static <T> Result<T> success(String msg, T data) {
|
||||
return new Result<>(200, msg, data);
|
||||
public static <T> CzgResult<T> success(String msg, T data) {
|
||||
return new CzgResult<>(200, msg, data);
|
||||
}
|
||||
|
||||
// 创建失败的响应结果对象,默认消息和无数据情况
|
||||
public static <T> Result<T> failure() {
|
||||
return new Result<>(500, "操作失败", null);
|
||||
public static <T> CzgResult<T> failure() {
|
||||
return new CzgResult<>(500, "操作失败", null);
|
||||
}
|
||||
|
||||
// 创建失败的响应结果对象,携带指定的自定义消息
|
||||
public static <T> Result<T> failure(String msg) {
|
||||
return new Result<>(500, msg, null);
|
||||
public static <T> CzgResult<T> failure(String msg) {
|
||||
return new CzgResult<>(500, msg, null);
|
||||
}
|
||||
|
||||
// 创建带有自定义状态码和消息的失败响应结果对象,无数据情况
|
||||
public static <T> Result<T> failure(int code, String msg) {
|
||||
return new Result<>(code, msg, null);
|
||||
public static <T> CzgResult<T> failure(int code, String msg) {
|
||||
return new CzgResult<>(code, msg, null);
|
||||
}
|
||||
|
||||
public static <T> Result<T> failure(RespCode respCode) {
|
||||
return new Result<>(respCode.getCode(), respCode.getMsg(), null);
|
||||
public static <T> CzgResult<T> failure(CzgRespCode respCode) {
|
||||
return new CzgResult<>(respCode.getCode(), respCode.getMsg(), null);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>cash-common-dependencies</module>
|
||||
<module>cash-common-tools</module>
|
||||
<module>cash-common-sa-token</module>
|
||||
</modules>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common</artifactId>
|
||||
<artifactId>cash-common-tools</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
Loading…
Reference in New Issue