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>
添加回答
举报
0/150
提交
取消