public NutMap order(int length, int start, int draw, List<DataTableOrder> orders, List<DataTableColumn> columns, Cnd cnd, String linkname) {
NutMap map = new NutMap();
if (orders != null && orders.size() > 0) {
for (DataTableOrder order : orders) {
DataTableColumn col = columns.get(order.getColumn());
cnd.orderBy(Sqls.escapeSqlFieldValue(col.getData()).toString(), order.getDir());
}
}
Pager pager = new OffsetPager(start, length);
Sql sql = Sqls.queryRecord("select a.id,a.number,a.time,a.status,a.pay_type," +
"b.id,b.course_id,b.price,b.orig," +
"c.id,c.name from edu_order a " +
"left join edu_course_order b on a.id = b.order_id " +
"left join edu_course c on b.course_id = c. id " +
" $condition");
sql.setCondition(cnd);
sql.setPager(pager);
dao().execute(sql);
List<Edu_order> order=new ArrayList<>();
List<Edu_course_order> courseOrder=new ArrayList<>();
List<Edu_course> course=new ArrayList<>();
List<Record> list = sql.getList(Record.class);
for (Record re : list) {
Edu_order o = re.toEntity(dao().getEntity(Edu_order.class),"a.");
Edu_course_order co=re.toEntity(dao().getEntity(Edu_course_order.class),"b.");
Edu_course c=re.toEntity(dao().getEntity(Edu_course.class),"c.");
order.add(o);
courseOrder.add(co);
course.add(c);
}
//一级表项 订单总览
map.put("order",order);
//次级表项 订单详情
map.put("courseOrder",courseOrder);
map.put("course",course);
map.put("draw", draw);
map.put("recordsTotal", length);
return map;
}
Edu_order o = re.toEntity(dao().getEntity(Edu_order.class),"a.");
Edu_course_order co=re.toEntity(dao().getEntity(Edu_course_order.class),"b.");
Edu_course c=re.toEntity(dao().getEntity(Edu_course.class),"c.");
这么写或者“a_”这样取得都是null 如果不用别名可以 但是查的字段有冲突所有的id这个一个都是一样的
是我写的格式不对吗