|
|
@ -287,7 +287,7 @@ |
|
|
|
</select> |
|
|
|
<select id="getMemberCount" resultType="java.lang.Long"> |
|
|
|
SELECT |
|
|
|
IFNULL(COUNT(ID), 0) |
|
|
|
IFNULL(COUNT(DISTINCT STAFF_ID), 0) |
|
|
|
FROM |
|
|
|
screen_py_grid_staff |
|
|
|
WHERE |
|
|
@ -348,4 +348,237 @@ |
|
|
|
ORDER BY p1.SORT, p2.SORT |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectOrgEventScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO"> |
|
|
|
SELECT |
|
|
|
a.orgName, |
|
|
|
projectCount, |
|
|
|
projectScore, |
|
|
|
workCount, |
|
|
|
workScore, |
|
|
|
memberCount |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
a.AGENCY_ID, |
|
|
|
a.AGENCY_NAME AS orgName, |
|
|
|
IFNULL( SUM( b.eventCount ), 0 ) AS projectCount, |
|
|
|
IFNULL( SUM( b.eventScore ), 0 ) AS projectScore |
|
|
|
FROM |
|
|
|
screen_customer_agency a |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.PIDS, |
|
|
|
COUNT( a.EVENT_ID ) AS eventCount, |
|
|
|
SUM( b.SCORE ) AS eventScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_project_category_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE |
|
|
|
AND b.CUSTOMER_ID = #{customerId} |
|
|
|
AND b.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.EVENT_TYPE = 'project' |
|
|
|
<if test="startTime != null and startTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test="endTime != null and endTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
a.PIDS |
|
|
|
) b ON b.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' ) |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.PARENT_AREA_CODE = #{areaCode} |
|
|
|
GROUP BY |
|
|
|
a.AGENCY_ID |
|
|
|
) a |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
a.AGENCY_ID, |
|
|
|
a.AGENCY_NAME AS orgName, |
|
|
|
IFNULL( SUM( c.eventCount ), 0 ) AS workCount, |
|
|
|
IFNULL( SUM( c.eventScore ), 0 ) AS workScore |
|
|
|
FROM |
|
|
|
screen_customer_agency a |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.PIDS, |
|
|
|
COUNT( a.EVENT_ID ) AS eventCount, |
|
|
|
SUM( b.SCORE ) AS eventScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_patrol_work_type_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE |
|
|
|
AND b.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.EVENT_TYPE = 'work' |
|
|
|
<if test="startTime != null and startTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test="endTime != null and endTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
a.PIDS |
|
|
|
) c ON c.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' ) |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.PARENT_AREA_CODE = #{areaCode} |
|
|
|
GROUP BY |
|
|
|
a.AGENCY_ID |
|
|
|
) b ON a.AGENCY_ID = b.AGENCY_ID |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
a.AGENCY_ID, |
|
|
|
a.AGENCY_NAME AS orgName, |
|
|
|
IFNULL( COUNT( DISTINCT d.STAFF_ID ), 0 ) AS memberCount |
|
|
|
FROM |
|
|
|
screen_customer_agency a |
|
|
|
LEFT JOIN screen_py_grid_staff d ON d.DEL_FLAG = '0' |
|
|
|
AND IS_LEAVE = 'N' |
|
|
|
AND d.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' ) |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND d.STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND d.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.PARENT_AREA_CODE = #{areaCode} |
|
|
|
GROUP BY |
|
|
|
a.AGENCY_ID |
|
|
|
) c ON a.AGENCY_ID = c.AGENCY_ID |
|
|
|
</select> |
|
|
|
<select id="selectGridEventScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO"> |
|
|
|
SELECT |
|
|
|
a.orgName, |
|
|
|
projectCount, |
|
|
|
projectScore, |
|
|
|
workCount, |
|
|
|
workScore, |
|
|
|
memberCount |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
a.GRID_ID, |
|
|
|
a.GRID_NAME AS orgName, |
|
|
|
IFNULL( SUM( b.eventCount ), 0 ) AS projectCount, |
|
|
|
IFNULL( SUM( b.eventScore ), 0 ) AS projectScore |
|
|
|
FROM |
|
|
|
screen_customer_grid a |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.ORG_ID, |
|
|
|
COUNT( a.EVENT_ID ) AS eventCount, |
|
|
|
SUM( b.SCORE ) AS eventScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_project_category_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE |
|
|
|
AND b.CUSTOMER_ID = #{customerId} |
|
|
|
AND b.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.EVENT_TYPE = 'project' |
|
|
|
<if test="startTime != null and startTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test="endTime != null and endTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
a.ORG_ID |
|
|
|
) b ON b.ORG_ID = a.GRID_ID |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.PARENT_AGENCY_ID = #{orgId} |
|
|
|
GROUP BY |
|
|
|
a.GRID_ID |
|
|
|
) a |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
a.GRID_ID, |
|
|
|
a.GRID_NAME AS orgName, |
|
|
|
IFNULL( SUM( c.eventCount ), 0 ) AS workCount, |
|
|
|
IFNULL( SUM( c.eventScore ), 0 ) AS workScore |
|
|
|
FROM |
|
|
|
screen_customer_grid a |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT |
|
|
|
a.ORG_ID, |
|
|
|
COUNT( a.EVENT_ID ) AS eventCount, |
|
|
|
SUM( b.SCORE ) AS eventScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_patrol_work_type_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE |
|
|
|
AND b.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.EVENT_TYPE = 'work' |
|
|
|
<if test="startTime != null and startTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test="endTime != null and endTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
a.ORG_ID |
|
|
|
) c ON c.ORG_ID = a.GRID_ID |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.PARENT_AGENCY_ID = #{orgId} |
|
|
|
GROUP BY |
|
|
|
a.GRID_ID |
|
|
|
) b ON a.GRID_ID = b.GRID_ID |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
a.GRID_ID, |
|
|
|
a.GRID_NAME AS orgName, |
|
|
|
IFNULL( COUNT( DISTINCT d.STAFF_ID ), 0 ) AS memberCount |
|
|
|
FROM |
|
|
|
screen_customer_grid a |
|
|
|
LEFT JOIN screen_py_grid_staff d ON d.DEL_FLAG = '0' |
|
|
|
AND IS_LEAVE = 'N' |
|
|
|
AND d.GRID_ID = a.GRID_ID |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND d.STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND d.MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.PARENT_AGENCY_ID = #{orgId} |
|
|
|
GROUP BY |
|
|
|
a.GRID_ID |
|
|
|
) c ON a.GRID_ID = c.GRID_ID |
|
|
|
</select> |
|
|
|
<select id="getAreaCode" resultType="java.lang.String"> |
|
|
|
SELECT AREA_CODE |
|
|
|
FROM screen_customer_agency |
|
|
|
WHERE DEL_FLAG = '0' |
|
|
|
AND AGENCY_ID = #{agencyId} |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |
|
|
|