wangbo 4 anos atrás
pai
commit
f689b5da7a
1 arquivos alterados com 26 adições e 2 exclusões
  1. 26 2
      sms_water/src/main/resources/mapper/SceneMapper.xml

+ 26 - 2
sms_water/src/main/resources/mapper/SceneMapper.xml

@@ -402,7 +402,31 @@
             group by b.SCENE_TYPE_NAME
         ) b
         on a.sceneTypeName = b.sceneTypeName
-    </select>
-
+        union all
+        select '户表' , sum(user_meter_count) amount, sum(user_meter_add_count) newAmount
+        from sms_month_revenue a
+        <where>
+            <if test="months != null">
+                and a.collect_date>=date_sub(date_format(curdate(), '%y-%m-1' ), interval #{months}-1 month)
+            </if>
+            <if test="scene.tenantId != null  and scene.tenantId != ''">
+                and a.tenant_id = #{scene.tenantId}
+            </if>
+            <if test="scene.userType!=null and scene.userType!=-999 and scene.userType!=-9999 and  scene.programItems != null and scene.programItems.size() > 0">
+                <if test="scene.permissonType == 5 or scene.permissonType == 2">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
 
+                </if>
+                <if test="scene.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+            </if>
+        </where>
+    </select>
 </mapper>