NutzCN Logo
问答 我dao的cnd有点怪,....
发布于 2680天前 作者 蛋蛋的忧伤 1872 次浏览 复制 上一个帖子 下一个帖子
标签:

我的代码:

 List<Infomation> newInfo = infomationDao.query(Cnd.where(Infomation.TYPE_NAME,"=",Infotype.NEWS).orderBy().desc(Infomation.CREATE_TIME), new Pager().setPageSize(2));//最新资讯,两个带图的

        List<Infomation> newInfo2 = infomationDao.query(Cnd.where(Infomation.TYPE_NAME,"=",Infotype.NEWS).orderBy().desc(Infomation.CREATE_TIME), new Pager().setPageSize(4));//最新资讯,四个

        List<Infomation> tongzhi = infomationDao.query(Cnd.where(Infomation.TYPE_NAME,"=",Infotype.TONGZHI).orderBy().desc(Infomation.CREATE_TIME), new Pager().setPageSize(4));//最新资讯,四个

        //微商观察
        List<Infomation> guancha = infomationDao.query(Cnd.where(Infomation.TYPE_NAME,"=",Infotype.JIEDU).orderBy().desc(Infomation.CREATE_TIME), new Pager().setPageSize(3));//微商观察,3个

明明指定了按类型查,然后再排序,但是执行的sql是:

[DEBUG] 11:13:14.576 org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:192) - SELECT * FROM infomation  ORDER BY create_time DESC   LIMIT 0, 2 
[DEBUG] 11:13:31.621 org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:276) - batch acquisition of 0 triggers
[DEBUG] 11:13:31.626 org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:192) - SELECT * FROM infomation  ORDER BY create_time DESC   LIMIT 0, 4 
[DEBUG] 11:13:33.726 org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:192) - SELECT * FROM infomation  ORDER BY create_time DESC   LIMIT 0, 4 
[DEBUG] 11:13:35.878 org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:192) - SELECT * FROM infomation  ORDER BY create_time DESC   LIMIT 0, 3 

为什么我的where没了呢....

2 回复

然后我这么写就好了....

 //微商观察
        List<Infomation> guancha = infomationDao.query(Cnd.where(Infomation.TYPE_NAME,"=",Infotype.JIEDU).orderBy(Infomation.CREATE_TIME,"desc"), new Pager().setPageSize(3));//微商观察,3个

无参数的orderBy是静态方法哦

添加回复
请先登陆
回到顶部