Эх сурвалжийг харах

修复字符串数字值排序问题

o2sword 5 жил өмнө
parent
commit
1066d38661

+ 20 - 1
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/Plan.java

@@ -112,7 +112,26 @@ public abstract class Plan extends GsonPropertyObject {
 					} else if (null == o2) {
 						comp = 1;
 					} else {
-						if (o1.getClass() == o2.getClass()) {
+						if(BooleanUtils.isTrue(en.numberOrder)){
+							if(StringUtils.isEmpty(o1.toString())){
+								c1 = new Integer(999999999);
+							}else{
+								try {
+									c1 = Integer.parseInt(o1.toString());
+								} catch (NumberFormatException e) {
+									c1 = new Integer(999999999);
+								}
+							}
+							if(StringUtils.isEmpty(o1.toString())){
+								c2 = new Integer(999999999);
+							}else{
+								try {
+									c2 = Integer.parseInt(o2.toString());
+								} catch (NumberFormatException e) {
+									c2 = new Integer(999999999);
+								}
+							}
+						}else if (o1.getClass() == o2.getClass()) {
 							c1 = (Comparable) o1;
 							c2 = (Comparable) o2;
 						} else {

+ 2 - 0
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/SelectEntry.java

@@ -19,6 +19,7 @@ public class SelectEntry extends GsonPropertyObject {
 		this.code = "";
 		this.allowOpen = false;
 		this.groupEntry = false;
+		this.numberOrder = false;
 	}
 
 	public Boolean available() {
@@ -38,6 +39,7 @@ public class SelectEntry extends GsonPropertyObject {
 	public Boolean allowOpen;
 	public Boolean isName;
 	public Boolean groupEntry;
+	public Boolean numberOrder;
 
 	public String getColumn() {
 		if (StringUtils.isNotEmpty(this.column)) {