试了半天才试出来,thymeleaf 要用 switch 和 case 实现 if else:
<!-- 列表里显示 createTime -->
<td th:switch = "${ user.createTime != null }" >
<div th:case="true" th:text = "${#dates.format( user.createTime , 'yyyy-MM-dd' )}" ></div>
<div th:case="false" th:text = "‘---’" ></div>
</td>