|
jeecg封装后的CriteriaQuery是如何添加外连接呢?
@RequestMapping(params = "datagrid")
public void datagrid(WqPlantEntity wqPlant,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WqPlantEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wqPlant, request.getParameterMap());
try{
//自定义追加查询条件
cq.createAlias("wqCompanyEntity", "wqCompanyEntity"); //子对象
cq.eq("wqCompanyEntity.ID", wqPlant.getCompanyId());
cq.add();
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.wqPlantService.getDataGridReturn(cq, true);
List list = dataGrid.getResults();
HashMap hs = new HashMap();
for(int i=0;i<list.size();i++)
{
HashMap b = new HashMap();
WqPlantEntity wp =(WqPlantEntity) list.get(i);
b.put("companyCode",wp.getWqCompanyEntity().getCompanyCode());
b.put("companyNameAlt",wp.getWqCompanyEntity().getCompanyNameAlt());
hs.put(wp.getId(),b);
}
TagUtil.datagrid(response, dataGrid,hs );
}
|
|