Gab*_*sta 0 html sql-order-by thymeleaf
我需要foreach按订单显示这个,我该Asc怎么做?
<tr th:each="ment : ${mentor}" th:if="${ment.jobId == job.id}">
    <td th:text="${ment.id}"></td>
    <td th:text="${ment.name}"></td>
    <td th:text="${ment.qtyMentee}"></td>
    <td th:text="${ment.jobId}"></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
    这可以通过列表的 sort 实用程序方法来实现,描述为here。
/*
 * Sort a copy of the given list. The members of the list must implement
 * comparable or you must define a comparator.
 */
${#lists.sort(list)}
${#lists.sort(list, comparator)}
Run Code Online (Sandbox Code Playgroud)
例子
<tr th:each="ment : ${#lists.sort(mentor)}">
Run Code Online (Sandbox Code Playgroud)