为什么foreach循环会产生重复的值?

从上表中我想获取数据。我正在获取所有值,但第二个foreach循环会为循环内的给定生成重复值

请让我知道任何建议

 <div><table class="stt">
    <thead>
    <tr class="shade">
    <th>Dep Ver</th>
    <th >Order In Document Version</th>
    <th>DEP Number</th>
    <th>DEP Title</th>
    <th>DEP Revision Date</th>
    <th>Heading Hierarchy</th>
    <th>Section Item No</th>
    <th>SHALL[PS] Statement</th>
    <th>Requirement Type</th>
    <th>Discipline</th>
    <th>Risk Rating (P)</th>
    <th>Risk Rating (A)</th>
    <th>Risk Rating (C)</th>
    <th>Risk Rating (E)</th>
    </thead>
    </tr>

此foreach循环生成重复值

#foreach($workitem in $workitems) #set($wiType = $workitem.fields().type().optionId())
<tr>
  <td> $projectId</td>
  <td></td>
  <td>$workitem.fields.docNumber.render </td>
  #if($wiType.equals("document"))
  <td>$workitem.fields().description.render()</td>
  #else
  <td></td>
  #end
  <td></td>
  <td></td>
  <td></td>
  #if($wiType.equals("requirement"))
  <td>$workitem.fields().description.render()</td>
  #else
  <td></td>
  #end
  <td>$workitem.fields().type().render()</td>
  <td>$workitem.fields.discipline.render</td>
  #foreach($rs in $risks)
  <td>$rs.fields.P.render</td>
  <td>$rs.fields.A.render</td>
  <td>$rs.fields.C.render</td>
  <td>$rs.fields.E.render</td>
  #end
</tr>
#end
</table>
</div>