记录项目中关于c标签的c:when,c:forEach,c:set的处理
c:choose和c:when条件判断
<c:choose><c:when test="${!(empty dataList) && (fn:length(dataList))> 0 }">
c:forEach遍历
<c:forEach items="${dataList}" var="obj" varStatus="index">
c:set来进行累计
<c:set var="lastMonthPersonTotal" value="${lastMonthPersonTotal + daily.personNumberLastMonth }"></c:set>
整段代码如下:
<c:choose><c:when test="${!(empty dataList) && (fn:length(dataList))> 0 }">
<c:forEach items="${dataList}" var="obj" varStatus="index">
<c:choose>
<c:when test="${!(empty obj.departmentCapacityDailyModelList) && (fn:length(obj.departmentCapacityDailyModelList))> 0 }">
<c:forEach items="${obj.departmentCapacityDailyModelList}" var="daily" varStatus="index1">
<c:set var="lastMonthPersonTotal" value="${lastMonthPersonTotal + daily.personNumberLastMonth }"></c:set>
<c:set var="thisQuarterPersonTotal" value="${thisQuarterPersonTotal + daily.personNumberThisQuarter }"></c:set>
<c:set var="historyReturnWorkPersonTotal" value="${historyReturnWorkPersonTotal + daily.personTotalNumberRework }"></c:set>
<c:set var="todayReturnWorkPersonTotal" value="${todayReturnWorkPersonTotal + daily.personTodayNumberRework }"></c:set>
<c:set var="todayWorkPersonTotal" value="${todayWorkPersonTotal + daily.personTotalNumberWork }"></c:set>
<c:if test="${index1.count == 1 }">
<tr class="tableValue">
<td rowspan="${obj.dailyCount }">${index.count }</td>
<td rowspan="${obj.dailyCount }">${obj.departmentName }</td>
<td>${daily.departmentStation }</td>
<td <c:if test="${daily.personNumberLastMonth eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personNumberLastMonth }</td>
<td <c:if test="${daily.personNumberThisQuarter eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personNumberThisQuarter }</td>
<td <c:if test="${daily.personTotalNumberRework eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personTotalNumberRework }</td>
<td <c:if test="${daily.personTodayNumberRework eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personTodayNumberRework }</td>
<td <c:if test="${daily.personTotalNumberWork eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personTotalNumberWork }</td>
<td class="fc-default">${daily.rateQuarter }</td>
<td class="fc-default">${daily.lastMonthQuarter }</td>
</tr>
</c:if>
<c:if test="${index1.count > 1 }">
<tr class="tableValue">
<td>${daily.departmentStation }</td>
<td <c:if test="${daily.personNumberLastMonth eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personNumberLastMonth }</td>
<td <c:if test="${daily.personNumberThisQuarter eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personNumberThisQuarter }</td>
<td <c:if test="${daily.personTotalNumberRework eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personTotalNumberRework }</td>
<td <c:if test="${daily.personTodayNumberRework eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personTodayNumberRework }</td>
<td <c:if test="${daily.personTotalNumberWork eq '0' }">style="color:#dfdfdf;"</c:if>>${daily.personTotalNumberWork }</td>
<td class="fc-default">${daily.rateQuarter }</td>
<td class="fc-default">${daily.lastMonthQuarter }</td>
</tr>
</c:if>
</c:forEach>
</c:when>
</c:choose>
</c:forEach>
<tr class="tableValue">
<td colspan="3">汇总数据</td>
<td>${lastMonthPersonTotal }</td>
<td>${thisQuarterPersonTotal }</td>
<td>${historyReturnWorkPersonTotal }</td>
<td>${todayReturnWorkPersonTotal }</td>
<td>${todayWorkPersonTotal }</td>
<td>--</td>
<td>--</td>
</tr>
</c:when><c:otherwise>
<tr>
<td colspan="10" class="fc-red">没有获取到相关数据,请重新指定查询条件</td>
</tr>
</c:otherwise>
</c:choose>