Pre Merge pull request !387 from 风之彼方/master
This commit is contained in:
commit
dc8c236f4c
16
pom.xml
16
pom.xml
|
|
@ -10,7 +10,7 @@
|
|||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>4.7.4</ruoyi.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -45,14 +45,14 @@
|
|||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
|
|
@ -219,6 +219,12 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- sonar插件 -->
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>3.9.1.2184</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
|
@ -257,4 +263,4 @@
|
|||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,182 @@
|
|||
package com.ruoyi.common.core.domain;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Result<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 总记录数 */
|
||||
private long total;
|
||||
|
||||
/** 列表数据 */
|
||||
private T data;
|
||||
|
||||
/** 消息状态码 */
|
||||
private int code;
|
||||
|
||||
/** 消息内容 */
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public Result()
|
||||
{
|
||||
this.code=200;
|
||||
}
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public Result(int code, String msg)
|
||||
{
|
||||
this.code=code;
|
||||
this.msg=msg;
|
||||
}
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public Result(T data)
|
||||
{
|
||||
this.code=200;
|
||||
this.data=data;
|
||||
}
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public Result(int code)
|
||||
{
|
||||
this.code=code;
|
||||
}
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param data 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public Result(T data, int total)
|
||||
{
|
||||
this.data = data;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Result(int code, String msg, T data)
|
||||
{
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Result(int code, String msg, T data, int total)
|
||||
{
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.msg = msg;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
|
||||
public static Result success(){
|
||||
return new Result();
|
||||
}
|
||||
public static <T> Result success(T data){
|
||||
return new Result(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Result error()
|
||||
{
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static Result error(String msg)
|
||||
{
|
||||
return Result.error(msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @param data 数据对象
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static <T> Result error(String msg, T data)
|
||||
{
|
||||
return new Result(500, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param code 状态码
|
||||
* @param msg 返回内容
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static Result error(int code, String msg)
|
||||
{
|
||||
return new Result(code, msg, null);
|
||||
}
|
||||
|
||||
|
||||
public long getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(long total)
|
||||
{
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public T getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue