package com.vci.ubcs.starter.web.pagemodel;
|
//
|
// Source code recreated from a .class file by IntelliJ IDEA
|
// (powered by FernFlower decompiler)
|
//
|
|
//package com.vci.starter.web.pagemodel;
|
|
import com.alibaba.fastjson.annotation.JSONField;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import java.io.Serializable;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public class BaseQueryObject implements Serializable {
|
@JSONField(
|
serialize = false,
|
deserialize = false
|
)
|
private static final long serialVersionUID = 5608634730007623041L;
|
@JSONField
|
private Map<String, String> conditionMap = new HashMap();
|
@JSONField
|
private int page = 1;
|
@JSONField
|
private String sort;
|
@JSONField
|
private String order;
|
@JSONField
|
private int limit = 25;
|
|
public BaseQueryObject() {
|
}
|
|
public BaseQueryObject(Map<String, String> conditionMap) {
|
this.setConditionMap(conditionMap);
|
}
|
|
public BaseQueryObject(int limit) {
|
this.setLimit(limit);
|
}
|
|
public BaseQueryObject(Map<String, String> conditionMap, int limit) {
|
this.setConditionMap(conditionMap);
|
this.setLimit(limit);
|
}
|
|
public Map<String, String> getConditionMap() {
|
return this.conditionMap;
|
}
|
|
public Map<String, String> getConditionMapByNick(String nick) {
|
if (this.conditionMap != null) {
|
Map<String, String> conditionMapHasNick = new HashMap();
|
this.conditionMap.forEach((k, v) -> {
|
if (!k.contains(".")) {
|
conditionMapHasNick.put(nick + "." + k, v);
|
} else {
|
conditionMapHasNick.put(k, v);
|
}
|
|
});
|
return conditionMapHasNick;
|
} else {
|
return null;
|
}
|
}
|
|
public void setConditionMap(Map<String, String> conditionMap) {
|
this.conditionMap = conditionMap;
|
}
|
|
public int getPage() {
|
return this.page;
|
}
|
|
public void setPage(int page) {
|
this.page = page;
|
}
|
|
public String getSort() {
|
return this.sort;
|
}
|
|
public void setSort(String sort) {
|
this.sort = sort;
|
}
|
|
public String getOrder() {
|
return this.order;
|
}
|
|
public void setOrder(String order) {
|
this.order = order;
|
}
|
|
public int getLimit() {
|
return this.limit;
|
}
|
|
public void setLimit(int limit) {
|
this.limit = limit;
|
}
|
|
@JSONField(
|
serialize = false,
|
deserialize = false
|
)
|
public PageHelper getPageHelper() {
|
PageHelper pageHelper = new PageHelper(this.limit);
|
pageHelper.setPage(this.getPage());
|
pageHelper.setSort(this.getSort());
|
pageHelper.setOrder(this.getOrder());
|
return pageHelper;
|
}
|
|
public BaseQueryObject addSort(String sort, String order) {
|
this.setSort(StringUtils.isBlank(this.getSort()) ? sort : this.getSort() + "," + sort);
|
this.setOrder(StringUtils.isBlank(this.getOrder()) ? order : this.getOrder() + "," + order);
|
return this;
|
}
|
|
public BaseQueryObject addCondition(String key, String value) {
|
if (this.getConditionMap() == null) {
|
this.conditionMap = new HashMap();
|
}
|
|
this.conditionMap.put(key, value);
|
return this;
|
}
|
|
public BaseQueryObject page(PageHelper pageHelper) {
|
this.setSort(pageHelper.getSort());
|
this.setOrder(pageHelper.getOrder());
|
this.setPage(pageHelper.getPage());
|
this.setLimit(pageHelper.getLimit());
|
return this;
|
}
|
|
@JSONField(
|
serialize = false,
|
deserialize = false
|
)
|
public Map<String, String> getFeignRequestMap() {
|
Map<String, String> feignRequestMap = new HashMap();
|
if (this.conditionMap != null) {
|
this.getConditionMap().forEach((k, v) -> {
|
feignRequestMap.put("conditionMap[\"" + k + "\"]", v);
|
});
|
}
|
|
feignRequestMap.put("page", this.getPage() + "");
|
feignRequestMap.put("limit", this.getLimit() + "");
|
feignRequestMap.put("sort", this.getSort());
|
feignRequestMap.put("order", this.getOrder());
|
return feignRequestMap;
|
}
|
|
@Override
|
public String toString() {
|
return "BaseQueryObject{conditionMap=" + this.conditionMap + ", page=" + this.page + ", sort='" + this.sort + '\'' + ", order='" + this.order + '\'' + ", limit=" + this.limit + '}';
|
}
|
|
}
|