lin vor 4 Jahren
Ursprung
Commit
63c5c28b9d

+ 3 - 2
smart-city-platform/src/main/resources/mapper/BuildingMapper.xml

@@ -1023,8 +1023,9 @@
             <if test="days != null"> and swmed.days = #{days} </if>
             <if test="startDays != null"> and swmed.days >= #{startDays} </if>
             <if test="endDays != null"> and swmed.days <![CDATA[ <= ]]> #{endDays} </if>
-            <if test="valveStatus != null and valveStatus != 2"> and swmed.valve_status = #{valveStatus} and sdt.is_valve = 1 </if>
-            <if test="valveStatus != null and valveStatus == 2"> and sdt.is_valve = 0 </if>
+            <if test="valveStatus != null and valveStatus == 0"> and swmed.valve_status = #{valveStatus} and sdt.is_valve = 1</if>
+            <if test="valveStatus != null and valveStatus == 1"> and (swmed.valve_status = #{valveStatus} or swmed.valve_status is null ) and sdt.is_valve = 1</if>
+            <if test="valveStatus != null and valveStatus == 2"> and sdt.is_valve = 0</if>
             <if test="registerStatus != null"> and sd.register_status = #{registerStatus} </if>
             <if test="programItems != null and programItems.size() != 0"> and
                 <foreach collection="programItems" item="item" open="(" separator=" or " close=")">

+ 57 - 55
smart-city-platform/src/main/resources/mapper/DeviceMapper.xml

@@ -393,7 +393,8 @@
         <if test="collectorNo != null and collectorNo != ''"> AND scol.collector_no LIKE concat('%',#{collectorNo},'%')</if>
         <if test="errorType != null and errorType != ''"> AND swmed.last_error_type LIKE concat('%',#{errorType},'%')</if>
         <if test="customerId != null"> and sd.customer_id = #{customerId}</if>
-        <if test="valveStatus != null and valveStatus != 2"> and swmed.valve_status = #{valveStatus} and sdt.is_valve = 1</if>
+        <if test="valveStatus != null and valveStatus == 0"> and swmed.valve_status = #{valveStatus} and sdt.is_valve = 1</if>
+        <if test="valveStatus != null and valveStatus == 1"> and (swmed.valve_status = #{valveStatus} or swmed.valve_status is null ) and sdt.is_valve = 1</if>
         <if test="valveStatus != null and valveStatus == 2"> and sdt.is_valve = 0</if>
         <if test="registerStatus != null"> and sd.register_status = #{registerStatus}</if>
         <if test="days != null">
@@ -420,6 +421,61 @@
         </if>
     </select>
 
+    <!--自定义getList的count统计-->
+    <select id="getList_COUNT" resultType="Long">
+        select count(1)
+        from sc_device sd
+        <if test="(equipmentType != null and equipmentType != '') or (model != null and model != '') or (valveStatus != null)">left join sc_device_type sdt on (sdt.id = sd.device_type and sdt.status = 1)</if>
+        <if test="province != null or city != null or region != null or community != null">left join sc_building sb on (sb.id = sd.building_id and sb.status = 1)</if>
+        <if test="(concentratorNo != null and concentratorNo != '') or (collectorNo != null and collectorNo != '') ">left join sc_water_related_device swrd on ( swrd.device_id = sd.id and swrd.status = 1)</if>
+        <if test="concentratorNo != null and concentratorNo != ''">left join sc_concentrator scon on ( scon.id = swrd.concentrator_id and scon.status = 1)</if>
+        <if test="collectorNo != null and collectorNo != ''">left join sc_collector scol on ( scol.id = swrd.collector_id)</if>
+        <if test="(errorType != null and errorType != '') or days != null or startDays != null or endDays != null or (valveStatus != null)">left join sc_water_meter_error_days swmed on ( swmed.device_id = sd.id)</if>
+        <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
+        where sd.status = 1
+        <if test="sysId != null"> AND sd.sys_id = #{sysId}</if>
+        <if test="buildingId != null"> AND sd.building_id = #{buildingId}</if>
+        <if test="siteId != null"> AND sd.site_id = #{siteId}</if>
+        <if test="deviceNo != null and deviceNo != ''"> AND (sd.device_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_file_no LIKE concat('%',#{deviceNo},'%'))</if>
+        <if test="status != null"> AND sd.device_status = #{status}</if>
+        <if test="manufacturerId != null"> AND sd.manufacturer_id = #{manufacturerId}</if>
+        <if test="equipmentType != null and equipmentType != ''"> AND sdt.equipment_type LIKE concat('%',#{equipmentType},'%')</if>
+        <if test="model != null and model != ''"> AND sdt.model LIKE concat('%',#{model},'%')</if>
+        <if test="deviceTypeId != null"> AND sd.device_type = #{deviceTypeId}</if>
+        <if test="floor != null"> AND sd.floor = #{floor}</if>
+        <if test="isTag != null"> AND sd.is_tag = #{isTag}</if>
+        <if test="locDesc != null and locDesc != ''"> AND sd.loc_desc LIKE concat('%',#{locDesc},'%')</if>
+        <if test="province != null"> and sb.province = #{province}</if>
+        <if test="city != null"> and sb.city = #{city}</if>
+        <if test="region != null"> and sb.region = #{region}</if>
+        <if test="community != null"> and sb.community = #{community}</if>
+        <if test="concentratorNo != null and concentratorNo != ''"> AND scon.serial_number LIKE concat('%',#{concentratorNo},'%')</if>
+        <if test="collectorNo != null and collectorNo != ''"> AND scol.collector_no LIKE concat('%',#{collectorNo},'%')</if>
+        <if test="errorType != null and errorType != ''"> AND swmed.last_error_type LIKE concat('%',#{errorType},'%')</if>
+        <if test="customerId != null"> and sd.customer_id = #{customerId}</if>
+        <if test="valveStatus != null and valveStatus == 0"> and swmed.valve_status = #{valveStatus} and sdt.is_valve = 1</if>
+        <if test="valveStatus != null and valveStatus == 1"> and (swmed.valve_status = #{valveStatus} or swmed.valve_status is null ) and sdt.is_valve = 1</if>
+        <if test="valveStatus != null and valveStatus == 2"> and sdt.is_valve = 0</if>
+        <if test="registerStatus != null"> and sd.register_status = #{registerStatus}</if>
+        <if test="days != null">
+            <choose>
+                <when test="days == 0">
+                    and (swmed.days = #{days} or swmed.days is null )
+                </when>
+                <otherwise>
+                    and swmed.days = #{days}
+                </otherwise>
+            </choose>
+        </if>
+        <if test="startDays != null"> and swmed.days >= #{startDays} </if>
+        <if test="endDays != null"> and swmed.days <![CDATA[ <= ]]> #{endDays} </if>
+        <if test="programItems != null and programItems.size() != 0"> and
+            <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
+                sdd.${item.dimensionCode} = #{item.dimensionValue}
+            </foreach>
+        </if>
+    </select>
+
     <select id="getWaterMeterListByDeviceNo" resultType="com.bz.smart_city.dto.DeviceDto">
         select sd.*,sdt.equipment_type,sdt.model,sdm.name manufacturer_name,sb.name as building_name,sc.channel_name as system_name,
         sb.longitude,sb.latitude,
@@ -485,60 +541,6 @@
         <if test="locDesc != null and locDesc != ''"> AND sd.loc_desc LIKE concat('%',#{locDesc},'%')</if>
     </select>
 
-    <!--自定义getList的count统计-->
-    <select id="getList_COUNT" resultType="Long">
-        select count(1)
-        from sc_device sd
-        <if test="(equipmentType != null and equipmentType != '') or (model != null and model != '') or (valveStatus != null)">left join sc_device_type sdt on (sdt.id = sd.device_type and sdt.status = 1)</if>
-        <if test="province != null or city != null or region != null or community != null">left join sc_building sb on (sb.id = sd.building_id and sb.status = 1)</if>
-        <if test="(concentratorNo != null and concentratorNo != '') or (collectorNo != null and collectorNo != '') ">left join sc_water_related_device swrd on ( swrd.device_id = sd.id and swrd.status = 1)</if>
-        <if test="concentratorNo != null and concentratorNo != ''">left join sc_concentrator scon on ( scon.id = swrd.concentrator_id and scon.status = 1)</if>
-        <if test="collectorNo != null and collectorNo != ''">left join sc_collector scol on ( scol.id = swrd.collector_id)</if>
-        <if test="(errorType != null and errorType != '') or days != null or startDays != null or endDays != null or (valveStatus != null)">left join sc_water_meter_error_days swmed on ( swmed.device_id = sd.id)</if>
-        <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
-        where sd.status = 1
-        <if test="sysId != null"> AND sd.sys_id = #{sysId}</if>
-        <if test="buildingId != null"> AND sd.building_id = #{buildingId}</if>
-        <if test="siteId != null"> AND sd.site_id = #{siteId}</if>
-        <if test="deviceNo != null and deviceNo != ''"> AND (sd.device_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_file_no LIKE concat('%',#{deviceNo},'%'))</if>
-        <if test="status != null"> AND sd.device_status = #{status}</if>
-        <if test="manufacturerId != null"> AND sd.manufacturer_id = #{manufacturerId}</if>
-        <if test="equipmentType != null and equipmentType != ''"> AND sdt.equipment_type LIKE concat('%',#{equipmentType},'%')</if>
-        <if test="model != null and model != ''"> AND sdt.model LIKE concat('%',#{model},'%')</if>
-        <if test="deviceTypeId != null"> AND sd.device_type = #{deviceTypeId}</if>
-        <if test="floor != null"> AND sd.floor = #{floor}</if>
-        <if test="isTag != null"> AND sd.is_tag = #{isTag}</if>
-        <if test="locDesc != null and locDesc != ''"> AND sd.loc_desc LIKE concat('%',#{locDesc},'%')</if>
-        <if test="province != null"> and sb.province = #{province}</if>
-        <if test="city != null"> and sb.city = #{city}</if>
-        <if test="region != null"> and sb.region = #{region}</if>
-        <if test="community != null"> and sb.community = #{community}</if>
-        <if test="concentratorNo != null and concentratorNo != ''"> AND scon.serial_number LIKE concat('%',#{concentratorNo},'%')</if>
-        <if test="collectorNo != null and collectorNo != ''"> AND scol.collector_no LIKE concat('%',#{collectorNo},'%')</if>
-        <if test="errorType != null and errorType != ''"> AND swmed.last_error_type LIKE concat('%',#{errorType},'%')</if>
-        <if test="customerId != null"> and sd.customer_id = #{customerId}</if>
-        <if test="valveStatus != null and valveStatus != 2"> and swmed.valve_status = #{valveStatus}</if>
-        <if test="valveStatus != null and valveStatus == 2"> and sdt.is_valve = 0</if>
-        <if test="registerStatus != null"> and sd.register_status = #{registerStatus}</if>
-        <if test="days != null">
-            <choose>
-                <when test="days == 0">
-                    and (swmed.days = #{days} or swmed.days is null )
-                </when>
-                <otherwise>
-                    and swmed.days = #{days}
-                </otherwise>
-            </choose>
-        </if>
-        <if test="startDays != null"> and swmed.days >= #{startDays} </if>
-        <if test="endDays != null"> and swmed.days <![CDATA[ <= ]]> #{endDays} </if>
-        <if test="programItems != null and programItems.size() != 0"> and
-            <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
-                sdd.${item.dimensionCode} = #{item.dimensionValue}
-            </foreach>
-        </if>
-    </select>
-
     <update id="batchDelete">
         update sc_device set status = 0,date_update=NOW(),update_by=#{updateBy}
         where status = 1