Pre Merge pull request !363 from Regxi/yangsj
This commit is contained in:
@ -52,7 +52,7 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- JSON工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@ -124,7 +124,6 @@
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
@ -3,6 +3,8 @@ package com.ruoyi.common.core.controller;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.page.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
@ -12,9 +14,6 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
@ -22,7 +21,7 @@ import com.ruoyi.common.utils.sql.SqlUtil;
|
||||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class BaseController
|
||||
@ -89,6 +88,31 @@ public class BaseController
|
||||
return rspData;
|
||||
}
|
||||
|
||||
protected VisualRespData getVisualData(List<?> list){
|
||||
VisualRespData respData = new VisualRespData();
|
||||
respData.setCode(HttpStatus.SUCCESS);
|
||||
respData.setSuccess(true);
|
||||
respData.setMsg("操作成功");
|
||||
respData.setData(list);
|
||||
return respData;
|
||||
}
|
||||
|
||||
protected VisualRespEmbData getVisualEmbData(List<?> list){
|
||||
VisualRespEmbData respData = new VisualRespEmbData();
|
||||
VisualData data = new VisualData();
|
||||
PageInfo<?> pageInfo = new PageInfo<>(list);
|
||||
data.setTotal(pageInfo.getTotal());
|
||||
data.setCurrent(pageInfo.getPageNum());
|
||||
data.setRecords(list);
|
||||
respData.setData(data);
|
||||
|
||||
return respData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
@ -123,7 +147,7 @@ public class BaseController
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
*
|
||||
* @param rows 影响行数
|
||||
* @return 操作结果
|
||||
*/
|
||||
@ -134,7 +158,7 @@ public class BaseController
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
*
|
||||
* @param result 结果
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
@ -0,0 +1,84 @@
|
||||
package com.ruoyi.common.core.page;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class VisualData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
this.hitCount = false;
|
||||
this.searchCount = true;
|
||||
// this.orders =
|
||||
}
|
||||
private Integer current;
|
||||
private Boolean hitCount;
|
||||
|
||||
private List<?> orders;
|
||||
|
||||
private Integer pages;
|
||||
private List<?> records;
|
||||
private Boolean searchCount;
|
||||
private Long total;
|
||||
|
||||
public VisualData() {
|
||||
}
|
||||
|
||||
public Integer getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(Integer current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public Boolean getHitCount() {
|
||||
return hitCount;
|
||||
}
|
||||
|
||||
public void setHitCount(Boolean hitCount) {
|
||||
this.hitCount = hitCount;
|
||||
}
|
||||
|
||||
public List<?> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(List<?> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
|
||||
public Integer getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(Integer pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public List<?> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public void setRecords(List<?> records) {
|
||||
this.records = records;
|
||||
}
|
||||
|
||||
public Boolean getSearchCount() {
|
||||
return searchCount;
|
||||
}
|
||||
|
||||
public void setSearchCount(Boolean searchCount) {
|
||||
this.searchCount = searchCount;
|
||||
}
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.ruoyi.common.core.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class VisualRespData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 消息状态码 */
|
||||
private int code;
|
||||
|
||||
private Boolean success;
|
||||
|
||||
private String msg;
|
||||
|
||||
private List<?> data;
|
||||
|
||||
public VisualRespData() {
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public List<?> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<?> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VisualRespData{" +
|
||||
"code=" + code +
|
||||
", success=" + success +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.ruoyi.common.core.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class VisualRespEmbData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
this.code = 200;
|
||||
this.msg = "操作成功";
|
||||
this.success = true;
|
||||
}
|
||||
|
||||
|
||||
/** 消息状态码 */
|
||||
private int code;
|
||||
|
||||
private Boolean success;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Object data;
|
||||
|
||||
public VisualRespEmbData() {
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VisualRespEmbData{" +
|
||||
"code=" + code +
|
||||
", success=" + success +
|
||||
", msg='" + msg + '\'' +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user