NutzCN Logo
问答 sql.getList返回数据为空
发布于 2257天前 作者 qq_3b4db680 2391 次浏览 复制 上一个帖子 下一个帖子
标签:

sql语句执行有一条数据,但是执行sql.getList获取结果为[]

sql.setCallback(Sqls.callback.records());
		sql = dao.execute(sql);
		List<Record> result = sql.getList(Record.class);
5 回复

逐个条件删除,看看是哪个条件影响的

试了几个好几个页面列表,只要查询结果只有1条,就返回空的[]

贴日志看看

@wendal 执行execute语句打印的sql日志,拿到数据库执行都是有数据的。但是执行下面的sql.getList回来的数据就为[]了

[DEBUG][2018-10-18 14:47:22,981][org.nutz.mvc.impl.UrlMappingImpl]Search mapping for [POST] path=/api : NOT Action match
[INFO][2018-10-18 14:47:22,982][com.ifm.dispcter.Dispcter]req = {"accountType":"0","pageSize":"10","cmd":"queryAllCustoms","role_filter":"1","rows":"{\"custom_name_cnd\":\"张勇\",\"identity_card_cnd\":\"\",\"school_name_cnd\":\"\",\"create_date_FROM_cnd\":\"2018-10-02\",\"create_date_TO_cnd\":\"\",\"status_cnd\":\"\",\"bind_card_status_cnd\":\"\",\"account_status_cnd\":\"1\",\"zhima_credit_score_FROM_cnd\":\"\",\"zhima_credit_score_TO_cnd\":\"\",\"watchlistii_is_matched_cnd\":\"\",\"job_num_cnd\":\"\",\"phone_cnd\":\"\",\"is_fuzzy_cnd\":\"\",\"level_cnd\":\"\",\"loan_success_FROM_cnd\":\"\",\"loan_success_TO_cnd\":\"\",\"abnormal_number_FROM_cnd\":\"\",\"abnormal_number_TO_cnd\":\"\",\"stagnation_FROM_cnd\":\"\",\"stagnation_TO_cnd\":\"\",\"authen_time_FROM_cnd\":\"\",\"authen_time_TO_cnd\":\"\"}","pageNum":"1","userCode":1,"token":"7fd32260-ba3c-481e-af5f-d1886f127072"}
[DEBUG][2018-10-18 14:47:22,982][org.nutz.dao.impl.sql.run.NutDaoExecutor]SELECT * FROM IFM_SYS_SESSION  WHERE user_id=? AND token=? LIMIT 0, 1 
    | 1 |                                    2 |
    |---|--------------------------------------|
    | 1 | 7fd32260-ba3c-481e-af5f-d1886f127072 |
  For example:> "SELECT * FROM IFM_SYS_SESSION  WHERE user_id='1' AND token='7fd32260-ba3c-481e-af5f-d1886f127072' LIMIT 0, 1 "
[DEBUG][2018-10-18 14:47:22,984][org.nutz.dao.impl.sql.run.NutDaoExecutor]select count(1) from (SELECT
t.id
from
app_loan_appl t
join app_loan_custom t1 on t1.appr_id = t.id
LEFT JOIN app_account_info aai on aai.appr_id = t.id
where 1=1 and t1.custom_name = '张勇'  and t.create_date>='2018-10-02 00:00:00'  and IFNULL(t.account_status,-1) = 1 )as _nutz_tmp_3ikatu4rpihmrrpfb3rtdokt0m
[DEBUG][2018-10-18 14:47:23,017][org.nutz.dao.impl.sql.run.NutDaoExecutor]SELECT
t.id,
t1.custom_name,
t1.identity_card,
t.credit_amt,
ifnull(t1.school_name,t1.company_name) as school_name,
t1.place,
t.create_date,
t.level,
t1.bind_card_time,
t.loaning_status,
t.item_code as phone,
t1.is_pass,
t1.schedule_status as status,
t.zhima_credit_score,
t.watchlistii_is_matched,
case when t.city='0' then '苹果' when t.city='4' then '苹果-专业版' when t.city='5' then '苹果-企业版' else t.city end as job_num,
if(t1.bind_card_time is null,'0','1') as bind_card_status,
IFNULL(t.account_status,-1) as account_status,
ifnull(t.abnormal_number,0) as abnormal_number,
IFNULL(aai.loan_count,0) as loan_success,#提现成功次数
case when t.account_status is null then IFNULL(datediff(IFNULL(t.authen_time,now()),t.create_date) ,0) when aai.borrow_time is null then IFNULL(datediff(now(),t.authen_time),0) when aai.borrow_time < aai.last_pay_time  then IFNULL(datediff(now(),aai.last_pay_time),0)  else 0 end as stagnation,#停滞天数
t.`status` as appl_status,
t.authen_time,#发起授信时间
DATE_FORMAT(aai.coupon_time,'%Y-%m-%d') as creat_time#最后优惠卷发放时间
from
app_loan_appl t
join app_loan_custom t1 on t1.appr_id = t.id
LEFT JOIN app_account_info aai on aai.appr_id = t.id
where 1=1 and t1.custom_name = '张勇'  and t.create_date>='2018-10-02 00:00:00'  and IFNULL(t.account_status,-1) = 1 
ORDER BY
t.create_date  DESC LIMIT 0, 10
2018-10-18 14:47:23,852 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeExpiredConnections(PoolingHttpClientConnectionManager.java:408) DEBUG - Closing expired connections
 2018-10-18 14:47:23,852 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeIdleConnections(PoolingHttpClientConnectionManager.java:401) DEBUG - Closing connections idle longer than 60000 MILLISECONDS
 2018-10-18 14:47:26,555 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeExpiredConnections(PoolingHttpClientConnectionManager.java:408) DEBUG - Closing expired connections
 2018-10-18 14:47:26,555 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeIdleConnections(PoolingHttpClientConnectionManager.java:401) DEBUG - Closing connections idle longer than 60000 MILLISECONDS
 2018-10-18 14:47:28,853 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeExpiredConnections(PoolingHttpClientConnectionManager.java:408) DEBUG - Closing expired connections
 2018-10-18 14:47:28,853 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeIdleConnections(PoolingHttpClientConnectionManager.java:401) DEBUG - Closing connections idle longer than 60000 MILLISECONDS
 2018-10-18 14:47:31,556 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeExpiredConnections(PoolingHttpClientConnectionManager.java:408) DEBUG - Closing expired connections
 2018-10-18 14:47:31,556 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeIdleConnections(PoolingHttpClientConnectionManager.java:401) DEBUG - Closing connections idle longer than 60000 MILLISECONDS
 2018-10-18 14:47:33,854 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeExpiredConnections(PoolingHttpClientConnectionManager.java:408) DEBUG - Closing expired connections

@wendal 我找到原因了,带汉字查询条件就会返回[]

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