|
|
@ -18,16 +18,27 @@ |
|
|
|
SELECT |
|
|
|
sca.AGENCY_ID AS orgId, |
|
|
|
sca.AGENCY_NAME AS `NAME`, |
|
|
|
IFNULL( sum( m.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal, |
|
|
|
IFNULL( sum( m.ORGANIZE_TOTAL ), 0 ) AS participateTotal |
|
|
|
IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal, |
|
|
|
IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal |
|
|
|
FROM |
|
|
|
screen_customer_agency sca |
|
|
|
LEFT JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} ) |
|
|
|
LEFT JOIN screen_customer_work_record_dict dict ON ( m.TYPE_CODE = dict.RESOURCE_CODE AND dict.DEL_FLAG = '0' AND dict.DATA_TYPE = #{dataType} ) |
|
|
|
left join ( |
|
|
|
select m.* from screen_work_record_org_daily m |
|
|
|
where m.DEL_FLAG = '0' |
|
|
|
AND m.DATE_ID = #{dateId} |
|
|
|
and m.TYPE_CODE in( |
|
|
|
select dict. RESOURCE_CODE from screen_customer_work_record_dict dict |
|
|
|
where dict.DEL_FLAG = '0' |
|
|
|
AND dict.DATA_TYPE = #{dataType} |
|
|
|
and dict.`LEVEL`='1' |
|
|
|
) |
|
|
|
)temp on( |
|
|
|
sca.AGENCY_ID = temp.ORG_ID AND temp.DEL_FLAG = '0' AND temp.DATE_ID =#{dateId} |
|
|
|
) |
|
|
|
WHERE |
|
|
|
sca.DEL_FLAG = '0' |
|
|
|
AND sca.PARENT_AREA_CODE like concat( #{areaCode},'%') |
|
|
|
and sca.AGENCY_ID !=#{agencyId} |
|
|
|
AND sca.PARENT_AREA_CODE =#{areaCode} |
|
|
|
AND sca.AGENCY_ID != #{agencyId} |
|
|
|
GROUP BY |
|
|
|
sca.AGENCY_ID, |
|
|
|
sca.AGENCY_NAME |
|
|
@ -43,8 +54,14 @@ |
|
|
|
IFNULL( sum( m.ORGANIZE_TOTAL ), 0 ) AS participateTotal |
|
|
|
FROM |
|
|
|
screen_customer_agency sca |
|
|
|
inner JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} ) |
|
|
|
inner JOIN screen_customer_work_record_dict dict ON ( m.TYPE_CODE = dict.RESOURCE_CODE AND dict.DEL_FLAG = '0' AND dict.DATA_TYPE = #{dataType} ) |
|
|
|
inner JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} |
|
|
|
) |
|
|
|
inner JOIN screen_customer_work_record_dict dict |
|
|
|
ON ( m.TYPE_CODE = dict.RESOURCE_CODE |
|
|
|
and dict.`LEVEL`='1' |
|
|
|
AND dict.DEL_FLAG = '0' |
|
|
|
AND dict.DATA_TYPE = #{dataType} |
|
|
|
) |
|
|
|
WHERE |
|
|
|
sca.DEL_FLAG = '0' |
|
|
|
AND sca.PARENT_AREA_CODE like concat( #{areaCode},'%') |
|
|
|