Browse Source

【事件/项目分析】-【组织内部门调整】-(王童)-2021/02/26

feature/syp_points
Jackwang 5 years ago
parent
commit
c97e080588
  1. 180
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

180
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -141,32 +141,59 @@
group by sd.id group by sd.id
</select> </select>
<select id="selectProjectOrgDaily" resultType="com.elink.esua.epdc.dto.screen.result.ProjectOrgDailyDTO"> <select id="selectProjectOrgDaily" resultType="com.elink.esua.epdc.dto.screen.result.ProjectOrgDailyDTO">
SELECT st.`id` AS orgId, SELECT st.`id` AS orgId,
'street' as orgType, 'street' as orgType,
st.pid AS pid, st.pid AS pid,
st.pids AS pids, st.pids AS pids,
count(it.id) as projectTotal, count(it.id) as projectTotal,
count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum, count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum,
ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as resolvedRatio, ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as resolvedRatio,
ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000') as goodRatio, ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000') as goodRatio,
count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal, count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal,
count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal, count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal,
count( it.EVALUATION_SCORE=0 or null) as badTotal, count( it.EVALUATION_SCORE=0 or null) as badTotal,
ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio
FROM `esua_epdc_admin`.`sys_dept` sd FROM `esua_epdc_admin`.`sys_dept` sd
left join `esua_epdc_admin`.`sys_dept` co on co.id=sd.pid left join `esua_epdc_admin`.`sys_dept` co on co.id=sd.pid
left join `esua_epdc_admin`.`sys_dept` st on st.id=co.pid left join `esua_epdc_admin`.`sys_dept` st on st.id=co.pid
left join (select lin.* from (select * from esua_epdc_events.epdc_item order by id) lin left join (select lin.* from (select * from esua_epdc_events.epdc_item order by id) lin
where lin.DEL_FLAG=0 where lin.DEL_FLAG=0
AND date_format( lin.CREATED_TIME, '%Y-%m-%d' ) &lt;= #{yesterDayDate} AND date_format( lin.CREATED_TIME, '%Y-%m-%d' ) &lt;=#{yesterDayDate}
group by lin.EVENT_ID) it on it.GRID_ID=sd.id group by lin.EVENT_ID) it on it.GRID_ID=sd.id
WHERE sd.`del_flag`= 0 WHERE sd.`del_flag`= 0
AND sd.`type_key`= 'grid_party' AND sd.`type_key`= 'grid_party'
AND sd.`id` NOT IN( SELECT t.`dept_id` AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM `esua_epdc_admin`.`sys_dept_config` t FROM `esua_epdc_admin`.`sys_dept_config` t
WHERE t.`del_flag`= 0) WHERE t.`del_flag`= 0)
group by st.id group by st.id
union all
SELECT co.`id` AS orgId,
'community' as orgType,
co.pid AS pid,
co.pids AS pids,
count(it.id) as projectTotal,
count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum,
ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as resolvedRatio,
ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000') as goodRatio,
count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal,
count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal,
count( it.EVALUATION_SCORE=0 or null) as badTotal,
ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio
FROM `esua_epdc_admin`.`sys_dept` sd
left join `esua_epdc_admin`.`sys_dept` co on co.id=sd.pid
left join (select lin.* from (select * from esua_epdc_events.epdc_item order by id) lin
where lin.DEL_FLAG=0
AND date_format( lin.CREATED_TIME, '%Y-%m-%d' ) &lt;=#{yesterDayDate}
group by lin.EVENT_ID) it on it.GRID_ID=sd.id
WHERE sd.`del_flag`= 0
AND sd.`type_key`= 'grid_party'
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM `esua_epdc_admin`.`sys_dept_config` t
WHERE t.`del_flag`= 0)
group by co.id
</select> </select>
<select id="selectQuantityGridMonthly" <select id="selectQuantityGridMonthly"
resultType="com.elink.esua.epdc.dto.screen.result.QuantityGridMonthly"> resultType="com.elink.esua.epdc.dto.screen.result.QuantityGridMonthly">
@ -208,44 +235,83 @@
</select> </select>
<select id="selectQuantityOrgMonthly" <select id="selectQuantityOrgMonthly"
resultType="com.elink.esua.epdc.dto.screen.result.QuantityOrgMonthlyDTO"> resultType="com.elink.esua.epdc.dto.screen.result.QuantityOrgMonthlyDTO">
SELECT st.`id` AS orgId, SELECT st.`id` AS orgId,
'street' as orgType, 'street' as orgType,
st.pid AS pid, st.pid AS pid,
st.pids AS pids, st.pids AS pids,
ifnull(it.projectIncr,0) as projectIncr, ifnull(it.projectIncr,0) as projectIncr,
ifnull(it.closedIncr,0) as closedIncr, ifnull(it.closedIncr,0) as closedIncr,
ifnull(li2.projectTotal,0) as projectTotal, ifnull(li2.projectTotal,0) as projectTotal,
ifnull(li2.unClosedTotal,0) as unClosedTotal, ifnull(li2.unClosedTotal,0) as unClosedTotal,
ifnull(li2.closedTotal,0) as closedTotal ifnull(li2.closedTotal,0) as closedTotal
FROM `esua_epdc_admin`.`sys_dept` sd FROM `esua_epdc_admin`.`sys_dept` sd
left join `esua_epdc_admin`.`sys_dept` co on co.id=sd.pid left join `esua_epdc_admin`.`sys_dept` co on co.id=sd.pid
left join `esua_epdc_admin`.`sys_dept` st on st.id=co.pid left join `esua_epdc_admin`.`sys_dept` st on st.id=co.pid
left join (select li.GRID_ID, left join (select li.GRID_ID,
count(li.id) as projectIncr, count(li.id) as projectIncr,
count((li.ITEM_STATE= 5 or li.ITEM_STATE = 10) or null) as closedIncr count((li.ITEM_STATE= 5 or li.ITEM_STATE = 10) or null) as closedIncr
from (select lin.* from (select lin.*
from (select * from esua_epdc_events.epdc_item order by id) lin from (select * from esua_epdc_events.epdc_item order by id) lin
where lin.DEL_FLAG=0 where lin.DEL_FLAG=0
AND date_format( lin.CREATED_TIME, '%Y-%m' ) = #{lastMonth} AND date_format( lin.CREATED_TIME, '%Y-%m' ) =#{lastMonth}
group by lin.EVENT_ID)li group by lin.EVENT_ID)li
group by li.GRID_ID)it on it.GRID_ID=sd.id group by li.GRID_ID)it on it.GRID_ID=sd.id
left join (select al.GRID_ID, left join (select al.GRID_ID,
count(al.id) as projectTotal, count(al.id) as projectTotal,
count(al.ITEM_STATE= 0 or null) as unClosedTotal, count(al.ITEM_STATE= 0 or null) as unClosedTotal,
count((al.ITEM_STATE= 5 or al.ITEM_STATE = 10) or null) as closedTotal count((al.ITEM_STATE= 5 or al.ITEM_STATE = 10) or null) as closedTotal
from (select lin.* from (select lin.*
from (select * from esua_epdc_events.epdc_item order by id) lin from (select * from esua_epdc_events.epdc_item order by id) lin
where lin.DEL_FLAG=0 where lin.DEL_FLAG=0
AND date_format( lin.CREATED_TIME, '%Y-%m' ) &lt;= #{lastMonth} AND date_format( lin.CREATED_TIME, '%Y-%m' ) &lt;=#{lastMonth}
group by lin.EVENT_ID)al group by lin.EVENT_ID)al
group by al.GRID_ID)li2 on li2.GRID_ID=sd.id group by al.GRID_ID)li2 on li2.GRID_ID=sd.id
WHERE sd.`del_flag`= 0 WHERE sd.`del_flag`= 0
AND sd.`type_key`= 'grid_party' AND sd.`type_key`= 'grid_party'
AND sd.`id` NOT IN( SELECT t.`dept_id` AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM `esua_epdc_admin`.`sys_dept_config` t FROM `esua_epdc_admin`.`sys_dept_config` t
WHERE t.`del_flag`= 0) WHERE t.`del_flag`= 0)
group by st.id group by st.id
union all
SELECT co.`id` AS orgId,
'community' as orgType,
co.pid AS pid,
co.pids AS pids,
ifnull(it.projectIncr,0) as projectIncr,
ifnull(it.closedIncr,0) as closedIncr,
ifnull(li2.projectTotal,0) as projectTotal,
ifnull(li2.unClosedTotal,0) as unClosedTotal,
ifnull(li2.closedTotal,0) as closedTotal
FROM `esua_epdc_admin`.`sys_dept` sd
left join `esua_epdc_admin`.`sys_dept` co on co.id=sd.pid
left join (select li.GRID_ID,
count(li.id) as projectIncr,
count((li.ITEM_STATE= 5 or li.ITEM_STATE = 10) or null) as closedIncr
from (select lin.*
from (select * from esua_epdc_events.epdc_item order by id) lin
where lin.DEL_FLAG=0
AND date_format( lin.CREATED_TIME, '%Y-%m' ) =#{lastMonth}
group by lin.EVENT_ID)li
group by li.GRID_ID)it on it.GRID_ID=sd.id
left join (select al.GRID_ID,
count(al.id) as projectTotal,
count(al.ITEM_STATE= 0 or null) as unClosedTotal,
count((al.ITEM_STATE= 5 or al.ITEM_STATE = 10) or null) as closedTotal
from (select lin.*
from (select * from esua_epdc_events.epdc_item order by id) lin
where lin.DEL_FLAG=0
AND date_format( lin.CREATED_TIME, '%Y-%m' ) &lt;=#{lastMonth}
group by lin.EVENT_ID)al
group by al.GRID_ID)li2 on li2.GRID_ID=sd.id
WHERE sd.`del_flag`= 0
AND sd.`type_key`= 'grid_party'
AND sd.`id` NOT IN( SELECT t.`dept_id`
FROM `esua_epdc_admin`.`sys_dept_config` t
WHERE t.`del_flag`= 0)
group by co.id
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save