效果:
1.把数据查询出来(下面是mybatis-plus的单表查询)
EntityWrapper<BasPatientstype> EWBasPatientstype = new EntityWrapper<BasPatientstype>();
EWBasPatientstype.eq("delete_flag", 0);//条件
List<BasPatientstype> listBasPatientstype = basPatientstypeService.selectList(EWBasPatientstype);
2.把查询出来的数据存放到Map中
Map<String, Object> map = new HashMap<String, Object>();
//查询病人类型
EntityWrapper<BasPatientstype> EWBasPatientstype = new EntityWrapper<BasPatientstype>();
EWBasPatientstype.eq("delete_flag", 0);//条件
List<BasPatientstype> listBasPatientstype = basPatientstypeService.selectList(EWBasPatientstype);
map.put("listBasPatientstype", listBasPatientstype);
3、把Map集合存放到ModelAndView中返回jsp页面
/**
* 添加病人挂号数据准备
* @author lichenglong
* @return
* @date 2017年10月30日 上午11:10:32
*/
@ResponseBody
@RequestMapping("/findDataPreparation")
public ModelAndView findDataPreparation(){
//返回新的ModelAndView
ModelAndView ma = new ModelAndView();
Map<String, Object> map = new HashMap<String, Object>();
//查询病人类型
EntityWrapper<BasPatientstype> EWBasPatientstype = new EntityWrapper<BasPatientstype>();
EWBasPatientstype.eq("delete_flag", 0);//条件
List<BasPatientstype> listBasPatientstype = basPatientstypeService.selectList(EWBasPatientstype);
map.put("listBasPatientstype", listBasPatientstype);
ma.addAllObjects(map);//返回数据
ma.setViewName("/assets/outpatientCharges/registrationFee/addRegistrationFee");//跳转链接
return ma;
}
4.jsp代码
<select id="lunch" name="bookTypeId" class="selectpicker" data-live-search="true" >
<option value="">请选择</option>
<c:forEach items="${listBasPatientstype }" var="data">
<option value="${data.id }">${data.patientstype }</option>
</c:forEach>
</select>