|
|
@ -955,6 +955,7 @@ public class Criteria implements Predicate { |
|
|
|
|
|
|
|
|
|
|
|
boolean leftNullish = isNullish(left); |
|
|
|
boolean leftNullish = isNullish(left); |
|
|
|
boolean rightNullish = isNullish(right); |
|
|
|
boolean rightNullish = isNullish(right); |
|
|
|
|
|
|
|
BigDecimal bigDecimal; |
|
|
|
|
|
|
|
|
|
|
|
if (leftNullish && !rightNullish) { |
|
|
|
if (leftNullish && !rightNullish) { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
@ -965,12 +966,12 @@ public class Criteria implements Predicate { |
|
|
|
} else if (left instanceof String && right instanceof String) { |
|
|
|
} else if (left instanceof String && right instanceof String) { |
|
|
|
String expected = unescape((String) left); |
|
|
|
String expected = unescape((String) left); |
|
|
|
return expected.compareTo((String) right); |
|
|
|
return expected.compareTo((String) right); |
|
|
|
} else if (left instanceof Number && right instanceof Number) { |
|
|
|
|
|
|
|
return new BigDecimal(left.toString()).compareTo(new BigDecimal(right.toString())); |
|
|
|
|
|
|
|
} else if (left instanceof Number && right instanceof BigDecimal) { |
|
|
|
} else if (left instanceof Number && right instanceof BigDecimal) { |
|
|
|
return new BigDecimal(left.toString()).compareTo((BigDecimal)right); |
|
|
|
return new BigDecimal(left.toString()).compareTo((BigDecimal)right); |
|
|
|
} else if (left instanceof String && right instanceof Number) { |
|
|
|
} else if (left instanceof Number && right instanceof Number) { |
|
|
|
return new BigDecimal(left.toString()).compareTo(new BigDecimal(right.toString())); |
|
|
|
return new BigDecimal(left.toString()).compareTo(new BigDecimal(right.toString())); |
|
|
|
|
|
|
|
} else if (left instanceof String && right instanceof Number && (bigDecimal = safeBigDecimal((String)left)) != null) { |
|
|
|
|
|
|
|
return bigDecimal.compareTo(new BigDecimal(right.toString())); |
|
|
|
} else if (left instanceof String && right instanceof Boolean) { |
|
|
|
} else if (left instanceof String && right instanceof Boolean) { |
|
|
|
Boolean e = Boolean.valueOf((String) left); |
|
|
|
Boolean e = Boolean.valueOf((String) left); |
|
|
|
Boolean a = (Boolean) right; |
|
|
|
Boolean a = (Boolean) right; |
|
|
@ -988,6 +989,14 @@ public class Criteria implements Predicate { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static BigDecimal safeBigDecimal(final String value) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
return new BigDecimal(value); |
|
|
|
|
|
|
|
} catch (NumberFormatException exc) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static boolean isNullish(Object o) { |
|
|
|
private static boolean isNullish(Object o) { |
|
|
|
return (o == null || ((o instanceof String) && ("null".equals(o)))); |
|
|
|
return (o == null || ((o instanceof String) && ("null".equals(o)))); |
|
|
|
} |
|
|
|
} |
|
|
|