Browse Source

sql优化

feature/dangjian
sunyuchao 4 years ago
parent
commit
329c604f5f
  1. 14
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml

14
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml

@ -2182,16 +2182,16 @@
SELECT
COUNT(a.id)total,
SUM(a.ITEM_STATE='10')closedTotal,
sum((case when a.ITEM_STATE='0' and b.STATE = 1001 then 1 else 0 end))pendingTotal,
sum((case when a.ITEM_STATE='0' and b.STATE != 1001 then 1 else 0 end))processingTotal,
sum((case when a.ITEM_STATE='0' and getworkminute(a.created_time,'2022-10-08 12:00:00')>=480 then 1 else 0 end))redTotal,
sum((case when a.item_state='0' and b.state = 1001 then 1 else 0 end))pendingTotal,
sum((case when a.item_state='0' and b.state != 1001 then 1 else 0 end))processingTotal,
sum((case when a.item_state='0' and getworkminute(a.created_time, now()) >= 480 then 1 else 0 end))redTotal,
sum(
(case when a.ITEM_STATE='0'
and getworkminute(a.created_time,'2022-10-08 12:00:00')>360
and getworkminute(a.created_time,'2022-10-08 12:00:00')<![CDATA[ <= ]]>480
(case when a.item_state = '0'
and getworkminute(a.created_time, now()) > 360
and getworkminute(a.created_time, now())<![CDATA[ <= ]]>480
then 1 else 0 end)
)yellowTotal,
sum((case when a.ITEM_STATE='0' and getworkminute(a.created_time,'2022-10-08 12:00:00')<![CDATA[ <= ]]> 360 then 1 else 0 end))greenTotal
sum((case when a.item_state = '0' and getworkminute(a.created_time, now())<![CDATA[ <= ]]> 360 then 1 else 0 end))greenTotal
FROM
epdc_item a
LEFT JOIN (

Loading…
Cancel
Save