|
楼主 |
发表于 2018-12-25 15:55:31
|
显示全部楼层
之后修改了action,还是未能完成分页显示,java代码如下:
public static Table queryWDProject(Integer page, Integer pageCount) {
int pageEnd = page * pageCount + 1;
int pageStart = (page - 1) * pageCount;
String sqlCount = "select b.ID,a.BUILDDATE,d.PROJECTNAME,c.PROGRAMNAME,b.SUBNAME,e.MAJORNAME,ROWNUM" + " from T_PRJ_ProgramSubProject_WD a "
+ " left join T_SYS_SubProject_WD b on(b.ID=a.SubProjectID)" + " left join T_PRJ_Program_WD c on(c.ID=a.ProgramID)" + " left join T_PRJ_Project d on(d.ID=c.ProjectID)"
+ " left join T_SYS_Major_WD e on(e.ID=c.majorid)";
String sqlPage = "select * from ( select rownum as rn,p.* from " +
"(select b.ID,a.BUILDDATE,d.PROJECTNAME,c.PROGRAMNAME,b.SUBNAME, e.MAJORNAME from T_PRJ_ProgramSubProject_WD a"
+ " left join T_SYS_SubProject_WD b on (b.ID = a.SubProjectID)"
+ " left join T_PRJ_Program_WD c on (c.ID = a.ProgramID)"
+ " left join T_PRJ_Project d on (d.ID = c.ProjectID)"
+ " left join T_SYS_Major_WD e on (e.ID = c.majorid)) p"
+ " where rownum<="+pageStart+") where rn > "+pageEnd;
Map<String, String> map = new HashMap<String, String>();
map.put(DatabaseProduct.DEFAULT.toString(), sqlCount);
map.put(DatabaseProduct.ORACLE.toString(), sqlCount);
map.put(DatabaseProduct.MSSQL.toString(), sqlCount);
Table t = SQL.select(map, null, BKMODEL);
Map<String, String> mt = new HashMap<String, String>();
mt.put(DatabaseProduct.DEFAULT.toString(), sqlPage);
mt.put(DatabaseProduct.ORACLE.toString(), sqlPage);
mt.put(DatabaseProduct.MSSQL.toString(), sqlPage);
System.out.println("pageTotal:"+t.size());
Table table = SQL.select(mt, null, BKMODEL);
table.getProperties().put(Table.PROP_DB_COUNT, t.size());
return table;
} |
|