在jeecg 原生代码下,新增拓展字段
@RequestMapping(params = "datagrid")
public void datagrid(LdcSupplierEntity ldcSupplier,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(LdcSupplierEntity.class, dataGrid);
if(StringUtil.isNotEmpty(ldcSupplier.getSupCompany())){
ldcSupplier.setSupCompany("*"+ldcSupplier.getSupCompany()+"*");
}
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, ldcSupplier, request.getParameterMap());
try{
cq.add(Restrictions.sqlRestriction("ifnull(del_status,'0') !='1'"));
cq.add(Restrictions.sqlRestriction("ifnull(is_state,'0') !='1'"));
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.ldcSupplierService.getDataGridReturn(cq, true);
List<LdcSupplierEntity> list = dataGrid.getResults();
Map<String,Map<String,Object>> extMap = new HashMap<String, Map<String,Object>>();
for (LdcSupplierEntity sup : list) {
Map m = new HashMap();
int cnt = 0;
if("2".equals(sup.getIsInternational())) {
cnt = jdbcTemplate.queryForInt("SELECT COUNT(1) AS num FROM ldc_order WHERE hw_supplier LIKE '%"+sup.getId()+"%'");
}
m.put("hwbusinessNum",cnt);
extMap.put(sup.getId(), m);
}
TagUtil.datagrid(response, dataGrid,extMap);
}