|
|
@ -76,8 +76,6 @@ |
|
|
|
SUM( c.SCORE ) AS totalScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN screen_project_data b ON a.EVENT_ID = b.PROJECT_ID |
|
|
|
AND b.DEL_FLAG = '0' |
|
|
|
INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
|
|
|
AND c.DEL_FLAG = '0' |
|
|
|
AND c.CUSTOMER_ID = #{customerId} |
|
|
@ -86,17 +84,24 @@ |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.EVENT_TYPE = 'project' |
|
|
|
<if test="startTime != null and startTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) >= #{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} |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'grid'"> |
|
|
|
AND b.ORG_ID = #{orgId} |
|
|
|
AND a.ORG_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND b.ALL_PARENT_IDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</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.CATEGORY_CODE |
|
|
|
) a |
|
|
|
WHERE CATEGORY_CODE IS NOT NULL |
|
|
|
</select> |
|
|
@ -113,27 +118,234 @@ |
|
|
|
SUM( c.SCORE ) AS totalScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN epmet_user.patrol_routine_work b ON a.EVENT_ID = b.ID |
|
|
|
AND b.DEL_FLAG = '0' |
|
|
|
INNER JOIN customer_patrol_work_type_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
|
|
|
AND c.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND a.EVENT_TYPE = 'work' |
|
|
|
<if test="startTime != null and startTime != ''"> |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) >= #{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} |
|
|
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'grid'"> |
|
|
|
AND b.GRID_ID = #{orgId} |
|
|
|
AND a.ORG_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND b.PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</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.CATEGORY_CODE |
|
|
|
) a |
|
|
|
WHERE CATEGORY_CODE IS NOT NULL |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getProjectCategoryList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO"> |
|
|
|
SELECT |
|
|
|
a.EVENT_ID, |
|
|
|
a.EVENT_TYPE, |
|
|
|
b.PROJECT_TITLE AS "title", |
|
|
|
CONCAT( d.CATEGORY_NAME, '-', c.CATEGORY_NAME ) AS "category", |
|
|
|
b.PROJECT_STATUS_CODE AS "status", |
|
|
|
b.PROJECT_CREATE_TIME AS "createTime", |
|
|
|
b.ORG_ID AS "gridId", |
|
|
|
b.LINK_NAME AS "staffName", |
|
|
|
c.SCORE |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN screen_project_data b ON a.EVENT_ID = b.PROJECT_ID |
|
|
|
INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
|
|
|
AND c.CUSTOMER_ID = #{customerId} |
|
|
|
INNER JOIN customer_project_category_dict d ON d.CATEGORY_CODE = c.PARENT_CATEGORY_CODE |
|
|
|
AND d.CUSTOMER_ID = #{customerId} |
|
|
|
WHERE |
|
|
|
a.EVENT_TYPE = 'project' |
|
|
|
AND (c.CATEGORY_CODE = #{categoryCode} OR d.CATEGORY_CODE = #{categoryCode}) |
|
|
|
<if test="orgType == 'grid'"> |
|
|
|
AND b.ORG_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND b.ALL_PARENT_IDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</if> |
|
|
|
<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 b.LINK_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND b.LINK_MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
ORDER BY PROJECT_CREATE_TIME DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getWorkCategoryList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO"> |
|
|
|
SELECT |
|
|
|
a.EVENT_ID, |
|
|
|
a.EVENT_TYPE, |
|
|
|
a.TITLE, |
|
|
|
CONCAT( d.CATEGORY_NAME, '-', c.CATEGORY_NAME ) AS "category", |
|
|
|
DATE_FORMAT(a.EVENT_CREATE_TIME,'%Y-%m-%d') AS "createTime", |
|
|
|
a.ORG_ID AS 'gridId', |
|
|
|
a.STAFF_NAME AS 'staffName', |
|
|
|
c.SCORE |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_patrol_work_type_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
|
|
|
INNER JOIN customer_patrol_work_type_dict d ON d.CATEGORY_CODE = c.PARENT_CATEGORY_CODE |
|
|
|
WHERE |
|
|
|
a.EVENT_TYPE = 'WORK' |
|
|
|
AND (c.CATEGORY_CODE = '01' OR d.CATEGORY_CODE = '01') |
|
|
|
<if test="orgType == 'grid'"> |
|
|
|
AND a.ORG_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</if> |
|
|
|
<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> |
|
|
|
ORDER BY EVENT_CREATE_TIME DESC |
|
|
|
</select> |
|
|
|
<select id="getProjectTotalScore" resultType="java.lang.Long"> |
|
|
|
SELECT |
|
|
|
IFNULL(SUM( c.SCORE ), 0) AS totalScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
|
|
|
AND c.DEL_FLAG = '0' |
|
|
|
AND c.CUSTOMER_ID = #{customerId} |
|
|
|
AND c.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND 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="orgType == 'grid'"> |
|
|
|
AND a.ORG_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</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> |
|
|
|
</select> |
|
|
|
<select id="getWorkTotalScore" resultType="java.lang.Long"> |
|
|
|
SELECT |
|
|
|
IFNULL(SUM( c.SCORE ), 0) AS totalScore |
|
|
|
FROM |
|
|
|
screen_py_event_data a |
|
|
|
INNER JOIN customer_patrol_work_type_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
|
|
|
AND c.IS_DISABLE = 'enable' |
|
|
|
WHERE |
|
|
|
a.DEL_FLAG = '0' |
|
|
|
AND 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="orgType == 'grid'"> |
|
|
|
AND a.ORG_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</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> |
|
|
|
</select> |
|
|
|
<select id="getMemberCount" resultType="java.lang.Long"> |
|
|
|
SELECT |
|
|
|
IFNULL(COUNT(ID), 0) |
|
|
|
FROM |
|
|
|
screen_py_grid_staff |
|
|
|
WHERE |
|
|
|
DEL_FLAG = '0' |
|
|
|
AND IS_LEAVE = 'N' |
|
|
|
<if test="orgType == 'grid'"> |
|
|
|
AND GRID_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="orgType == 'agency'"> |
|
|
|
AND PIDS LIKE CONCAT('%', #{orgId}, '%') |
|
|
|
</if> |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
AND STAFF_NAME LIKE CONCAT('%', #{name}, '%') |
|
|
|
</if> |
|
|
|
<if test="mobile != null and mobile != ''"> |
|
|
|
AND MOBILE LIKE CONCAT('%', #{mobile}, '%') |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
<select id="selectProjectCategoryForExport" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO"> |
|
|
|
SELECT |
|
|
|
'上报事件' AS eventType, |
|
|
|
p1.CATEGORY_CODE AS parentCategoryCode, |
|
|
|
p2.CATEGORY_CODE AS categoryCode, |
|
|
|
p1.CATEGORY_NAME AS parentCategoryName, |
|
|
|
p2.CATEGORY_NAME AS categoryName, |
|
|
|
p2.SCORE AS score |
|
|
|
FROM |
|
|
|
customer_project_category_dict p1, |
|
|
|
customer_project_category_dict p2 |
|
|
|
WHERE |
|
|
|
p1.DEL_FLAG = '0' |
|
|
|
AND p2.DEL_FLAG = '0' |
|
|
|
AND p1.CUSTOMER_ID = #{customerId} |
|
|
|
AND p2.CUSTOMER_ID = #{customerId} |
|
|
|
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE |
|
|
|
AND p1.CUSTOMER_TYPE = 'internal' |
|
|
|
AND p2.CUSTOMER_TYPE = 'internal' |
|
|
|
AND p1.IS_DISABLE = 'enable' |
|
|
|
AND p2.IS_DISABLE = 'enable' |
|
|
|
ORDER BY |
|
|
|
p1.SORT, |
|
|
|
p2.SORT |
|
|
|
</select> |
|
|
|
<select id="selectWorkCategoryForExport" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO"> |
|
|
|
SELECT |
|
|
|
'例行工作' AS eventType, |
|
|
|
p1.CATEGORY_CODE AS parentCategoryCode, |
|
|
|
p2.CATEGORY_CODE AS categoryCode, |
|
|
|
p1.CATEGORY_NAME AS parentCategoryName, |
|
|
|
p2.CATEGORY_NAME AS categoryName, |
|
|
|
p2.SCORE AS score |
|
|
|
FROM customer_patrol_work_type_dict p1,customer_patrol_work_type_dict p2 |
|
|
|
WHERE p1.DEL_FLAG = '0' |
|
|
|
AND p2.DEL_FLAG = '0' |
|
|
|
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE |
|
|
|
AND p1.IS_DISABLE = 'enable' |
|
|
|
AND p2.IS_DISABLE = 'enable' |
|
|
|
ORDER BY p1.SORT, p2.SORT |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |
|
|
|