diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml index 646441d24..269eea9fe 100755 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml @@ -516,18 +516,21 @@ left join epdc_item_fusing_delay_record d on d.ITEM_ID = item.ID and d.DEL_FLAG = '0' left join ( select b.ID,b.ITEM_ID,b.CREATED_TIME,b.state - from epdc_item_handle_process b where b.DEL_FLAG = '0' and b.STATE != 1001 and b.CREATED_TIME = ( - SELECT - max(CREATED_TIME) - from epdc_item_handle_process - where b.ITEM_ID = ITEM_ID - and (HANDLER_DEPT != '网格化平台' or (HANDLER_DEPT = '网格化平台' and STATE in (1060,1065))) - and DEL_FLAG = '0' - ) + from epdc_item_handle_process b + where b.DEL_FLAG = '0' + and b.STATE != 1001 + and b.CREATED_TIME = ( + SELECT + max(CREATED_TIME) + from epdc_item_handle_process + where b.ITEM_ID = ITEM_ID + and DEL_FLAG = '0' + ) + and (b.HANDLER_DEPT != '网格化平台' or (b.HANDLER_DEPT = '网格化平台' and b.STATE in (1060,1065))) ) process on process.ITEM_ID = item.ID WHERE item.DEL_FLAG = '0' - and (item.IS_PEOPLE = '0' or (item.PEOPLE_FLAG = '0' and (process.state is null or process.state not in (11,15)))) - and (process.state != 14 or process.state is null) + and (item.IS_PEOPLE = '0' or (item.IS_PEOPLE = '1' and item.PEOPLE_FLAG = '0')) + and (process.state is not null and process.state not in (11,14,15)) and (process.state != 0 or process.state is null) @@ -618,17 +621,21 @@ left join epdc_item_fusing_delay_record d on d.ITEM_ID = item.ID and d.DEL_FLAG = '0' left join ( select b.ID,b.ITEM_ID,b.CREATED_TIME,b.state - from epdc_item_handle_process b where b.DEL_FLAG = '0' and b.STATE != 1001 and b.CREATED_TIME = ( + from epdc_item_handle_process b + where b.DEL_FLAG = '0' + and b.STATE != 1001 + and b.CREATED_TIME = ( SELECT max(CREATED_TIME) from epdc_item_handle_process where b.ITEM_ID = ITEM_ID - and HANDLER_DEPT != '网格化平台' and DEL_FLAG = '0' ) + and (b.HANDLER_DEPT != '网格化平台' or (b.HANDLER_DEPT = '网格化平台' and b.STATE in (1060,1065))) ) process on process.ITEM_ID = item.ID WHERE item.DEL_FLAG = '0' - and (item.IS_PEOPLE = '0' or (item.PEOPLE_FLAG = '0' and (process.state is null or process.state not in (11,15)))) + and (item.IS_PEOPLE = '0' or (item.IS_PEOPLE = '1' and item.PEOPLE_FLAG = '0')) + and (process.state is not null and process.state not in (11,15)) and process.state = 14 AND item.PEOPLE_FLAG = #{peopleFlag}