`

bbossgroups标签库使用大全(续三)-新增功能特性详解

阅读更多
bbossgroups标签库使用大全(续三)-bboss最近新增三个功能特性,本文详细介绍之。
1.部分逻辑标签(equal,notequal,upper,lower,upperequal,lowerequal,
in,notin)增加length属性
<!-- 
		用于设置获取集合,字符串长度的变量名称,可对Collection,ListInfo,String,Map,Array类型对象求长度操作
	  
	 length属性值带有前缀cell,request,session,pagecontext:
	 cell 从对象属性中获取属性值得长度
	 request 从request属性中获取属性值得长度
	 parameter 从request参数中获取属性值得长度
	 session 从session属性中获取属性值得长度
	 pagecontext 从pagecontext属性中获取属性值得长度
	 默认从cell中获取对象属性
	 length属性适用于equal,notequal,upper,lower,upperequal,lowerequal,
	 in,notin标签
		 -->
		<attribute>
			<name>length</name>
			<rtexprvalue>true</rtexprvalue>
		</attribute>


2.list标签增加position,start属性,用来直接展示对应位置的对象
position属性标识只输出集合中postion位置对应的对象数据,如果postion超出集合大小,则抛出异常
start属性指示从start开始的位置输出集合中的后续元素,忽略start之前的数据,start小于0从第一个位置开始迭代数据,start大于集合大小则不输出任何数据。

上述两个改造使用实例:
<pg:equal length="request:rejectList" value="1">
		
		if(confirm("确实要驳回"))//驳回
			{
				<pg:list requestKey="rejectList" position="0">
					$("#approveForm #pass").val("<pg:cell colName='nodeCode'/>");
				</pg:list>									
				$("#approveForm").submit();
			}
			return false;
			
	</pg:equal>
<pg:list requestKey="rejectList" start="2">
					$("#approveForm #pass").val("<pg:cell colName='nodeCode'/>");
				</pg:list>



3.增加size标签,用来输出Collection,ListInfo,String,Map,Array类型对象求长度
<pg:size requestKey="rejectList"/>

<pg:size requestKey="rejectList" increament="1"/>

increament属性含义,输出size+increament的和,可以为负数,也可以为正数。
分享到:
评论
4 楼 yin_bp 2014-09-29  
另外在逻辑表达式属性中可以使用的标签内置变量,可以参考文档中的【2 保留变量】章节 :
bbossgroups标签库使用大全(续二)-表达式使用
3 楼 yin_bp 2014-09-29  
sql语句无需修改
加入统计信息(设置总记录数进去的时候做了修改):  
ListInfo datas=null;
		condition.setHotelcode(getHotelCode());
		datas=service.queryCustPerformListInfo(offset, pagesize,condition);	
               if(datas != null)
{	
		//加入统计信息
		CustPerforStatisEntity bean = service.queryCustPerformStatis(condition);
		List list = datas.getDatas();
		list.add(bean);
}
		model.addAttribute("datas", datas);	
		return "path:custperformlist";



JSP页面 修改如下:
<div id="customContent">
<pg:empty actual="${datas}" >
	<div class="nodata">
	<img src="${pageContext.request.contextPath}<pg:message code='sany.pdp.common.list.nodata.path'/>"/></div>
</pg:empty> 
<pg:notempty actual="${datas}">
   <pg:pager scope="request"  data="datas" desc="false" isList="false" containerid="custombackContainer" selector="customContent">
	<!-- 加入 class="tableOutline" 可控制表格宽度,滚动条展示 -->
	<div id="changeColor" >
	 <table width="100%" border="0" cellpadding="0" cellspacing="0" class="stable" id="tb">
        <pg:header>
       		<th>序号</th>
       		<th>日期</th>
       		<th>房数</th>
       		<th>人数</th>
       		<th>房费</th>
       		<th>餐费</th>
       		<th>康乐费</th>
       		<th>其它费用</th>
       		<th>总费用</th>
       		<th>佣金</th>
       	</pg:header>	
      <pg:list>
         <!-- 不是当前页最后一条记录 -->
         <pg:notequal expression="{rowid}" expressionValue="{pagesize}-1">
              <tr  onDblClick="clickrow('<pg:cell colName="id" />')">
                <td width="10px"><pg:rowid increament="1" offset="false"/></td>
                <td><pg:cell colName="hoteldate" /></td>	  
                <td><pg:cell colName="roomnumb" /></td>	  
                <td><pg:cell colName="peoplenumb" /></td>	  
                <td><pg:cell colName="roomcharge" /></td>	  
                <td><pg:cell colName="meals" /></td>	  
                <td><pg:cell colName="kanglefee" /></td>	  
                <td><pg:cell colName="otherexpen" /></td>	  
                <td><pg:cell colName="totalfee" /></td>	  
                <td><pg:cell colName="commision" /></td>	  
              </tr>
	  </pg:notequal>
	<!-- 是当前页最后一条记录,这条记录就是总计记录,可以根据要求进行处理和展示 -->			    
	 <pg:equal expression="{rowid}" expressionValue="{pagesize}-1">
               <tr  onDblClick="clickrow('<pg:cell colName="id" />')">
                <td width="10px"><pg:rowid increament="1" offset="false"/></td>
                <td><pg:cell colName="hoteldate" /></td>	  
                <td><pg:cell colName="roomnumb" /></td>	  
                <td><pg:cell colName="peoplenumb" /></td>	  
                <td><pg:cell colName="roomcharge" /></td>	  
                <td><pg:cell colName="meals" /></td>	  
                <td><pg:cell colName="kanglefee" /></td>	  
                <td><pg:cell colName="otherexpen" /></td>	  
                <td><pg:cell colName="totalfee" /></td>	  
                <td><pg:cell colName="commision" /></td>	  
              </tr>
	 </pg:equal>
   		
	 </pg:list>
    </table>
    </div>
	<div class="pages"><input type="hidden" value="<pg:querystring/>" id="querystring"/><pg:index tagnumber="10" sizescope="5,10,20,50,100"/></div>

    </pg:pager>
    </pg:notempty>
</div>	


2 楼 ljthinkpad 2014-09-29  
取 列表数据的SQL:
select
t.custcomid  ,
to_char(t.hoteldate,'yyyy-MM')  hoteldate,
sum(nvl(t.roomnumb,0)) roomnumb ,
sum(nvl(t.peoplenumb,0)) peoplenumb,
sum(nvl(t.roomcharge,0)) roomcharge,
sum(nvl(t.meals,0)) meals      ,
sum(nvl(t.kanglefee,0))  kanglefee,
sum(nvl(t.otherexpen,0)) otherexpen,
sum(nvl(t.totalfee,0))  totalfee ,
sum(nvl(t.commision,0)) commision 
from sd_cust_perfor_statis t
where t.hotelcode = #[hotelcode]
#if($custcomid && !$custcomid.equals(""))
and t.custcomid = #[custcomid]
  #end
  #if($startime && !$startime.equals(""))
and trunc(t.hoteldate) >= #[startime]
#end
#if($endtime && !$endtime.equals(""))
and trunc(t.hoteldate) <= #[endtime]
  #end
  group by t.custcomid,to_char(t.hoteldate,'yyyy-MM')


取统计信息的SQL:
select
t.custcomid  ,
to_char(t.hoteldate,'yyyy-MM')  hoteldate,
sum(nvl(t.roomnumb,0)) roomnumb ,
sum(nvl(t.peoplenumb,0)) peoplenumb,
sum(nvl(t.roomcharge,0)) roomcharge,
sum(nvl(t.meals,0)) meals      ,
sum(nvl(t.kanglefee,0))  kanglefee,
sum(nvl(t.otherexpen,0)) otherexpen,
sum(nvl(t.totalfee,0))  totalfee ,
sum(nvl(t.commision,0)) commision 
from sd_cust_perfor_statis t
where t.hotelcode = #[hotelcode]
#if($custcomid && !$custcomid.equals(""))
and t.custcomid = #[custcomid]
  #end
  #if($startime && !$startime.equals(""))
and trunc(t.hoteldate) >= #[startime]
#end
#if($endtime && !$endtime.equals(""))
and trunc(t.hoteldate) <= #[endtime]
  #end
加入统计信息:  
ListInfo datas=null;
condition.setHotelcode(getHotelCode());
datas=service.queryCustPerformListInfo(offset, pagesize,condition);
//加入统计信息
CustPerforStatisEntity bean = service.queryCustPerformStatis(condition);
List list = datas.getDatas();
list.add(bean);
datas.setDatas(list);
model.addAttribute("datas", datas);
return "path:custperformlist";


JSP页面 
<div id="customContent">
<pg:empty actual="${datas}" >
<div class="nodata">
<img src="${pageContext.request.contextPath}<pg:message code='sany.pdp.common.list.nodata.path'/>"/></div>
</pg:empty>
<pg:notempty actual="${datas}">
   <pg:pager scope="request"  data="datas" desc="false" isList="false" containerid="custombackContainer" selector="customContent">
<!-- 加入 class="tableOutline" 可控制表格宽度,滚动条展示 -->
<div id="changeColor" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="stable" id="tb">
        <pg:header>
       <th>序号</th>
       <th>日期</th>
       <th>房数</th>
       <th>人数</th>
       <th>房费</th>
       <th>餐费</th>
       <th>康乐费</th>
       <th>其它费用</th>
       <th>总费用</th>
       <th>佣金</th>
       </pg:header>
      <pg:list>
   <tr  onDblClick="clickrow('<pg:cell colName="id" />')">
                <td width="10px"><pg:rowid increament="1" offset="false"/></td>
                <td><pg:cell colName="hoteldate" /></td>  
                <td><pg:cell colName="roomnumb" /></td>  
                <td><pg:cell colName="peoplenumb" /></td>  
                <td><pg:cell colName="roomcharge" /></td>  
                <td><pg:cell colName="meals" /></td>  
                <td><pg:cell colName="kanglefee" /></td>  
                <td><pg:cell colName="otherexpen" /></td>  
                <td><pg:cell colName="totalfee" /></td>  
                <td><pg:cell colName="commision" /></td>  
        </tr>
</pg:list>
    </table>
    </div>
<div class="pages"><input type="hidden" value="<pg:querystring/>" id="querystring"/><pg:index tagnumber="10" sizescope="5,10,20,50,100"/></div>

    </pg:pager>
    </pg:notempty>
</div>



1 楼 ljthinkpad 2014-09-29  
考虑全部的统计,不考虑每一页的统计。
我用语句把统计的数据放入ListInfo。
但是我用 <pg:list> 输出时,
我先输出0-list.size-1 然后在输出统计信息。 
<pg:list> 有指定输出多到行到多少行吗?

相关推荐

Global site tag (gtag.js) - Google Analytics