Sfoglia il codice sorgente

修改查询返回数量

张维新 5 anni fa
parent
commit
c5cd31c442

+ 3 - 3
gradle.properties

@@ -22,7 +22,7 @@
 #
 
 SAGA_URL = http://www.sagacloud.cn
-SAGA_KOTLIN_VERSION = 1.4.99
+SAGA_KOTLIN_VERSION = 1.4.104
 # android
 # SYBOTAN_KOTLIN_VERSION = 1.4.63
 
@@ -46,8 +46,8 @@ DOKKA_VERSION = 0.9.16
 # https://mvnrepository.com/artifact/com.alibaba/druid
 DRUID_VERSION = 1.1.21
 # https://mvnrepository.com/artifact/com.alibaba/fastjson
-FASTJSON_VERSION = 1.2.60
-# FASTJSON_VERSION = 1.1.70.android
+# FASTJSON_VERSION = 1.2.60
+FASTJSON_VERSION = 1.1.70.android
 # https://mvnrepository.com/artifact/org.hidetake/gradle-ssh-plugin
 GRADLE_SSH_VERSION = 2.10.1
 # https://mvnrepository.com/artifact/ca.coglinc/javacc-gradle-plugin

+ 5 - 1
saga-kotlin-database/src/main/kotlin/com/sybotan/database/SAbstractDao.kt

@@ -354,7 +354,11 @@ abstract class SAbstractDao<ENTITY: Any>(entityClazz: Class<ENTITY>) {
             "Boolean" -> field.getBoolean(entity)
             "String" ->  field.get(entity)
             else ->{
-                field.get(entity).toJson()
+                if (entity == null){
+                    null
+                }else{
+                    field.get(entity).toJson()
+                }
             }
         })
     } // Fun fieldToPair()

+ 8 - 1
saga-kotlin-postgresql/src/main/kotlin/com/sybotan/postgresql/SPostgreSqlDriver.kt

@@ -232,7 +232,14 @@ class SPostgreSqlDriver : SAbstractDriver() {
      * @return  LIMIT子句
      */
     override fun limit(offset: Int?, count: Int?): String {
-        return " OFFSET ${offset ?: 0} LIMIT ${count ?: 1}"
+        if (count == null){
+            return " OFFSET ${offset ?: 0} LIMIT ${count ?: 1}"
+        }else if (offset!=null&&count!=null){
+            return " OFFSET ${offset ?: 0} LIMIT ${offset+count}"
+        }else{
+            return " OFFSET ${offset ?: 0} LIMIT ${count ?: 1}"
+        }
+//        return " OFFSET ${offset ?: 0} LIMIT ${count ?: 1}"
     } // Fun limit()
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////