NutzCN Logo
问答 sql.getList(RNews.class)取值为null,不报错也查不出来数据为什么?
发布于 2367天前 作者 wx_m34egglpcj6gvjmpmeh7 1849 次浏览 复制 上一个帖子 下一个帖子
标签:
@At
	@Filters
	@Ok("jsp:jsp.user.news_list")
	public Object query(@Param("n_title") String title,
			@Param("n_cateid") int cateid, @Param("btime") String btime,
			@Param("etime") String etime, @Param("..") Pager pager) {

		String str = "select * from r_news where 1=1 ";
		Sql sql = Sqls.create(str);
		sql.setEntity(dao.getEntity(RNews.class));
		if(title!=null){
			str += "or n_title like @title";
			sql.params().set("title", title);
		}
		if(cateid != 0){
			str += "or n_cateid = @cateid";
			sql.params().set("cateid", cateid);
		}
		if(btime!=null && etime!=null){
			str += "or n_p_date BETWEEN  @btime AND @etime";
			sql.params().set("btime", btime);
			sql.params().set("etime", etime);
		}
//		sql.setPager(pager);
		dao.execute(sql);
		
		QueryResult qr = new QueryResult();
		qr.setList(sql.getList(RNews.class));
		int a=1 ;
		if(sql.getList(RNews.class)!=null)
			a = sql.getList(RNews.class).size();
		pager.setRecordCount(a);
		qr.setPager(pager);
		return qr; // 默认分页是第1页,每页20条
	}
3 回复
2018-06-30 15:59:17,557 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class net.wendal.nutzbook.service.impl.EmailServiceImpl without AOP
2018-06-30 15:59:17,557 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'emailService' to [app] 
2018-06-30 15:59:28,146 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - select * from r_news where 1=1
2018-06-30 15:59:28,201 net.wendal.nutzbook.mvc.LogTimeProcessor.process(LogTimeProcessor.java:24) DEBUG - [ GET]URI=/nutzbook/user/news/query 10679ms
2018-06-30 15:59:28,293 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/user/news/query : RNewsModule.query(RNewsModule.java:60)
2018-06-30 15:59:28,293 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'rNewsModule'<class net.wendal.nutzbook.module.RNewsModule>
2018-06-30 15:59:29,770 org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:276) DEBUG - batch acquisition of 0 triggers

没设置回调哦

我就感觉漏掉了一块,但是不报错。搞得我蛋疼

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