wangbo 3 years ago
parent
commit
315a832597

+ 3 - 3
operation_manager/src/main/resources/mapper/order/WorkOrderManageMapper.xml

@@ -1141,9 +1141,9 @@
       (
       select TIMESTAMPDIFF(DAY,date_create,finish_date) duration
       from sc_work_order_manage t1
-      <where>t1.order_status=2
-        and t1.
-        date_create &gt;= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
+      <where>
+        (t1.order_status=2 or t1.order_status=3)
+        and t1.date_create &gt;= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
         and t1.date_create &lt; date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
         <if test="order.tenantId != null and order.tenantId != ''">
             and t1.tenant_id = #{order.tenantId}

+ 91 - 0
sms_water/src/main/resources/mapper/SceneMapper.xml

@@ -428,4 +428,95 @@
             </if>
         </where>
     </select>
+    <!--报警场景及报警设备查询-->
+    <select id="selectAlarmSceneAndDevice" resultType="map">
+        select count(1) amount,a.id,a.SCENE_NAME name,2 type
+        from sms_scene a INNER JOIN sms_scene_type b on a.SCENE_TYPE_ID=b.ID
+        INNER JOIN sms_alarm_details c on c.PARENT_SCENE_ID=a.ID
+        <where>
+            a.PARENT_SCENE_ID=0 and a.STATUS=1
+            <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.DEPT_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="scene.permissonType == 4 or scene.permissonType == 3">
+                    and a.DEPT_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>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+            and c.date_create &gt;= date_format(#{startDate,jdbcType=VARCHAR},'%Y-%m-%d')
+            and c.date_create &lt; date_format(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d')
+            and SCENE_TYPE_NAME in('水源','水厂','泵站')
+        </where>
+        group by a.SCENE_NAME, a.ID, 2
+
+        union all
+
+        select count(1) amount,a.id,d.DEVICE_NAME name,1 type
+        from sms_scene a INNER JOIN sms_scene_type b on a.SCENE_TYPE_ID=b.ID
+        INNER JOIN sms_alarm_details c on c.PARENT_SCENE_ID=a.ID
+        INNER JOIN sms_device d on c.DEVICE_ID=d.ID
+        <where>
+            a.PARENT_SCENE_ID=0 and a.STATUS=1
+            <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.DEPT_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="scene.permissonType == 4 or scene.permissonType == 3">
+                    and a.DEPT_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>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+            and c.date_create &gt;= date_format(#{startDate,jdbcType=VARCHAR},'%Y-%m-%d')
+            and c.date_create &lt; date_format(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d')
+            and SCENE_TYPE_NAME='管网'
+        </where>
+        group by d.DEVICE_NAME, d.ID, 1
+    </select>
+
+
+
+
 </mapper>