| 
						
						
							
								
							
						
						
					 | 
					@ -18,18 +18,24 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    <!-- 查询指定客户下一个用户所在的网格,按照网格名称升序排序,取第一个 --> | 
					 | 
					 | 
					    <!-- 查询指定客户下一个用户所在的网格,按照网格名称升序排序,取第一个 --> | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    <select id="selectStaffGridOrderByGridName" parameterType="com.epmet.dto.form.LatestGridFormDTO" resultType="com.epmet.dto.CustomerGridDTO"> | 
					 | 
					 | 
					    <select id="selectStaffGridOrderByGridName" parameterType="com.epmet.dto.form.LatestGridFormDTO" resultType="com.epmet.dto.CustomerGridDTO"> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        select csg.GRID_ID as id, | 
					 | 
					 | 
					        SELECT | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        cg.GRID_NAME, | 
					 | 
					 | 
					            grid.ID, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        cg.PID | 
					 | 
					 | 
					            grid.GRID_NAME, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        from customer_staff_grid csg | 
					 | 
					 | 
					            grid.PID | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        left join customer_grid cg | 
					 | 
					 | 
							FROM CUSTOMER_STAFF_GRID staff | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        on(csg.GRID_ID=cg.id | 
					 | 
					 | 
					        LEFT JOIN | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        and cg.DEL_FLAG='0') | 
					 | 
					 | 
					            CUSTOMER_GRID grid ON | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        where csg.DEL_FLAG='0' | 
					 | 
					 | 
					            grid.ID = staff.GRID_ID | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        and csg.CUSTOMER_ID=#{customerId} | 
					 | 
					 | 
					        WHERE | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        and csg.USER_ID=#{staffId} | 
					 | 
					 | 
					            grid.DEL_FLAG = '0' | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        order by cg.GRID_NAME desc | 
					 | 
					 | 
							AND | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        limit 1 | 
					 | 
					 | 
					            staff.DEL_FLAG = '0' | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        AND | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            staff.CUSTOMER_ID = #{customerId} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        AND | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            staff.USER_ID = #{staffId} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        ORDER BY grid.GRID_NAME ASC | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        LIMIT 1 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    </select> | 
					 | 
					 | 
					    </select> | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    <!-- 校验用户是否已加入当前网格 --> | 
					 | 
					 | 
					    <!-- 校验用户是否已加入当前网格 --> | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |