| | |
| | | <if test="intakeNum != null and intakeNum != ''"> |
| | | AND inta.name = #{intakeNum} |
| | | </if> |
| | | <if test="isBinded == 0"> |
| | | AND inta.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0) |
| | | </if> |
| | | <if test="isBinded == 1"> |
| | | AND inta.id IN(SELECT intakeId FROM pr_controller where deleted = 0) |
| | | </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 |
| | | 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 |
| | | inta.id AS intakeId, |
| | | con.rtuAddr, |
| | | inta.name AS intakeNum, |
| | | (CASE |
| | | WHEN con.rtuAddr IS NULL THEN "false" |
| | | WHEN con.rtuAddr IS NOT NULL THEN "true" |
| | | END) AS isBinded, |
| | | rtus.isOnLine |
| | | FROM pr_intake inta |
| | | LEFT JOIN pr_controller con ON con.intakeId = inta.id |
| | | 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 test="intakeNum != null and intakeNum != ''"> |
| | | AND inta.name = #{intakeNum} |
| | | </if> |
| | | <if test="isBinded == false "> |
| | | AND con.rtuAddr IS NULL |
| | | </if> |
| | | <if test="isBinded == true "> |
| | | AND con.rtuAddr IS NOT NULL |
| | | </if> |
| | | </where> |
| | | order by con.id ASC |
| | | <if test="pageCurr != null and pageSize != null"> |