帆软报表_分页查询
利用帆软报表自带分页,在大量数据的情况下查询效率不高。如果数据过多,需要通过分页查询来提高查询效率,改善用户体验。因此需要用到分页查询。
1、添加条件控件
2、在数据集中编写sql语句
1、添加总页数,根据判断条件获取结果集的总条数
select ceil(count(*)/15) as a from
(select * from BI_CIMR002 where CENTER_DEPTNO IS NOT NULL
${if(len(DATE_START)==0,""," and POST_DATE >= to_date('"+DATE_START+"','yyyy-mm-dd')")}
${if(len(DATE_END)==0,""," and POST_DATE <= to_date('"+DATE_END+"','yyyy-mm-dd')")}
${if(len(DEPTNO)==0,""," and DEPTNO ='"+DEPTNO+"'")})
2、添加分页查询
**
先判断查询,后分页
**
select b.* from
(select a.*,rownum no from (
select * from BI_CIMR002 where CENTER_DEPTNO IS NOT NULL
${if(len(DATE_START)==0,""," and POST_DATE >= to_date('"+DATE_START+ "','yyyy-mm-dd')")}
${if(len(DATE_END)==0,""," and POST_DATE <= to_date('"+DATE_END+"','yyyy-mm-dd')")}
${if(len(DEPTNO)==0,""," and DEPTNO ='"+DEPTNO+"'")})a ) b
where no<=${pages}*10 and no>=(${pages}-1)*10