Ver Fonte

客户抄表率BUG

lin há 4 anos atrás
pai
commit
42789b31aa

+ 5 - 5
smart-city-platform/src/main/resources/mapper/StatMeterReadRateByBuildingMapper.xml

@@ -519,8 +519,8 @@
                 SUM(device_count) as device_count
             FROM
                 ${tableName} ssmrrbb
-            WHERE
-                ssmrrbb.site_id = #{siteId}
+            WHERE 1 = 1
+                <if test="siteId != null"> ssmrrbb.site_id = #{siteId} </if>
                 <if test="channelId != null"> and ssmrrbb.channel_id = #{channelId} </if>
                 AND ssmrrbb.stat_day = #{startDate}
                 AND ssmrrbb.channel_id <![CDATA[ <> ]]> - 99
@@ -529,7 +529,7 @@
             GROUP BY
                 ssmrrbb.customer_id
         )t1 on(t1.customer_id = sc.id)
-        WHERE sc.`status` = 1 and sc.site_id = #{siteId}
+        WHERE sc.`status` = 1 <if test="siteId != null"> and sc.site_id = #{siteId}</if>
         <if test="customerIds != null and customerIds.size() != 0"> and sc.id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
         ORDER BY device_count desc
     </select>
@@ -545,8 +545,8 @@
         ifnull(ROUND(sum(real_read_times)/sum(device_count)*100,2),0) as read_rate
         FROM ${tableName} ssmrrbb
         left join sc_channel sc on(sc.id = ssmrrbb.channel_id)
-        WHERE
-        ssmrrbb.site_id = #{siteId}
+        WHERE 1 = 1
+        <if test="siteId != null"> ssmrrbb.site_id = #{siteId} </if>
         and ssmrrbb.stat_day = #{startDate}
         AND ssmrrbb.channel_id <![CDATA[ <> ]]> - 99
         <if test="customerId != null"> and ssmrrbb.customer_id = #{customerId} </if>