thymeleaf+SpringMVC 疑问解惑

qq_36268672 qq_36268672 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
问题描述:
controller 返回从DB查的数据List<obj>
假设该List里数据格式为
index0 A,1,2,3
index1 A,4,5,6
index2 A,7,8,9
index3 A,1,2,3
index4 B,10,11,12
index5 C,1,4,5
index6 D,1,2,3
页面预呈现
A
1 2 3
4 5 6
7 8 9
1 2 3
B
10 11 12
C
1 4 5
D
1 2 3

html代码如下:
                          <tbody id="resultData" >
<tr th:each="result, stat : ${resultList}">
<td th:if="判定条件(業者の場合)" th:text="${result.companySearchName}"><input type="checkbox" class="check-row check-g1"></td><!--業者名 -->
<td th:if="判定条件(業者の場合)" th:text="${result.spec}"></td><!-- 仕様 -->
<td th:if="判定条件(業者の場合)" th:text="${result.quantity}"></td><!-- 数量 -->
<td th:if="判定条件(業者の場合)" th:text="${result.quantityUnitName}"></td><!-- 単位 -->
<td th:if="判定条件(業者の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.unitPriceBudget}" readonly></td><!-- 単価 -->
<td th:if="判定条件(業者の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.amount}" readonly></td><!-- 金額 -->
<td th:if="判定条件(業者の場合)" th:text="${result.orderedFlag}"></td><!-- 発注済を非表示-->

<td th:if="判定条件(品目の場合)" class="check-row check-g1-row" ><input type="checkbox" class="check-all">[[${result.goodsName}]]</td><!-- 品名 -->
<td th:if="判定条件(品目の場合)" th:text="${result.spec}"></td><!-- 仕様 -->
<td th:if="判定条件(品目の場合)" th:text="${result.quantity}"></td><!-- 数量 -->
<td th:if="判定条件(品目の場合)" th:text="${result.quantityUnitName}"></td><!-- 単位 -->
<td th:if="判定条件(品目の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.unitPriceBudget}" readonly></td><!-- 単価 -->
<td th:if="判定条件(品目の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.amount}" readonly></td><!-- 金額 -->
<td th:if="判定条件(品目の場合)" th:text="${result.orderedFlag}"></td><!-- 発注済を非表示-->
</tr>
</tbody>


该代码呈现出来结果是这样



想要的是这样:


描述: 已经知道 LIST里的数据是从DB里查出来的,而且有顺序,
根据model里的 字母ID(也就是上图的ABC) 把从属于他们的数据汇总到一起
在画面中 字母字段 独占 一行。 从下一行 的首个方格开始排列从属于它们的数据
使用模板:thymeleaf。 返回数据是呈现在<TBODY>标签里。循环在<TR>里循环。SQL文 controller 皆可改动。

希望赐教:
代码不在身边,明天可以附上代码,越详细越好,越简单越好。 求解药。
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
qq_36268672
Web 开发 81,108 成员 341,721 内容