zhubaomin
2024-10-28 cef410f571a2960e979ca9383d9c8dd01ecc862c
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -276,7 +276,7 @@
                AND cont.protocol = #{protocol}
            </if>
            <if test = "bindNumber != null and bindNumber > 0">
                AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = ${bindNumber}
                AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = #{bindNumber}
            </if>
        </where>
    </select>
@@ -357,7 +357,7 @@
                AND cont.protocol = #{protocol}
            </if>
            <if test = "bindNumber != null and bindNumber > 0">
                AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = ${bindNumber}
                AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = #{bindNumber}
            </if>
        </where>
        ORDER BY ge.operateDt DESC
@@ -660,26 +660,28 @@
    <!--根据操作员获取常用取水口-->
    <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.rtu_addr
        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
        SELECT
            com.intake_id AS intakeId,
            con.rtuAddr,
            inta.name AS intakeNum,
            rtus.isOnLine
        FROM pr_common_intakes com
            INNER JOIN pr_intake inta ON inta.id = com.intake_id
            INNER JOIN pr_controller con ON con.intakeId = com.intake_id
            INNER JOIN JSON_TABLE(
                <!--'[{"rtuAddr":"620201000030","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}
                com.operator_id = #{operator}
            </if>
        </where>
        ORDER BY com.last_used_time DESC,com.usage_count DESC
    </select>
    <!--取水口名称换取水口ID,扫码开阀使用-->