|  |  |  | 
|---|
|  |  |  | WHERE id NOT IN(SELECT intakeId FROM pr_controller) AND deleted = 0 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--获取取水口数量(在线和不在先)--> | 
|---|
|  |  |  | <select id="getOnLineIntakesCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="isOnLine != null"> | 
|---|
|  |  |  | rtus.isOnLine = #{isOnLine} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="intakeNum != null and intakeNum != ''"> | 
|---|
|  |  |  | AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--获取取水口列表(在线和不在先)--> | 
|---|
|  |  |  | <select id="getOnLineIntakes" 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 | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="isOnLine != null"> | 
|---|
|  |  |  | rtus.isOnLine = #{isOnLine} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="intakeNum != null and intakeNum != ''"> | 
|---|
|  |  |  | AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | <if test="pageCurr != null and pageSize != null"> | 
|---|
|  |  |  | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据操作员获取常用取水口--> | 
|---|
|  |  |  | <select id="getUsedIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | DISTINCT con.intakeId, | 
|---|
|  |  |  | con.rtuAddr, | 
|---|
|  |  |  | inta.name AS intakeNum, | 
|---|
|  |  |  | 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 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="operator != null"> | 
|---|
|  |  |  | com.operator = #{operator} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|