自定义SQL是
SELECT bas_departures.ORGCHN, bas_departures.DESCHN,count(bas_departures.DESCHN) count FROM bas_departures WHERE bas_departures.ORGCHN='昆明' AND bas_departures.SDT='2017-03-20' GROUP BY bas_departures.DESCHN,bas_departures.ORGCHN
count()的结果命名为count
然后我用一个bo定义为
/**
* 始发站
*/
private String ORGCHN;
/**
* 目的地
*/
private String DESCHN;
/**
* 重复次数
*/
private String count;
/**
* 进港出港标识
*/
private String flag;
但是count 无法得到sql结果里的count()
String hardSql2 = "SELECT bas_departures.ORGCHN,bas_departures.DESCHN,count(bas_departures.DESCHN) count" +
" FROM bas_departures WHERE bas_departures.ORG='KMG'"+
" AND bas_departures.SDT='"+ DateUtil.getDate()+"' " +
" GROUP BY bas_departures.DESCHN,bas_departures.ORGCHN";//自己编写SQL
//自写sql查询
Sql sql = Sqls.create(hardSql2);
sql.setCallback(Sqls.callback.entities());
Entity<Departures> entity = dao.getEntity(Departures.class);
sql.setEntity(entity); //必须
dao.execute(sql);
List<Departures> fliList = sql.getList(Departures.class);
请兽总大神答疑解惑,跪谢