DATE_FORMAT(STR_TO_DATE(#{yearMonth, jdbcType=VARCHAR}, '%Y-%m'),'%Y%m') AS monthId,
'agency' as orgType,
'agency' as orgType,
sd.ID orgId,
sd.ID orgId,
sd.PID parentId,
sd.PID parentId,
sd.PIDS allParentIds ,
sd.PIDS allParentIds ,
sd.NAME orgName,
sd.NAME orgName,
(SELECT count( * ) partyTotal FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user uu WHERE uu.DEL_FLAG = '0' AND uu.PARTY_FLAG = '1') partyTotal,
(SELECT count( * ) partyTotal FROM esua_epdc_user.epdc_user uu WHERE uu.DEL_FLAG = '0' AND uu.PARTY_FLAG = '1') partyTotal,
(
(
select
select
count(*) groupTotal
count(*) groupTotal
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_group ws
from esua_epdc_group.epdc_group ws
where ws.DEL_FLAG = '0' and date_format(ws.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ),'%Y-%m' )
where ws.DEL_FLAG = '0' and date_format(ws.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
) groupTotal,
) groupTotal,
(select count(*) topicTotal from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) ) topicTotal,
(select count(*) topicTotal from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = #{yearMonth} ) topicTotal,
(
(
SELECT
SELECT
count( t.a ) issueTotal
count( t.a ) issueTotal
@ -949,10 +949,10 @@ select gr.id as orgId,
count(id) as a,
count(id) as a,
EVENT_ID
EVENT_ID
FROM
FROM
<includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue mei
esua_epdc_events.epdc_issue mei
WHERE
WHERE
mei.DEL_FLAG = '0'
mei.DEL_FLAG = '0'
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user uu WHERE uu.DEL_FLAG = '0' AND uu.PARTY_FLAG = '1'
FROM esua_epdc_user.epdc_user uu WHERE uu.DEL_FLAG = '0' AND uu.PARTY_FLAG = '1'
GROUP BY uu.DEPT_ID) userNum left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = userNum.DEPT_ID
GROUP BY uu.DEPT_ID) userNum left join esua_epdc_admin.sys_dept d1 on d1.ID = userNum.DEPT_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID group by d2.PID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID group by d2.PID
) user on user.DEPT_ID = sd.ID
) user on user.DEPT_ID = sd.ID
left join (
left join (
select
select
@ -1014,22 +1014,22 @@ select gr.id as orgId,
sum( info.STATE = 10 ) as num,
sum( info.STATE = 10 ) as num,
info.GRID_ID
info.GRID_ID
FROM
FROM
<includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_group info
esua_epdc_group.epdc_group info
GROUP BY
GROUP BY
info.GRID_ID
info.GRID_ID
) daily
) daily
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept dept on dept.id = daily.GRID_ID
left join esua_epdc_admin.sys_dept dept on dept.id = daily.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept dept2 on dept2.id = dept.PID
left join esua_epdc_admin.sys_dept dept2 on dept2.id = dept.PID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept parent on parent.id = dept2.PID and parent.type_key= 'street_party'
left join esua_epdc_admin.sys_dept parent on parent.id = dept2.PID and parent.type_key= 'street_party'
where dept2.type_key = 'street_party' or parent.type_key= 'street_party'
where dept2.type_key = 'street_party' or parent.type_key= 'street_party'
GROUP BY IFNULL(parent.id,dept2.id)
GROUP BY IFNULL(parent.id,dept2.id)
) tto on tto.DEPT_ID = sd.ID
) tto on tto.DEPT_ID = sd.ID
left join (
left join (
select sum(topn.topNum) topNum ,d2.PID DEPT_ID from
select sum(topn.topNum) topNum ,d2.PID DEPT_ID from
( select top.GRID_ID ,count(*) topNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_topic top where top.DEL_FLAG = '0'
( select top.GRID_ID ,count(*) topNum from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0'
and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID ) topn
and date_format(top.CREATED_TIME, '%Y-%m' ) = #{yearMonth} group by top.GRID_ID ) topn
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = topn.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = topn.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
group by d2.PID
) topCount on topCount.DEPT_ID = sd.ID
) topCount on topCount.DEPT_ID = sd.ID
left join (
left join (
@ -1045,10 +1045,10 @@ select gr.id as orgId,
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
FROM
FROM
<includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue mei
esua_epdc_events.epdc_issue mei
WHERE
WHERE
mei.DEL_FLAG = '0'
mei.DEL_FLAG = '0'
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY
GROUP BY
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
@ -1056,8 +1056,8 @@ select gr.id as orgId,
GROUP BY
GROUP BY
t.GRID_ID
t.GRID_ID
) issuegrid
) issuegrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = issuegrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = issuegrid.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
AND date_format( item.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( item.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY
GROUP BY
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
@ -1084,32 +1084,32 @@ select gr.id as orgId,
GROUP BY
GROUP BY
t.GRID_ID
t.GRID_ID
) itemgrid
) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
group by d2.PID
) itemCount on itemCount.DEPT_ID = sd.ID
) itemCount on itemCount.DEPT_ID = sd.ID
left join (
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0'
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.ITEM_STATE = 10 group by item.GRID_ID ) itemgrid
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.GRID_ID ) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
group by d2.PID
) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0'
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.EVALUATION_SCORE = 1 group by item.GRID_ID ) itemgrid
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.GRID_ID ) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
group by d2.PID
) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0'
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.EVALUATION_SCORE = 2 group by item.GRID_ID ) itemgrid
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.GRID_ID ) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user uu WHERE uu.DEL_FLAG = '0' AND uu.PARTY_FLAG = '1' GROUP BY uu.DEPT_ID) userNum
FROM esua_epdc_user.epdc_user uu WHERE uu.DEL_FLAG = '0' AND uu.PARTY_FLAG = '1' GROUP BY uu.DEPT_ID) userNum
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = userNum.DEPT_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = userNum.DEPT_ID group by d1.PID
) user on user.DEPT_ID = sd.ID
) user on user.DEPT_ID = sd.ID
left join (
left join (
select
select
@ -1147,20 +1147,20 @@ select gr.id as orgId,
sum( info.STATE = 10 ) as num,
sum( info.STATE = 10 ) as num,
info.GRID_ID
info.GRID_ID
FROM
FROM
<includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_group info
esua_epdc_group.epdc_group info
GROUP BY
GROUP BY
info.GRID_ID
info.GRID_ID
) daily
) daily
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept dept on dept.id = daily.GRID_ID
left join esua_epdc_admin.sys_dept dept on dept.id = daily.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept parent on parent.id = dept.PID and parent.type_key= 'community_party'
left join esua_epdc_admin.sys_dept parent on parent.id = dept.PID and parent.type_key= 'community_party'
where dept.type_key = 'community_party' or parent.type_key= 'community_party'
where dept.type_key = 'community_party' or parent.type_key= 'community_party'
GROUP BY IFNULL(parent.id,dept.id)
GROUP BY IFNULL(parent.id,dept.id)
) tto on tto.DEPT_ID = sd.ID
) tto on tto.DEPT_ID = sd.ID
left join (
left join (
select sum(topn.topNum) topNum ,d1.PID DEPT_ID from
select sum(topn.topNum) topNum ,d1.PID DEPT_ID from
( select top.GRID_ID ,count(*) topNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_topic top where top.DEL_FLAG = '0'
( select top.GRID_ID ,count(*) topNum from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0'
and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID ) topn
and date_format(top.CREATED_TIME, '%Y-%m' ) = #{yearMonth} group by top.GRID_ID ) topn
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = topn.GRID_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = topn.GRID_ID group by d1.PID
) topCount on topCount.DEPT_ID = sd.ID
) topCount on topCount.DEPT_ID = sd.ID
left join (
left join (
select sum(issuegrid.issueNum) issueNum ,d1.PID DEPT_ID from
select sum(issuegrid.issueNum) issueNum ,d1.PID DEPT_ID from
@ -1175,10 +1175,10 @@ select gr.id as orgId,
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
FROM
FROM
<includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue mei
esua_epdc_events.epdc_issue mei
WHERE
WHERE
mei.DEL_FLAG = '0'
mei.DEL_FLAG = '0'
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY
GROUP BY
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
@ -1186,7 +1186,7 @@ select gr.id as orgId,
GROUP BY
GROUP BY
t.GRID_ID
t.GRID_ID
) issuegrid
) issuegrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = issuegrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = issuegrid.GRID_ID
AND date_format( item.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( item.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY
GROUP BY
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
@ -1214,37 +1214,37 @@ select gr.id as orgId,
GROUP BY
GROUP BY
t.GRID_ID
t.GRID_ID
) itemgrid
) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
group by d1.PID
group by d1.PID
) itemCount on itemCount.DEPT_ID = sd.ID
) itemCount on itemCount.DEPT_ID = sd.ID
left join (
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0'
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.ITEM_STATE = 10 group by item.GRID_ID ) itemgrid
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.GRID_ID ) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0'
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.EVALUATION_SCORE = 1 group by item.GRID_ID ) itemgrid
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.GRID_ID ) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0'
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.EVALUATION_SCORE = 2 group by item.GRID_ID ) itemgrid
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.GRID_ID ) itemgrid
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
where sd.DEL_FLAG = '0'
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
AND sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join (select count(*) partyNum,uu.DEPT_ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user uu where uu.DEL_FLAG = '0' and uu.PARTY_FLAG = '1' group by uu.DEPT_ID) user on user.DEPT_ID = sd.ID
left join (select count(*) partyNum,uu.DEPT_ID from esua_epdc_user.epdc_user uu where uu.DEL_FLAG = '0' and uu.PARTY_FLAG = '1' group by uu.DEPT_ID) user on user.DEPT_ID = sd.ID
left join (
left join (
select
select
count(*) as TIMES_TOTAL,
count(*) as TIMES_TOTAL,
ws.GRID_ID as DEPT_ID
ws.GRID_ID as DEPT_ID
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_group ws
from esua_epdc_group.epdc_group ws
where ws.DEL_FLAG = '0' and date_format(ws.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ),'%Y-%m' )
where ws.DEL_FLAG = '0' and date_format(ws.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY ws.GRID_ID
GROUP BY ws.GRID_ID
) tto on tto.DEPT_ID = sd.ID
) tto on tto.DEPT_ID = sd.ID
left join (select top.GRID_ID DEPT_ID ,count(*) topNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_group"/>.epdc_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID) topCount on topCount.DEPT_ID = sd.ID
left join (select top.GRID_ID DEPT_ID ,count(*) topNum from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = #{yearMonth} group by top.GRID_ID) topCount on topCount.DEPT_ID = sd.ID
left join (
left join (
SELECT
SELECT
count( t.a ) issueNum,
count( t.a ) issueNum,
@ -1280,10 +1280,10 @@ select gr.id as orgId,
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
FROM
FROM
<includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue mei
esua_epdc_events.epdc_issue mei
WHERE
WHERE
mei.DEL_FLAG = '0'
mei.DEL_FLAG = '0'
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( mei.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
AND date_format( item.CREATED_TIME, '%Y-%m' ) = date_format( date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format( item.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY
GROUP BY
EVENT_ID,
EVENT_ID,
GRID_ID
GRID_ID
@ -1313,13 +1313,13 @@ select gr.id as orgId,
GROUP BY
GROUP BY
t.GRID_ID
t.GRID_ID
) itemCount on itemCount.DEPT_ID = sd.ID
) itemCount on itemCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.ITEM_STATE = 10 group by item.GRID_ID) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.GRID_ID) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.EVALUATION_SCORE = 1 group by item.GRID_ID) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.GRID_ID) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) and item.EVALUATION_SCORE = 2 group by item.GRID_ID) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.GRID_ID) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
where sd.DEL_FLAG = '0'
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
AND sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
WHERE behavior.USER_ID in ( select meu.ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user meu )
WHERE behavior.USER_ID in ( select meu.ID from esua_epdc_user.epdc_user meu )
AND date_format(behavior.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format(behavior.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY USER_ID, USER.DEPT_ID
GROUP BY USER_ID, USER.DEPT_ID
) behaviorCount
) behaviorCount
GROUP BY behaviorCount.DEPT_ID) be
GROUP BY behaviorCount.DEPT_ID) be
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = be.DEPT_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = be.DEPT_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d3 on d2.PID = d3.ID
left join esua_epdc_admin.sys_dept d3 on d2.PID = d3.ID
group by d3.PID
group by d3.PID
) behave on behave.DEPT_ID = sd.ID
) behave on behave.DEPT_ID = sd.ID
left join (
left join (
@ -1481,26 +1482,26 @@ select gr.id as orgId,
( select
( select
eisu.GRID_ID DEPT_ID,
eisu.GRID_ID DEPT_ID,
count(*) issueNum
count(*) issueNum
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue eisu
from esua_epdc_events.epdc_issue eisu
where eisu.DEL_FLAG = '0' AND date_format(eisu.DISTRIBUTE_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
where eisu.DEL_FLAG = '0' AND date_format(eisu.DISTRIBUTE_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY eisu.GRID_ID
GROUP BY eisu.GRID_ID
) isuCount
) isuCount
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = isuCount.DEPT_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = isuCount.DEPT_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d3 on d2.PID = d3.ID group by d3.PID
left join esua_epdc_admin.sys_dept d3 on d2.PID = d3.ID group by d3.PID
) issueNumber on issueNumber.dept_ID = sd.ID
) issueNumber on issueNumber.dept_ID = sd.ID
where sd.DEL_FLAG = '0'
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
AND sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
DATE_FORMAT(STR_TO_DATE(#{yearMonth, jdbcType=VARCHAR}, '%Y-%m'),'%Y%m') AS monthId,
'agency' as orgType,
'agency' as orgType,
sd.ID orgId,
sd.ID orgId,
sd.PID parentId,
sd.PID parentId,
@ -1510,7 +1511,7 @@ select gr.id as orgId,
IFNULL(behave.joinUser,0) joinUser,
IFNULL(behave.joinUser,0) joinUser,
IFNULL(behave.issueJoinUser,0) issueJoinUser,
IFNULL(behave.issueJoinUser,0) issueJoinUser,
IFNULL(issueNumber.issueNum,0) issueNum
IFNULL(issueNumber.issueNum,0) issueNum
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join (
left join (
select
select
sum(be.joinUser) joinUser,
sum(be.joinUser) joinUser,
@ -1551,15 +1552,15 @@ select gr.id as orgId,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_analysis"/>.epdc_user_behavior_log behavior
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
WHERE behavior.USER_ID in ( select meu.ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user meu )
WHERE behavior.USER_ID in ( select meu.ID from esua_epdc_user.epdc_user meu )
AND date_format(behavior.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format(behavior.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY USER_ID, USER.DEPT_ID
GROUP BY USER_ID, USER.DEPT_ID
) behaviorCount
) behaviorCount
GROUP BY behaviorCount.DEPT_ID) be
GROUP BY behaviorCount.DEPT_ID) be
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = be.DEPT_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = be.DEPT_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID group by d2.PID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID group by d2.PID
) behave on behave.DEPT_ID = sd.ID
) behave on behave.DEPT_ID = sd.ID
left join (
left join (
select
select
@ -1569,25 +1570,25 @@ select gr.id as orgId,
( select
( select
eisu.GRID_ID DEPT_ID,
eisu.GRID_ID DEPT_ID,
count(*) issueNum
count(*) issueNum
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue eisu
from esua_epdc_events.epdc_issue eisu
where eisu.DEL_FLAG = '0' AND date_format(eisu.DISTRIBUTE_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
where eisu.DEL_FLAG = '0' AND date_format(eisu.DISTRIBUTE_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY eisu.GRID_ID
GROUP BY eisu.GRID_ID
) isuCount
) isuCount
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = isuCount.DEPT_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = isuCount.DEPT_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID group by d2.PID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID group by d2.PID
) issueNumber on issueNumber.dept_ID = sd.ID
) issueNumber on issueNumber.dept_ID = sd.ID
where sd.DEL_FLAG = '0'
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
AND sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
DATE_FORMAT(STR_TO_DATE(#{yearMonth, jdbcType=VARCHAR}, '%Y-%m'),'%Y%m') AS monthId,
'agency' as orgType,
'agency' as orgType,
sd.ID orgId,
sd.ID orgId,
sd.PID parentId,
sd.PID parentId,
@ -1597,7 +1598,7 @@ select gr.id as orgId,
IFNULL(behave.joinUser,0) joinUser,
IFNULL(behave.joinUser,0) joinUser,
IFNULL(behave.issueJoinUser,0) issueJoinUser,
IFNULL(behave.issueJoinUser,0) issueJoinUser,
IFNULL(issueNumber.issueNum,0) issueNumber
IFNULL(issueNumber.issueNum,0) issueNumber
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join (
left join (
select
select
sum(be.joinUser) joinUser,
sum(be.joinUser) joinUser,
@ -1633,14 +1634,14 @@ select gr.id as orgId,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_analysis"/>.epdc_user_behavior_log behavior
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
WHERE behavior.USER_ID in ( select meu.ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_user"/>.epdc_user meu )
WHERE behavior.USER_ID in ( select meu.ID from esua_epdc_user.epdc_user meu )
AND date_format(behavior.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
AND date_format(behavior.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY USER_ID, USER.DEPT_ID
GROUP BY USER_ID, USER.DEPT_ID
) behaviorCount
) behaviorCount
GROUP BY behaviorCount.DEPT_ID) be
GROUP BY behaviorCount.DEPT_ID) be
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = be.DEPT_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = be.DEPT_ID group by d1.PID
) behave on behave.DEPT_ID = sd.ID
) behave on behave.DEPT_ID = sd.ID
left join (
left join (
select
select
@ -1650,24 +1651,24 @@ select gr.id as orgId,
( select
( select
eisu.GRID_ID DEPT_ID,
eisu.GRID_ID DEPT_ID,
count(*) issueNum
count(*) issueNum
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue eisu
from esua_epdc_events.epdc_issue eisu
where eisu.DEL_FLAG = '0' AND date_format(eisu.DISTRIBUTE_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
where eisu.DEL_FLAG = '0' AND date_format(eisu.DISTRIBUTE_TIME, '%Y-%m' ) = #{yearMonth}
GROUP BY eisu.GRID_ID
GROUP BY eisu.GRID_ID
) isuCount
) isuCount
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = isuCount.DEPT_ID group by d1.PID
left join esua_epdc_admin.sys_dept d1 on d1.ID = isuCount.DEPT_ID group by d1.PID
) issueNumber on issueNumber.dept_ID = sd.ID
) issueNumber on issueNumber.dept_ID = sd.ID
where sd.DEL_FLAG = '0'
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
AND sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
DATE_FORMAT(STR_TO_DATE(#{yearMonth, jdbcType=VARCHAR}, '%Y-%m'),'%Y%m') AS monthId,
'agency' as orgType,
'agency' as orgType,
sd.ID orgId,
sd.ID orgId,
sd.PID parentId,
sd.PID parentId,
@ -2320,7 +2321,7 @@ union all
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join
left join
(select
(select
d3.PID DEPT_ID,
d3.PID DEPT_ID,
@ -2339,28 +2340,28 @@ union all
from (
from (
SELECT *,
SELECT *,
( SELECT CREATED_TIME FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
( SELECT CREATED_TIME FROM esua_epdc_events.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
FROM esua_epdc_events.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
) mee
) mee
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
LEFT JOIN esua_epdc_events.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
left join (select count(*) as deptCount,ITEM_ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join (select count(*) as deptCount,ITEM_ID from esua_epdc_events.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = mee.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = mee.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d3 on d2.PID = d3.ID
left join esua_epdc_admin.sys_dept d3 on d2.PID = d3.ID
group by d3.PID
group by d3.PID
) rr on rr.DEPT_ID = sd.ID
) rr on rr.DEPT_ID = sd.ID
where
where
sd.DEL_FLAG = '0'
sd.DEL_FLAG = '0'
and sd.id IS NOT NULL
and sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join
left join
(select
(select
d2.PID DEPT_ID,
d2.PID DEPT_ID,
@ -2396,28 +2397,28 @@ union all
count(mei.EVALUATION_SCORE is not null or null) as satisfactionRatioFm
count(mei.EVALUATION_SCORE is not null or null) as satisfactionRatioFm
from (
from (
SELECT *,
SELECT *,
( SELECT CREATED_TIME FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
( SELECT CREATED_TIME FROM esua_epdc_events.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
FROM esua_epdc_events.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
) mee
) mee
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
LEFT JOIN esua_epdc_events.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
left join (select count(*) as deptCount,ITEM_ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join (select count(*) as deptCount,ITEM_ID from esua_epdc_events.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = mee.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = mee.GRID_ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d2 on d1.PID = d2.ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
group by d2.PID
) rr on rr.DEPT_ID = sd.ID
) rr on rr.DEPT_ID = sd.ID
where
where
sd.DEL_FLAG = '0'
sd.DEL_FLAG = '0'
and sd.id IS NOT NULL
and sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join
left join
(select
(select
d1.PID DEPT_ID,
d1.PID DEPT_ID,
@ -2454,12 +2455,12 @@ union all
from (
from (
SELECT *,
SELECT *,
( SELECT CREATED_TIME FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
( SELECT CREATED_TIME FROM esua_epdc_events.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
FROM esua_epdc_events.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
) mee
) mee
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
LEFT JOIN esua_epdc_events.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
left join (select count(*) as deptCount,ITEM_ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join (select count(*) as deptCount,ITEM_ID from esua_epdc_events.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept d1 on d1.ID = mee.GRID_ID
left join esua_epdc_admin.sys_dept d1 on d1.ID = mee.GRID_ID
group by d1.PID
group by d1.PID
) rr on rr.DEPT_ID = sd.ID
) rr on rr.DEPT_ID = sd.ID
@ -2467,15 +2468,15 @@ union all
sd.DEL_FLAG = '0'
sd.DEL_FLAG = '0'
and sd.id IS NOT NULL
and sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dept sd
from esua_epdc_admin.sys_dept sd
left join
left join
(select
(select
mee.GRID_ID DEPT_ID,
mee.GRID_ID DEPT_ID,
@ -2511,17 +2512,17 @@ union all
count(mei.EVALUATION_SCORE is not null or null) as satisfactionRatioFm
count(mei.EVALUATION_SCORE is not null or null) as satisfactionRatioFm
from (
from (
SELECT *,
SELECT *,
( SELECT CREATED_TIME FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
( SELECT CREATED_TIME FROM esua_epdc_events.epdc_issue_handle WHERE DEL_FLAG = '0' AND STATE = '1' AND ISSUE_ID = issue.id ORDER BY CREATED_TIME DESC, id DESC LIMIT 1) AS HANDLE_CREATED_TIME
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' )
FROM esua_epdc_events.epdc_issue issue where issue.DEL_FLAG = '0' and date_format(issue.CREATED_TIME, '%Y-%m' ) = #{yearMonth}
) mee
) mee
LEFT JOIN <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
LEFT JOIN esua_epdc_events.epdc_item mei ON mee.id = mei.ISSUE_ID and mei.DEL_FLAG = '0'
left join (select count(*) as deptCount,ITEM_ID from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
left join (select count(*) as deptCount,ITEM_ID from esua_epdc_events.epdc_item_dept where DEL_FLAG = '0' group by ITEM_ID) ide on ide.ITEM_ID = mei.ID
GROUP BY mee.GRID_ID) rr on rr.DEPT_ID = sd.ID
GROUP BY mee.GRID_ID) rr on rr.DEPT_ID = sd.ID
where
where
sd.DEL_FLAG = '0'
sd.DEL_FLAG = '0'
and sd.id IS NOT NULL
and sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.`sys_dept_config` t