NutzCN Logo
问答 查询的时候怎么把数据库存的null值这个字段显示出来?
发布于 2511天前 作者 qq_722cb381 1895 次浏览 复制 上一个帖子 下一个帖子
标签:

查询的时候怎么把数据库存的null值这个字段显示出来,现在好像是直接给过滤掉了

13 回复
@Ok("json:full")

@wendal 我现在@ok返回的是页面,怎么在加@Ok("json:full")

@Ok("vel:work/vdo/list.html")

vel是是什么。。。 我还以为你说ajax的时候没有null字段呢

模板的话,那是模板语法的问题了

@wendal vel是velocity模板,不是jax的时候null字段,是查某一张表,这张表里有一个字段是null值,在查询的时候直接把这个字段给过滤了,这个和模板语法没关系吧。
看我返回的两条记录里 第一条exportvotescore这个字段有值就显示,第二条exportvotescore字段值为null 直接就给过滤掉了,压根就没显示这个字段,这个咋搞?

02-06 10:00:35.073  DEBUG - [LoggingMethodInterceptor.http-bio-8080-exec-9] [afterInvoke] Obj = [com.brt.vplan.service.work.impl.VdoService$$NUTZAOP] , Return = {{
      "id" :41,
      "likeid" :"微计划2018",
      "num" :"c751778cd9db4401b18b64c2f486f60b",
      "mid" :36,
      "username" :"王二小",
      "name" :"这是标题哦",
      "vtype" :1,
      "addtime" :"2018-02-02 09:43:21",
      "updatetime" :"2018-02-05 15:50:44",
      "cover" :"",
      "intro" :"这是主题介绍哦,呵呵呵",
      "playcount" :0,
      "diggcount" :3,
      "duration" :120,
      "subject" :"这是拍摄对象",
      "place" :"大别山",
      "status" :2,
      "verifysubmittime" :"2018-02-05 15:50:44",
      "verifyfailreason" :"",
      "originalurl" :"",
      "original" :"",
      "v720p" :"",
      "imgs" :"",
      "audiencevote" :8,
      "exportvote" :1,
      "exportvotescore" :86.00,
      "bechosen" :0
   }, {
      "id" :40,
      "likeid" :"微计划2018",
      "num" :"a6779f02b7bd4d2fa39ca4e3c26cf1cd",
      "mid" :36,
      "username" :"王二小",
      "name" :"",
      "vtype" :1,
      "addtime" :"2018-02-02 09:41:39",
      "updatetime" :"2018-02-02 09:41:39",
      "cover" :"",
      "intro" :"",
      "playcount" :0,
      "duration" :0,
      "subject" :"",
      "place" :"",
      "status" :0,
      "verifysubmittime" :"2018-02-02 09:41:39",
      "verifyfailreason" :"",
      "originalurl" :"http://www.domain.com/123.jpg",
      "original" :"",
      "v720p" :"",
      "imgs" :"",
      "bechosen" :0
   }

那只是LoggingMethodInterceptor的打印效果吧,这是pojo的查询结果?

@wendal 我debug返回的数据也没有那个字段,这应该就是查询的结果吧

查询的代码贴来看看

public Pager<Record> listByPage(int page) {
		Pager<Record> pager = new Pager<Record>(PAGESIZE, page);
		Condition cnd = Cnd.NEW();
			Sql sql = dao.sqls().create("find.vdo.list.by.admin.id");
			Sql sql1 = dao.sqls().create("find.vdo.count.by.admin.id");
			cnd = Cnd.where("v.v_del", "=", 0).orderBy("v.v_id", "desc");
			sql.setCondition(cnd);
			sql1.setCondition(cnd);
			sql.params().set("pageStart", (page - 1) * PAGESIZE);
			sql.params().set("pageSize", PAGESIZE);
			pager.setEntities(SqlActuator.runReport(sql, dao));
			pager.setCount(SqlActuator.runUnq(sql1, dao));
			
		return pager;
	}
/*find.vdo.list.by.admin.id*/
SELECT
v.v_id AS id,
v.v_likeid AS likeid,
v.v_num AS num,
v.m_id AS mId,
m.m_realname AS userName,
v.v_name AS name,
v.v_type AS vtype,
v.v_addtime AS addtime,
v.v_updatetime AS updatetime,
v.v_cover AS cover,
v.v_intro AS intro,
v.v_playcount AS playcount,
v.v_diggcount AS diggcount,
v.v_duration AS duration,
v.v_subject AS subject,
v.v_place AS place,
v.v_status AS status,
v.v_verify_submit_time AS verifysubmittime,
v.v_verify_time AS verifytime,
v.v_verify_fail_reason AS verifyfailreason,
v.v_original_url AS originalurl,
v.v_original AS original,
v.v_720p AS v720p,
v.v_imgs AS imgs,
v.v_audience_vote AS audiencevote,
v.v_export_vote AS exportvote,
v.v_export_vote_score AS exportvotescore,
v.v_bechosen AS bechosen
FROM
zc_wjh_vdo v
LEFT JOIN zc_member m ON m.m_id = v.m_id
$condition limit @pageStart,@pageSize;


/*find.vdo.count.by.admin.id*/
SELECT
	count(*)
FROM
zc_wjh_vdo v
LEFT JOIN zc_member m ON m.m_id = v.m_id
$condition

嗯, 不知道了, debug一下org.nutz.dao.entity.Record.create(Map<String, Object>, ResultSet, ResultSetMetaData)看看吧

@wendal 我也debug了一下 这是返回Record里的数据,exportvotescore是null

"id" :29,
   "likeid" :"微计划2018",
   "num" :"25ba18bd46044d74b1fca31cacea645b",
   "mid" :36,
   "username" :"王二小",
   "name" :"这是标题哦",
   "vtype" :1,
   "addtime" :"2018-02-02 08:32:09",
   "updatetime" :"2018-02-02 08:32:09",
   "cover" :"http://www.domain.com/1233.jpg",
   "intro" :"这是主题介绍哦,呵呵呵",
   "playcount" :0,
   "diggcount" :null,
   "duration" :0,
   "subject" :"这是拍摄对象",
   "place" :"大别山",
   "status" :2,
   "verifysubmittime" :"2018-02-02 08:32:09",
   "verifytime" :null,
   "verifyfailreason" :"",
   "originalurl" :"http://www.domain.com/123.jpg",
   "original" :"",
   "v720p" :"",
   "imgs" :"",
   "audiencevote" :null,
   "exportvote" :null,
   "exportvotescore" :null,
   "bechosen" :0

那就不是dao层的问题啦

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