Bootstrap

jeecgboot 多表查询_jeecg中列表查询数据关联其他表的显示

1.A表字段:id,name;B表字段:id,name,fid(A表外键),现查询A表和B表的所有数据并且查询条件A,B都有,在前台页面list显示

2.后台方法:

@RequestMapping(params = "datagrid_zh")

public void datagrid_zh(CarRouteEntity ldcHandbookOrder,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {

CriteriaQuery cq = new CriteriaQuery(CarRouteEntity.class, dataGrid);

//查询条件组装器

org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, ldcHandbookOrder);

try{

//自定义追加查询条件

}catch (Exception e) {

throw new BusinessException(e.getMessage());

}

cq.add();

String tiaojian="";

String name=request.getParameter("name");

if(StringUtils.isNotEmpty(name)) {

tiaojian+=" and a.name>= '"+name+"'";

;