1.html页面
<select name="pid" >
<option value="" >--请选择--</option>
<option value="" th:selected="${p.pid == pid}" th:each="p : ${providers}" th:value="${p.pid}" th:text="${p.providerName}" >北京市粮油总公司</option>
<!--<option value="" th:selected="${pid == p.pid}" th:each="p : ${providers}" th:value="${p.pid}" th:text="${p.providerName}">-->
北京市粮油总公司
</option>
</select>
<option value="" th:selected="${p.pid == pid}" th:each="p : ${providers}" th:value="${p.pid}" th:text="${p.providerName}" >北京市粮油总公司</option>
2.controller
@GetMapping("/bills")
public String list(Map<String,Object> map,
Bill bill){
List<BillProvider> billProviders = billMapper.getBills(bill);
List<Provider> providers = providerMapper.getProviders(null);
map.put("billProviders",billProviders);
map.put("providers",providers);
// 用于搜索处回显数据
map.put("billName",bill.getBillName());
map.put("pid",bill.getPid());
map.put("pay",bill.getPay());
return "bill/list";
}