fix:分页结束行计算错误的问题

yun-zuoyi
汪云昊 5 years ago
parent b4c90b01fa
commit a45d1ed104

@ -15,6 +15,7 @@ import org.springframework.data.mongodb.core.index.Indexed;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedHashMap;
/** /**
* @Description : * @Description :
@ -142,24 +143,41 @@ public abstract class BaseBean implements Serializable {
public transient Integer ascOrDesc = 1; public transient Integer ascOrDesc = 1;
public int getIsValidVal() { public int getIsValidVal() {
return this.isValid == null ? 0 : this.isValid.intValue(); return this.isValid == null ? 0 : this.isValid;
} }
public int getIsDeletedVal() { public int getIsDeletedVal() {
return this.isDeleted == null ? 0 : this.isDeleted.intValue(); return this.isDeleted == null ? 0 : this.isDeleted;
} }
@Transient
@ApiParam(value = "多列排序")
@AnnoOutputColumn(hidden = true)
public LinkedHashMap<String,Integer> sortParamMap;
//排序方式 //排序方式
public String orderBy(){ public String orderBy(){
String result = ""; StringBuffer result = new StringBuffer(" order by ");
if (orderByParam!=null&&orderByParam.trim().length()>0) {
result = " order by " + orderByParam; if (sortParamMap != null && sortParamMap.size() != 0) {
if(ascOrDesc == CommonEnumUtil.ASC_OR_DESC.ASC.getValue()) { for (String key : sortParamMap.keySet()) {
result += " asc"; packOrderByHql(result,orderByParam,ascOrDesc);
}else{
result += " desc";
} }
} else if (orderByParam != null && orderByParam.trim().length() > 0) {
packOrderByHql(result,orderByParam,ascOrDesc);
}else{
return "";
} }
return result; return result.subSequence(0, result.length() - 1).toString();
} }
private void packOrderByHql(StringBuffer stringBuffer, String orderByParam, Integer ascOrDesc) {
stringBuffer.append(" ").append(orderByParam);
if (ascOrDesc == null || ascOrDesc == CommonEnumUtil.ASC_OR_DESC.ASC.getValue()) {
stringBuffer.append(" asc");
} else {
stringBuffer.append(" desc,");
}
}
} }

Loading…
Cancel
Save