Browse Source

排序问题

shiqian 3 years ago
parent
commit
e8aee930f9

+ 13 - 2
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardMapper.java

@@ -711,8 +711,19 @@ public interface StandardMapper {
             }
         }
 
-        public static String orderBy(String orderBy){
-            return isNullOrEmpty(orderBy) ? " create_time desc " : orderBy;
+        public static String orderBy(String orderBy) {
+            String base = " create_time desc ";
+            if (isNullOrEmpty(orderBy)) {
+                return base;
+            }
+
+            String replace = orderBy.replace(" ", "");
+            if (replace.contains("create_timedesc")) {
+                return base;
+            }
+
+            return orderBy + ", " + base;
         }
+
     }
 }