liurunyu
2024-10-15 c66b1579e757abf750104215d357443705b86183
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -225,16 +225,25 @@
    <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake ge
                 INNER JOIN pr_divide divi ON ge.divideId = divi.id
                 INNER JOIN ba_block blo ON divi.blockId = blo.id
                 LEFT JOIN ba_district country ON ge.countyId = country.id
                 LEFT JOIN ba_district town ON ge.townId = town.id
                 LEFT JOIN ba_district village ON ge.villageId = village.id
                 LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
        INNER JOIN pr_divide divi ON ge.divideId = divi.id
        INNER JOIN ba_block blo ON divi.blockId = blo.id
        LEFT JOIN ba_district country ON ge.countyId = country.id
        LEFT JOIN ba_district town ON ge.townId = town.id
        LEFT JOIN ba_district village ON ge.villageId = village.id
        LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
        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 cont.rtuAddr = rtus.rtuAddr
        <where>
            ge.deleted = 0
              AND divi.deleted = 0
              and blo.deleted = 0
            AND divi.deleted = 0
            AND blo.deleted = 0
            AND cont.deleted = 0
            <if test="intakeName != null and intakeName != ''">
                AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
            </if>
@@ -257,6 +266,18 @@
            </if>
            <if test="address != null and address != ''">
                AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
            </if>
            <if test = "rtuAddr != null and rtuAddr !=''">
                AND cont.rtuAddr like CONCAT('%',#{rtuAddr},'%')
            </if>
            <if test="isOnLine != null and isOnLine !='' ">
                AND rtus.isOnLine = #{isOnLine}
            </if>
            <if test="protocol != null and protocol !='' ">
                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}
            </if>
        </where>
    </select>
@@ -271,6 +292,10 @@
               blo.`name`                                          AS blockName,
               CAST(cont.id AS char)                               AS controllerId,
               cont.rtuAddr                                        AS rtuAddr,
                cont.protocol                                       AS protocol,
                cont.findDt                                         AS findDt,
                rtus.isOnLine                                       AS isOnLine,
                (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) AS bindNumber,
               ge.lng,
               ge.lat,
               ge.remarks,
@@ -282,16 +307,25 @@
                   END)                                            AS isBind,
               CONCAT(country.`name`, town.`name`, village.`name`) AS address
        FROM pr_intake ge
                 INNER JOIN pr_divide divi ON ge.divideId = divi.id
                 INNER JOIN ba_block blo ON divi.blockId = blo.id
                 LEFT JOIN ba_district country ON ge.countyId = country.id
                 LEFT JOIN ba_district town ON ge.townId = town.id
                 LEFT JOIN ba_district village ON ge.villageId = village.id
                 LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
                INNER JOIN pr_divide divi ON ge.divideId = divi.id
                INNER JOIN ba_block blo ON divi.blockId = blo.id
                LEFT JOIN ba_district country ON ge.countyId = country.id
                LEFT JOIN ba_district town ON ge.townId = town.id
                LEFT JOIN ba_district village ON ge.villageId = village.id
                LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
                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 cont.rtuAddr = rtus.rtuAddr
        <where>
            ge.deleted = 0
              AND divi.deleted = 0
              and blo.deleted = 0
            AND divi.deleted = 0
            AND blo.deleted = 0
            AND cont.deleted = 0
            <if test="intakeName != null and intakeName != ''">
                AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
            </if>
@@ -315,6 +349,18 @@
            <if test="address != null and address != ''">
                AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
            </if>
            <if test = "rtuAddr != null and rtuAddr !=''">
                AND cont.rtuAddr like CONCAT('%',#{rtuAddr},'%')
            </if>
            <if test="isOnLine != null and isOnLine !='' ">
                AND rtus.isOnLine = #{isOnLine}
            </if>
            <if test="protocol != null and protocol !='' ">
                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}
            </if>
        </where>
        ORDER BY ge.operateDt DESC
        <trim prefix="limit ">