DATE_FORMAT(STR_TO_DATE(DATE_FORMAT(#{yearMonthDay}, '%Y-%m-%d'), '%Y-%m'), '%Y%m') AS monthId,
</otherwise>
</choose>
a.staffId,
a.staffName,
a.gridId,
@ -34,15 +50,22 @@
SUM(a.projectResponseIncr)projectResponseIncr,
SUM(a.projectTransferIncr)projectTransferIncr,
SUM(a.projectClosedIncr)projectClosedIncr
from(
select
seur.STAFF_ID as staffId,
seur.STAFF_NAME as staffName,
ee.GRID_ID as gridId,
sd.pid,
<choose>
<whentest="endTime != null and endTime != ''">
count(DATE_FORMAT(ee.CREATED_TIME, '%Y-%m-%d') <= #{endTime} or null) as projectCount, -- 项目立项数,截止到当前dateId的总数
count(DATE_FORMAT(ee.CREATED_TIME, '%Y-%m-%d') = #{endTime} or null) as projectIncr, -- 项目立项数,dateId这一天的增量
</when>
<otherwise>
count(DATE_FORMAT(ee.CREATED_TIME, '%Y-%m-%d') <= #{yearMonthDay} or null) as projectCount, -- 项目立项数,截止到当前dateId的总数
count(DATE_FORMAT(ee.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} or null) as projectIncr, -- 项目立项数,dateId这一天的增量
</otherwise>
</choose>
0 as issueToProjectCount,
0 as closedIssueCount,
0 as projectResponseCount,
@ -53,8 +76,6 @@
0 as projectResponseIncr,
0 as projectTransferIncr,
0 as projectClosedIncr
from esua_epdc_admin.sys_epmet_user_relation seur
right join esua_epdc_events.epdc_events ee on ee.MOBILE = seur.MOBILE and ee.DEL_FLAG = '0'
left join esua_epdc_admin.sys_dept sd on sd.id = ee.GRID_ID and sd.DEL_FLAG = '0'
@ -72,17 +93,24 @@
sd.pid,
0 as projectCount,
0 as projectIncr,
<choose>
<whentest="endTime != null and endTime != ''">
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{endTime} or null) as issueToProjectCount, -- 议题转项目数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{endTime} or null) as issueToProjectIncr, -- 议题转项目数,dateId这一天的增量
</when>
<otherwise>
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{yearMonthDay} or null) as issueToProjectCount, -- 议题转项目数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} or null) as issueToProjectIncr, -- 议题转项目数,dateId这一天的增量
</otherwise>
</choose>
0 as closedIssueCount,
0 as projectResponseCount,
0 as projectTransferCount,
0 as projectClosedCount,
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} or null) as issueToProjectIncr, -- 议题转项目数,dateId这一天的增量
0 as closedIssueIncr,
0 as projectResponseIncr,
0 as projectTransferIncr,
0 as projectClosedIncr
from esua_epdc_admin.sys_epmet_user_relation seur
left join esua_epdc_admin.sys_user eu on eu.MOBILE = seur.MOBILE
right join esua_epdc_events.epdc_item ei on ei.CREATED_BY = eu.id and ei.DEL_FLAG = '0'
@ -102,12 +130,20 @@
0 as projectCount,
0 as projectIncr,
0 as issueToProjectCount,
<choose>
<whentest="endTime != null and endTime != ''">
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{endTime} or null) as closedIssueCount, -- 议题关闭数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{endTime} or null) as closedIssueIncr, -- 议题关闭数,dateId这一天的增量
</when>
<otherwise>
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{yearMonthDay} or null) as closedIssueCount, -- 议题关闭数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} or null) as closedIssueIncr, -- 议题关闭数,dateId这一天的增量
</otherwise>
</choose>
0 as projectResponseCount,
0 as projectTransferCount,
0 as projectClosedCount,
0 as issueToProjectIncr,
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} or null) as closedIssueIncr, -- 议题关闭数,dateId这一天的增量
0 as projectResponseIncr,
0 as projectTransferIncr,
0 as projectClosedIncr
@ -123,7 +159,6 @@
union all
select
seur.STAFF_ID as staffId,
seur.STAFF_NAME as staffName,
@ -133,14 +168,26 @@
0 as projectIncr,
0 as issueToProjectCount,
0 as closedIssueCount,
0 as issueToProjectIncr,
0 as closedIssueIncr,
<choose>
<whentest="endTime != null and endTime != ''">
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{endTime} and ei.STATE = 0 and eid.ID is null or null) as projectResponseCount, -- 项目响应数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{endTime} and ei.STATE = 0 and eid.ID is not null or null) as projectTransferCount, -- 项目吹哨数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{endTime} and ei.STATE = 10 or null) as projectClosedCount, -- 项目结案数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{endTime} and ei.STATE = 0 and eid.ID is null or null) as projectResponseIncr, -- 项目响应数,dateId这一天的增量
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{endTime} and ei.STATE = 0 and eid.ID is not null or null) as projectTransferIncr, -- 项目吹哨数,dateId这一天的增量
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{endTime} and ei.STATE = 10 or null) as projectClosedIncr -- 项目结案数,dateId这一天的增量
</when>
<otherwise>
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{yearMonthDay} and ei.STATE = 0 and eid.ID is null or null) as projectResponseCount, -- 项目响应数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{yearMonthDay} and ei.STATE = 0 and eid.ID is not null or null) as projectTransferCount, -- 项目吹哨数,截止到当前dateId的总数
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') <= #{yearMonthDay} and ei.STATE = 10 or null) as projectClosedCount, -- 项目结案数,截止到当前dateId的总数
0 as issueToProjectIncr,
0 as closedIssueIncr,
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} and ei.STATE = 0 and eid.ID is null or null) as projectResponseIncr, -- 项目响应数,dateId这一天的增量
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} and ei.STATE = 0 and eid.ID is not null or null) as projectTransferIncr, -- 项目吹哨数,dateId这一天的增量
count(DATE_FORMAT(ei.CREATED_TIME, '%Y-%m-%d') = #{yearMonthDay} and ei.STATE = 10 or null) as projectClosedIncr -- 项目结案数,dateId这一天的增量
</otherwise>
</choose>
from esua_epdc_admin.sys_epmet_user_relation seur
left join esua_epdc_admin.sys_user eu on eu.MOBILE = seur.MOBILE
right join esua_epdc_events.epdc_item_handle_process ei on ei.CREATED_BY = eu.id and ei.DEL_FLAG = '0'