| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -53,48 +53,56 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <select id="selectStaffPatrolList" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        SELECT | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            d.latest_patrol_status AS status, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            t.* | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        FROM( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            SELECT | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ssp.grid_id AS gridId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ssp.staff_id AS staffId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cs.real_name AS staffName, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cs.gender AS gender, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IFNULL(MAX(ssp.latest_patrol_time), '') AS patrolStartTime, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IFNULL(SUM(ssp.patrol_total), 0) AS patrolTotal, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ssp.latest_patrol_status AS STATUS, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            MAX(DATE_ID) dateId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IFNULL(SUM(ssp.report_project_count), 0) AS reportProjectCount, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IFNULL(SUM(ssp.total_time), 0) AS timeNum | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        FROM | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            FROM | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            stats_staff_patrol_record_daily ssp | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        LEFT JOIN customer_staff cs ON ssp.staff_id = cs.user_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        WHERE | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LEFT JOIN customer_staff cs ON ssp.staff_id = cs.user_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WHERE | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ssp.del_flag = '0' | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AND ssp.date_id >= #{patrolStartTime} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        <if test="staffName!= null and staffName != ''"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AND cs.real_name = #{staffName} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        </if> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        <if test="gridIds != null and gridIds.size() > 0"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            <foreach collection="gridIds" item="gridId" open="AND (" separator=" OR "  close=" )" > | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ssp.grid_id = #{gridId} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            </foreach> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        </if> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GROUP BY ssp.grid_id, ssp.staff_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        <if test="sortCode!= null and sortCode != ''"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            <choose> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                <when test="sortCode == 'patrolTotal' "> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ORDER BY SUM(ssp.patrol_total) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                </when> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                <when test="sortCode == 'latestPatrolledTime' "> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ORDER BY MAX(ssp.latest_patrol_time) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                </when> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                <when test="sortCode == 'reportProjectCount' "> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ORDER BY SUM(ssp.report_project_count) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                </when> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                <otherwise> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ORDER BY SUM(ssp.total_time) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                </otherwise> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            </choose> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        </if> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        LIMIT | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AND ssp.date_id >= #{patrolStartTime} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            <if test="staffName!= null and staffName != ''"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AND cs.real_name = #{staffName} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            </if> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            <if test="gridIds != null and gridIds.size() > 0"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                <foreach collection="gridIds" item="gridId" open="AND (" separator=" OR "  close=" )" > | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ssp.grid_id = #{gridId} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                </foreach> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            </if> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            GROUP BY ssp.grid_id, ssp.staff_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            <if test="sortCode!= null and sortCode != ''"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                <choose> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    <when test="sortCode == 'patrolTotal' "> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        ORDER BY SUM(ssp.patrol_total) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    </when> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    <when test="sortCode == 'latestPatrolledTime' "> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        ORDER BY MAX(ssp.latest_patrol_time) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    </when> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    <when test="sortCode == 'reportProjectCount' "> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        ORDER BY SUM(ssp.report_project_count) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    </when> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    <otherwise> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        ORDER BY SUM(ssp.total_time) DESC | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    </otherwise> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                </choose> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            </if> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LIMIT | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            #{pageNo}, #{pageSize} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ) t | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        INNER JOIN stats_staff_patrol_record_daily d ON t.dateId = d.date_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AND t.gridId = d.grid_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AND t.staffId = d.staff_id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    </select> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <select id="selectPersonalPatrolList" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO"> | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |