JX.LI 2 лет назад
Родитель
Сommit
df0055ed42

+ 26 - 41
ruoyi-gas/src/main/resources/mapper/GAreaMapper.xml

@@ -56,20 +56,15 @@
     </select>
     <select id="getExamineArea" resultType="com.ruoyi.gas.domain.vo.GCensusVo">
         select count( o.house_id) as value,
-            o.examine_status as name
+        o.examine_status as name
         from g_order o
-                left join g_house a
-        on o.house_id = a.id
-                left join g_unit b on a.unit_id = b.id
-                left join g_building c on b.building_id = c.id
-                left join g_area d on c.area_id = d.id
+        left join g_house a on o.house_id = a.id and a.del_flag = '0'
+        left join g_unit b on a.unit_id = b.id and b.del_flag = '0'
+        left join g_building c on b.building_id = c.id and c.del_flag = '0'
+        left join g_area d on c.area_id = d.id  and d.del_flag = '0'
         where o.order_status = '002'
         and o.service_type = '002'
-          and a.del_flag = '0'
-          and b.del_flag = '0'
-          and c.del_flag = '0'
-          and d.del_flag = '0'
-          and o.del_flag = '0'
+        and o.del_flag = '0'
         <if test="areaId != null  and areaId != ''">
             and d.id = #{areaId}
         </if>
@@ -77,20 +72,17 @@
     </select>
     <select id="getExamineServe" resultType="com.ruoyi.gas.domain.vo.GCensusVo">
         select count( o.id) as value,
-            o.service_type as name
+        o.service_type as name
         from g_order o
-                left join g_house a
-        on o.house_id = a.id
-                left join g_unit b on a.unit_id = b.id
-                left join g_building c on b.building_id = c.id
-                left join g_area d on c.area_id = d.id
-        where
-        a.del_flag = '0'
-          and b.del_flag = '0'
-          and c.del_flag = '0'
-          and d.del_flag = '0'
-          and o.del_flag = '0'
-        and o.service_type not in ('004','005','006')
+        left join g_house a on o.house_id = a.id and a.del_flag = '0'
+        left join g_unit b on a.unit_id = b.id and b.del_flag = '0'
+        left join g_building c on b.building_id = c.id and c.del_flag = '0'
+        left join g_area d on c.area_id = d.id and d.del_flag = '0'
+        where o.del_flag = '0'
+        and o.service_type = ''
+        or o.service_type = '001'
+        or o.service_type = '002'
+        or o.service_type = '003'
         <if test="id != null  and id != ''">
             and d.id = #{id}
         </if>
@@ -117,19 +109,15 @@
         and del_flag = '0'
     </select>
     <select id="getConform" resultType="com.ruoyi.gas.domain.vo.GCensusVo">
-        select  count( o.house_id) as value,
+        select count( o.house_id) as value,
         o.service_type as name
         from g_order o
-        left join g_house a on o.house_id = a.id
-        left join g_unit b on a.unit_id = b.id
-        left join g_building c on b.building_id = c.id
-        left join g_area d on c.area_id = d.id
-        where o.service_type not in ('001','004','005','006')
-        and a.del_flag = '0'
-        and b.del_flag = '0'
-        and c.del_flag = '0'
-        and d.del_flag = '0'
-        and o.del_flag = '0'
+        left join g_house a on o.house_id = a.id and a.del_flag = '0'
+        left join g_unit b on a.unit_id = b.id and b.del_flag = '0'
+        left join g_building c on b.building_id = c.id and c.del_flag = '0'
+        left join g_area d on c.area_id = d.id and d.del_flag = '0'
+        where o.del_flag = '0'
+        and o.service_type = '002' or o.service_type = '003' or o.service_type = ''
         <if test="areaId != null  and areaId != ''">
             and d.id = #{areaId}
         </if>
@@ -155,13 +143,10 @@
     <select id="getHouseCount" resultType="java.lang.Integer">
         select count( a.id)
         from g_house a
-        left join g_unit b on a.unit_id = b.id
-        left join g_building c on b.building_id = c.id
-        left join g_area d on c.area_id = d.id
+        left join g_unit b on a.unit_id = b.id and b.del_flag = '0'
+        left join g_building c on b.building_id = c.id and c.del_flag = '0'
+        left join g_area d on c.area_id = d.id and d.del_flag = '0'
         where a.del_flag = '0'
-        and b.del_flag = '0'
-        and c.del_flag = '0'
-        and d.del_flag = '0'
         <if test="areaId != null  and areaId != ''">
             and d.id = #{areaId}
         </if>

+ 27 - 50
ruoyi-gas/src/main/resources/mapper/GOrderMapper.xml

@@ -40,19 +40,15 @@
         a.version as version,
         CONCAT(f.dict_label,'-',e.name,'-',d.name,'-',c.name,'-',b.name) as house
         from g_order a
-        left join g_house b on a.house_id = b.id
-        left join g_unit c on b.unit_id = c.id
-        left join g_building d on c.building_id = d.id
-        left join g_area e on d.area_id = e.id
-        left join sys_dict_data f on e.district = f.dict_value
+        left join g_house b on a.house_id = b.id and b.del_flag = '0'
+        left join g_unit c on b.unit_id = c.id and c.del_flag = '0'
+        left join g_building d on c.building_id = d.id and d.del_flag = '0'
+        left join g_area e on d.area_id = e.id and e.del_flag = '0'
+        left join sys_dict_data f on e.district = f.dict_value and f.dict_type='district'
         left join g_user u on a.user_id = u.id
         where a.del_flag = '0'
-        and b.del_flag = '0'
-        and c.del_flag = '0'
-        and d.del_flag = '0'
-        and e.del_flag = '0'
         and a.service_type not in ('004','005','006')
-        and f.dict_type='district'
+
         <if test="p.serviceType != null  and p.serviceType != ''">
             and a.service_type = #{p.serviceType}
         </if>
@@ -174,19 +170,14 @@
         a.version as version,
         CONCAT(f.dict_label,'-',e.name,'-',d.name,'-',c.name,'-',b.name) as house
         from g_order a
-        left join g_house b on a.house_id = b.id
-        left join g_unit c on b.unit_id = c.id
-        left join g_building d on c.building_id = d.id
-        left join g_area e on d.area_id = e.id
-        left join sys_dict_data f on e.district = f.dict_value
+        left join g_house b on a.house_id = b.id and b.del_flag = '0'
+        left join g_unit c on b.unit_id = c.id and c.del_flag = '0'
+        left join g_building d on c.building_id = d.id and d.del_flag = '0'
+        left join g_area e on d.area_id = e.id  and e.del_flag = '0'
+        left join sys_dict_data f on e.district = f.dict_value and f.dict_type='district'
         left join g_user u on a.user_id = u.id
         where a.del_flag = '0' and a.order_status = '001'
-        and b.del_flag = '0'
-        and c.del_flag = '0'
-        and d.del_flag = '0'
-        and e.del_flag = '0'
         and a.service_type not in ('004','005','006')
-        and f.dict_type='district'
         <if test="p.serviceType != null  and p.serviceType != ''">
             and a.service_type = #{p.serviceType}
         </if>
@@ -238,17 +229,12 @@
         select count(DISTINCT o.id) as value,
             o.pipe_type as name
         from g_order o
-                left join g_house a on o.house_id = a.id
-                left join g_unit b on a.unit_id = b.id
-                left join g_building c on b.building_id = c.id
-                left join g_area d on c.area_id = d.id
-        where
-        a.del_flag = '0'
-        and o.service_type = '002'
-          and b.del_flag = '0'
-          and c.del_flag = '0'
-          and d.del_flag = '0'
-          and o.del_flag = '0'
+                left join g_house a on o.house_id = a.id and a.del_flag = '0'
+                left join g_unit b on a.unit_id = b.id and b.del_flag = '0'
+                left join g_building c on b.building_id = c.id and c.del_flag = '0'
+                left join g_area d on c.area_id = d.id and d.del_flag = '0'
+        where o.service_type = '002'
+        and o.del_flag = '0'
         <if test="id != null  and id != ''">
             and d.id = #{id}
         </if>
@@ -258,16 +244,12 @@
         select count(DISTINCT o.id) as value,
             o.pipe_length as name
         from g_order o
-                left join g_house a on o.house_id = a.id
-                left join g_unit b on a.unit_id = b.id
-                left join g_building c on b.building_id = c.id
-                left join g_area d on c.area_id = d.id
+                left join g_house a on o.house_id = a.id and a.del_flag = '0'
+                left join g_unit b on a.unit_id = b.id  and b.del_flag = '0'
+                left join g_building c on b.building_id = c.id  and c.del_flag = '0'
+                left join g_area d on c.area_id = d.id  and d.del_flag = '0'
         where
-        a.del_flag = '0'
-        and o.service_type = '002'
-          and b.del_flag = '0'
-          and c.del_flag = '0'
-          and d.del_flag = '0'
+        o.service_type = '002'
           and o.del_flag = '0'
         <if test="id != null  and id != ''">
             and d.id = #{id}
@@ -278,16 +260,11 @@
         select count(DISTINCT o.id) as value,
         o.valve_type as name
         from g_order o
-        left join g_house a on o.house_id = a.id
-        left join g_unit b on a.unit_id = b.id
-        left join g_building c on b.building_id = c.id
-        left join g_area d on c.area_id = d.id
-        where
-        a.del_flag = '0'
-        and o.service_type = '002'
-        and b.del_flag = '0'
-        and c.del_flag = '0'
-        and d.del_flag = '0'
+        left join g_house a on o.house_id = a.id and a.del_flag = '0'
+        left join g_unit b on a.unit_id = b.id and b.del_flag = '0'
+        left join g_building c on b.building_id = c.id and c.del_flag = '0'
+        left join g_area d on c.area_id = d.id and d.del_flag = '0'
+        where o.service_type = '002'
         and o.del_flag = '0'
         <if test="id != null  and id != ''">
             and d.id = #{id}