Browse Source

列翻页时,不传total

master
郑根木 2 years ago
parent
commit
8b0c263e45
2 changed files with 13 additions and 2 deletions
  1. +5
    -2
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java
  2. +8
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/SwListData.java

+ 5
- 2
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java View File

@@ -58,7 +58,6 @@ public abstract class AbstractListHandler extends AbstractHandler {
List<SwMap> listData; List<SwMap> listData;
SqlPara sqlPara = buildDataSql(); SqlPara sqlPara = buildDataSql();



String sort = params.readString("sort"); String sort = params.readString("sort");
String order = params.readString("order"); String order = params.readString("order");
String sql; String sql;
@@ -73,7 +72,11 @@ public abstract class AbstractListHandler extends AbstractHandler {
listData = queryData(sql, sqlPara); listData = queryData(sql, sqlPara);


afterQuery(listData); afterQuery(listData);
return SwListData.create(listData, sqlPara.rows);
if (sqlPara.page <= 1) {
return SwListData.create(listData, sqlPara.rows);
} else {
return SwListData.create(listData);
}
} }


protected List<SwMap> queryData(String sql, SqlPara sqlPara) { protected List<SwMap> queryData(String sql, SqlPara sqlPara) {


+ 8
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/SwListData.java View File

@@ -30,6 +30,14 @@ public class SwListData {
} }
} }


public static SwListData create(List list) {
if (list == null) {
return SwListData.EMPTY;
}

return new SwListData(list, -1);
}

public boolean isEmpty() { public boolean isEmpty() {
return this.rows == null || this.rows.isEmpty(); return this.rows == null || this.rows.isEmpty();
} }


Loading…
Cancel
Save