XcglRptDao_activitiStatsUserData.sql 703 B

123456789101112131415161718
  1. select
  2. bu.realname as name
  3. ,bu.id as id
  4. ,count(*) as taskTotal
  5. ,SUM(CASE WHEN hi.END_TIME_ is not null THEN 1 ELSE 0 END) AS finishTotal
  6. ,SUM(CASE WHEN hi.END_TIME_ is null THEN 1 ELSE 0 END) AS noFinishTaskTotal
  7. ,SUM(CASE WHEN hi.START_TIME_<ifnull(hi.END_TIME_,now()) +INTERVAL 0-:tookTime day THEN 1 ELSE 0 END) AS overdueCount
  8. from
  9. ACT_HI_TASKINST hi
  10. inner join t_s_base_user bu on hi.ASSIGNEE_=bu.username
  11. inner join t_s_user_org org on org.user_id=bu.ID and ifpluralism='0' and org.status='0'
  12. where org.org_id = :entityParam.pid
  13. <#if (entityParam.attType)??>
  14. and hi.START_TIME_ between :entityParam.attStartTime and :entityParam.attEndTime
  15. </#if>
  16. group by bu.ID
  17. order by taskTotal asc