快捷导航

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

mybatis SQL执行有结果,但是程序执行返回null集合,
程序XML如下
   
   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

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员1

检查一下xml中resultMap的配置
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP