为了账号安全,请及时绑定邮箱和手机立即绑定

mybatis SQL执行有结果,但是程序执行返回null集合

mybatis SQL执行有结果,但是程序执行返回null集合

慕斯2858749 2018-04-23 20:25:25
mybatis SQL执行有结果,但是程序执行返回null集合,程序XML如下   <select id="selectF" resultMap="BaseResultMap" parameterType="java.util.Map">   select c_dept_name as "CDeptName", sum(foo.countcun) as "countCun" ,sum (foo.countqu) as "countQu",sum(foo.avgQuDay) as "avgquday",sum(foo.retentionFileDay) as "retentionfileday" FROM    (    SELECT c_dept_id ,count(1) as "countcun", 0 as "countqu" ,0 as "avgquday" ,0 as "retentionfileday"    FROM t_szxx_history LEFT JOIN t_court_user ON c_input_user_id = t_court_user.c_id    WHERE c_input_user_id IS NOT NULL and c_input_user_id != '' AND d_cfsj between  #{alarmStartTime} and #{alarmEndTime}    GROUP BY t_court_user.c_dept_id    UNION all    SELECT c_dept_id,0,count(1),0,0    FROM t_szxx_history LEFT JOIN t_court_user ON c_output_user_id = t_court_user.c_id    WHERE c_output_user_id IS NOT NULL and c_output_user_id != '' AND d_cfsj between  #{alarmStartTime} and #{alarmEndTime}    GROUP BY t_court_user.c_dept_id    union all    SELECT c_dept_id,0,0,SUM ( date_part('day',t_szxx_history.d_cfsj :: TIMESTAMP - t_szxx_history.d_update :: TIMESTAMP) + 1) / COUNT (1),max(date_part('day',t_szxx_history.d_cfsj :: TIMESTAMP - t_szxx_history.d_update :: TIMESTAMP) + 1)    from t_szxx_history     LEFT JOIN t_court_user ON c_input_user_id = t_court_user.c_id    where t_szxx_history.d_cfsj  between  #{alarmStartTime} and #{alarmEndTime}  and t_szxx_history.n_zt =4 and t_szxx_history.c_input_user_id is not null and t_szxx_history.c_input_user_id != ''    group BY c_dept_id    ) as foo    LEFT JOIN t_court_user ON foo.c_dept_id = t_court_user.c_dept_id    group by c_dept_name   </select>
查看完整描述

1 回答

?
北七哦

TA贡献33条经验 获得超4个赞

检查一下xml中resultMap的配置

查看完整回答
反对 回复 2018-04-24
  • 1 回答
  • 0 关注
  • 2686 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信