|  |  | 
 |  |  |         COUNT(*) AS recordCount | 
 |  |  |     FROM pr_controller con | 
 |  |  |         INNER JOIN pr_intake inta ON con.intakeId = inta.id | 
 |  |  |         INNER JOIN JSON_TABLE( | 
 |  |  |         <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> | 
 |  |  |         #{onLineMap}, | 
 |  |  |         '$[*]' COLUMNS( | 
 |  |  |             rtuAddr VARCHAR(20) PATH '$.rtuAddr', | 
 |  |  |             isOnLine BOOLEAN PATH '$.isOnLine' | 
 |  |  |         ) | 
 |  |  |     ) rtus ON con.rtuAddr = rtus.rtuAddr | 
 |  |  |         left JOIN JSON_TABLE( | 
 |  |  |             <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> | 
 |  |  |             #{onLineMap}, | 
 |  |  |             '$[*]' COLUMNS( | 
 |  |  |                 rtuAddr VARCHAR(20) PATH '$.rtuAddr', | 
 |  |  |                 isOnLine BOOLEAN PATH '$.isOnLine' | 
 |  |  |             ) | 
 |  |  |         ) rtus ON con.rtuAddr = rtus.rtuAddr | 
 |  |  |     <where> | 
 |  |  |       <if test="isOnLine != null"> | 
 |  |  |         rtus.isOnLine = #{isOnLine} | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeNum != null and intakeNum != ''"> | 
 |  |  |         AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') | 
 |  |  |         AND inta.name = #{intakeNum} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |   </select> | 
 |  |  | 
 |  |  |       rtus.isOnLine | 
 |  |  |     FROM pr_controller con | 
 |  |  |         INNER JOIN pr_intake inta ON con.intakeId = inta.id | 
 |  |  |         INNER JOIN JSON_TABLE( | 
 |  |  |         left JOIN JSON_TABLE( | 
 |  |  |             <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> | 
 |  |  |             #{onLineMap}, | 
 |  |  |             '$[*]' COLUMNS( | 
 |  |  | 
 |  |  |         rtus.isOnLine = #{isOnLine} | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeNum != null and intakeNum != ''"> | 
 |  |  |         AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') | 
 |  |  |         AND inta.name = #{intakeNum} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |     order by con.id ASC | 
 |  |  |     <if test="pageCurr != null and pageSize != null"> | 
 |  |  |       LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} | 
 |  |  |     </if> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--根据取水口编号获取取水口对象--> | 
 |  |  |   <select id="getIntakeByName" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> | 
 |  |  |     SELECT | 
 |  |  |       con.intakeId, | 
 |  |  |       con.rtuAddr, | 
 |  |  |       inta.name AS intakeNum, | 
 |  |  |       rtus.isOnLine | 
 |  |  |     FROM pr_controller con | 
 |  |  |       INNER JOIN pr_intake inta ON con.intakeId = inta.id | 
 |  |  |       left JOIN JSON_TABLE( | 
 |  |  |         #{onLineMap}, | 
 |  |  |         '$[*]' COLUMNS( | 
 |  |  |         rtuAddr VARCHAR(20) PATH '$.rtuAddr', | 
 |  |  |         isOnLine BOOLEAN PATH '$.isOnLine' | 
 |  |  |         ) | 
 |  |  |       ) rtus ON con.rtuAddr = rtus.rtuAddr | 
 |  |  |     <where> | 
 |  |  |       <if test="intakeNum != null and intakeNum != ''"> | 
 |  |  |         AND LOWER(inta.name) = #{intakeNum} | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |     LIMIT 0,1 | 
 |  |  |  | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--根据操作员获取常用取水口--> | 
 |  |  | 
 |  |  |                rtus.isOnLine | 
 |  |  |     FROM pr_controller con | 
 |  |  |            INNER JOIN pr_intake inta ON con.intakeId = inta.id | 
 |  |  |            INNER JOIN rm_command_history com ON con.rtuAddr = com.rtuAddr | 
 |  |  |            INNER JOIN rm_command_history com ON con.rtuAddr = com.rtu_addr | 
 |  |  |            INNER JOIN JSON_TABLE( | 
 |  |  |             <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> | 
 |  |  |             #{onLineMap}, | 
 |  |  | 
 |  |  |       </if> | 
 |  |  |     </where> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--取水口名称换取水口ID,扫码开阀使用--> | 
 |  |  |   <select id="getIntakeIdByName" resultType="java.lang.Long"> | 
 |  |  |     SELECT id AS intakeId FROM pr_intake WHERE `name` = #{intakeName} | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--取水口名称换取水口ID,验证是否重复名称使用--> | 
 |  |  |   <select id="getIntakeIdsByName" resultType="java.lang.Long"> | 
 |  |  |     SELECT id AS intakeId FROM pr_intake WHERE `name` = #{intakeName} | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <!--取水口名称换取水口ID,验证是否重复名称使用--> | 
 |  |  |   <select id="getIntakeIdByNameExcludeId" resultType="java.lang.Long"> | 
 |  |  |     SELECT id AS intakeId FROM pr_intake WHERE id != #{id} and `name` = #{intakeName} | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | </mapper> |