first can version
This commit is contained in:
33
common/.gitignore
vendored
33
common/.gitignore
vendored
@@ -1,33 +0,0 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>ProjectOctopus</artifactId>
|
||||
<groupId>io.wdd</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>io.wdd</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<name>common</name>
|
||||
<description>common</description>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,13 +0,0 @@
|
||||
package io.wdd.common;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CommonApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CommonApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package io.wdd.common;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class R<T> {
|
||||
|
||||
|
||||
int code;
|
||||
|
||||
String msg;
|
||||
|
||||
T data;
|
||||
|
||||
private R(int code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public R() {
|
||||
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data) {
|
||||
return resetResult(data, ResultStat.SUCCESS);
|
||||
}
|
||||
|
||||
public static <T> R<T> okNoData() {
|
||||
return new R();
|
||||
}
|
||||
|
||||
public static <T> R<T> failed(T data) {
|
||||
return resetResult(data, ResultStat.FAILED);
|
||||
}
|
||||
|
||||
// access from inner
|
||||
private static <T> R<T> resetResult(T data, ResultStat resultStat) {
|
||||
return new R(resultStat.getCode(), resultStat.getDescription(), data);
|
||||
}
|
||||
|
||||
// access to public
|
||||
public static <T> R<T> resetResult(int code, String msg, T data) {
|
||||
return new R<>(code
|
||||
, msg, data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package io.wdd.common;
|
||||
|
||||
public enum ResultStat {
|
||||
|
||||
SUCCESS(1000, "success"),
|
||||
|
||||
FAILED(5001, "failed"),
|
||||
|
||||
VALIDATE_FAILED(1002, "参数校验失败"),
|
||||
|
||||
PARAM_ERROR(1003, "请求参数错误!"),
|
||||
|
||||
|
||||
|
||||
BAD(5001, "all error !");
|
||||
|
||||
int code;
|
||||
|
||||
String description;
|
||||
|
||||
ResultStat(int code, String description){
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription(){
|
||||
return description;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Reference in New Issue
Block a user