------------------------dao--------------------------
@Override
public List getAreaPersonStructure(){
Sql sql = Sqls.create(
"select * from (SELECT (CASE WHEN POPULATION_MODEL.age<=14 THEN '0-14岁'" +
" WHEN POPULATION_MODEL.age>14 and POPULATION_MODEL.age<=64 THEN '14-64岁'" +
" WHEN POPULATION_MODEL.age>64 THEN '65岁及以上'" +
" END)ranges, TO_CHAR(COUNT(1)) count from POPULATION_MODEL where POPULATION_MODEL.age is not null GROUP BY (CASE WHEN POPULATION_MODEL.age<=14 THEN '0-14岁'" +
" WHEN POPULATION_MODEL.age>14 and POPULATION_MODEL.age<=64 THEN '14-64岁'" +
" WHEN POPULATION_MODEL.age>64 THEN '65岁及以上'" +
" END))");
Entity entity = dao().getEntity(Map.class);
sql.setEntity(entity);
sql.setCallback(Sqls.callback.entities());
dao().execute(sql);
return sql.getList(Map.class);
}
--------------------控制台--------------------------
[DEBUG] 2018-08-29 16:35:59,049 org.nutz.mongo.ZMoCo.drop(ZMoCo.java:294) - db.statistics_table_data.drop()
[DEBUG] 2018-08-29 16:35:59,054 com.mongodb.diagnostics.logging.SLF4JLogger.debug(SLF4JLogger.java:56) - Sending command {drop : BsonString{value='statistics_table_data'}} to database GeoData on connection [connectionId{localValue:2, serverValue:10}] to server 127.0.0.1:27017
[DEBUG] 2018-08-29 16:35:59,146 com.mongodb.diagnostics.logging.SLF4JLogger.debug(SLF4JLogger.java:56) - Command execution completed
org.nutz.dao.DaoException: Need non-arg constructor : interface java.util.Map
at org.nutz.dao.impl.entity.NutEntity.(NutEntity.java:190)
at org.nutz.dao.impl.entity.AnnotationEntityMaker._createNutEntity(AnnotationEntityMaker.java:623)
at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:90)
at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:72)
at org.nutz.dao.impl.NutDao.getEntity(NutDao.java:682)
at cn.wizzer.app.templet.modules.service.impl.PopulationServiceImpl.getAreaPersonStructure(PopulationServiceImpl.java:426)
```