Feat:添加默认的查询实体
This commit is contained in:
parent
b7d6628ac4
commit
66a1f23216
|
@ -1,6 +1,6 @@
|
||||||
package com.flyfish.framework.bean;
|
package com.flyfish.framework.bean;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.flyfish.framework.constant.Frameworks;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
@ -144,7 +144,11 @@ public class Result<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return Frameworks.config.isResultStyle() ? null : data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getResult() {
|
||||||
|
return Frameworks.config.isResultStyle() ? data : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(T data) {
|
public void setData(T data) {
|
||||||
|
@ -160,7 +164,11 @@ public class Result<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMsg() {
|
public String getMsg() {
|
||||||
return msg;
|
return Frameworks.config.isResultStyle() ? null : msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return Frameworks.config.isResultStyle() ? msg : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMsg(String msg) {
|
public void setMsg(String msg) {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.flyfish.framework.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 框架配置
|
||||||
|
* @author wangyu
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class FrameworkConfiguration {
|
||||||
|
|
||||||
|
private boolean resultStyle = false;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.flyfish.framework.constant;
|
||||||
|
|
||||||
|
import com.flyfish.framework.config.FrameworkConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 框架静态配置
|
||||||
|
*
|
||||||
|
* @author wangyu
|
||||||
|
*/
|
||||||
|
public interface Frameworks {
|
||||||
|
|
||||||
|
FrameworkConfiguration config = new FrameworkConfiguration();
|
||||||
|
|
||||||
|
static void resultStyle() {
|
||||||
|
config.setResultStyle(true);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue