|
|
@ -66,37 +66,43 @@ |
|
|
|
ic_party_activity a |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
ACTIVITY_ID, |
|
|
|
GROUP_CONCAT( UNIT_ID ) AS unitId |
|
|
|
ur.ACTIVITY_ID, |
|
|
|
GROUP_CONCAT( ur.UNIT_ID ) AS unitId |
|
|
|
FROM |
|
|
|
ic_activity_unit_relation |
|
|
|
ic_activity_unit_relation ur |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND AGENCY_ID = #{agencyId} |
|
|
|
ur.DEL_FLAG = '0' |
|
|
|
<if test='null != agencyId and "" != agencyId'> |
|
|
|
AND (ur.AGENCY_ID = #{agencyId} or ur.PIDS like concat('%',#{agencyId},'%')) |
|
|
|
</if> |
|
|
|
<if test='null != unitId and "" != unitId'> |
|
|
|
AND UNIT_ID = #{unitId} |
|
|
|
AND ur.UNIT_ID = #{unitId} |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
ACTIVITY_ID |
|
|
|
ur.ACTIVITY_ID |
|
|
|
) b ON a.ID = b.ACTIVITY_ID |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
ACTIVITY_ID, |
|
|
|
GROUP_CONCAT( SERVICE_MATTER ) AS serviceMatter |
|
|
|
sr.ACTIVITY_ID, |
|
|
|
GROUP_CONCAT( sr.SERVICE_MATTER ) AS serviceMatter |
|
|
|
FROM |
|
|
|
ic_activity_service_relation |
|
|
|
ic_activity_service_relation sr |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND AGENCY_ID = #{agencyId} |
|
|
|
sr.DEL_FLAG = '0' |
|
|
|
<if test='null != agencyId and "" != agencyId'> |
|
|
|
AND (sr.AGENCY_ID = #{agencyId} or sr.PIDS like concat('%',#{agencyId},'%')) |
|
|
|
</if> |
|
|
|
<if test='null != serviceMatter and "" != serviceMatter'> |
|
|
|
AND SERVICE_MATTER = #{serviceMatter} |
|
|
|
AND sr.SERVICE_MATTER = #{serviceMatter} |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
ACTIVITY_ID |
|
|
|
sr.ACTIVITY_ID |
|
|
|
) c ON a.ID = c.ACTIVITY_ID |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.AGENCY_ID = #{agencyId} |
|
|
|
<if test='null != agencyId and "" != agencyId'> |
|
|
|
AND (a.AGENCY_ID = #{agencyId} or a.PIDS like concat('%',#{agencyId},'%')) |
|
|
|
</if> |
|
|
|
<if test='null != gridId and "" != gridId'> |
|
|
|
AND a.GRID_ID = #{gridId} |
|
|
|
</if> |
|
|
|