查询时传入的参数别管,查询到表里的数据后,我是用model.addAttribute("openbeds_numbers", baseInfoData.getOpenbeds_numbers());,这个来给表单里的某项赋值的,但是我的前台表单里其实有大约100条数据,如果我每条数据都这么赋值,好笨啊,我要怎样才能一次性将从表里查出的数据都赋值到表单对应的地方?
Controller类我是这么写的
/**
* 查询数据
*/
@RequestMapping(value = "/main/list.action")
public String list(Model model){
String user_department = "测试科室1";
String report_year = "2018";
String report_quarter = "1季度";
BaseInfoData baseInfoData = nursingQualityDataService
.selectBaseInfoDataByDepartmentAndYearQuarter(user_department, report_year, report_quarter);
model.addAttribute("openbeds_numbers", baseInfoData.getOpenbeds_numbers());
return "main";
}
前台表单大致代码
<body>
<div>
<form id="nq_data">
<div class="col-md-4 form-group">
<label for="name">编号</label>
<input type="text" class="form-control" id="openbeds_numbers"
placeholder="0" value="${openbeds_numbers }" name="openbeds_numbers">
</div>
<div class="col-md-4 form-group">
<label for="name">人数</label>
<input type="text" class="form-control" id="pnurse_begin_totalnumbers"
placeholder="0" name="pnurse_begin_totalnumbers">
</div>
<div class="col-md-4 form-group">
<label for="name">票数数</label>
<input type="text" class="form-control" id="pnurse_end_totalnumbers"
placeholder="0" name="pnurse_end_totalnumbers">
</div>
</form>
</div>
</body>