wang_xy 1 ano atrás
pai
commit
1072f240cf

+ 1 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringCivilServiceImpl.java

@@ -239,7 +239,7 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
         });
         List<ZEngineeringCivilExportVo> zEngineeringCivilExportVoList = baseMapper.getexportList(DateList, format.format(new Date()), bo);
 
-        HashMap<String, List<ZEngineeringCivilExportVo>> hashMap = new HashMap<>();
+        LinkedHashMap<String, List<ZEngineeringCivilExportVo>> hashMap = new LinkedHashMap<>();
 
         for (int i = 0; i < zEngineeringCivilExportVoList.size(); i++) {
             if (hashMap.containsKey(zEngineeringCivilExportVoList.get(i).getId())) {

+ 96 - 89
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringCivilMapper.xml

@@ -318,88 +318,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     </select>
     <select id="getexportList" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilExportVo">
-        SELECT
-        a.id,
-        (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
-        g.`name` AS area_id,
-        h.`name` AS building_id,
-        i.`name` AS unit_id,
-        j.`name` AS house_id,
-        (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS source,
-        k.dict_label AS engin_classification,
-        CASE
-        a.engin_type
-        WHEN 'new_built' THEN
-        '新建' ELSE '旧改'
-        END AS engin_type,
-        a.completion_status,
-        b.type,
-        c.construct_addre,
-        c.construct_according_drawings,
-        c.segmented_compression_qualified,
-        c.backfill_time,
-        c.construct_phone,
-        c.construct_time,
-        c.head_name,
-        c.head_phone,
-        d.visit_type,
-        d.corrosion_level AS corrosion_level,
-        n.name as self_closing_valve_type,
-        m.name as brand,
-        e.`name` AS material_quality,
-        f.`name` AS specifications,
-        d.number,
-        c.update_info_time as updateInfoTime,
-        c.create_by as createBy,
-        c.remark,
-        d.remark as remarkd
-        FROM
-            z_engineering_civil a
-        LEFT JOIN z_engineering_node b ON a.id = b.civli_id
-        LEFT JOIN z_engineering_info c ON b.id = c.eng_info_id
-        LEFT JOIN z_engineering_material d ON c.id = d.details_id
-        LEFT JOIN z_engin_material_quality e ON e.id = d.material_quality
-        LEFT JOIN z_engin_specifications f ON f.id = d.specifications
-        LEFT JOIN z_area g ON g.id = a.area_id
-        LEFT JOIN z_building h ON h.id = a.building_id
-        LEFT JOIN z_unit i ON i.id = a.unit_id
-        LEFT JOIN z_house j ON j.id = a.house_id
-        LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
-        AND k.dict_value = a.engin_classification
-        LEFT JOIN z_engin_material_quality l ON l.id = d.corrosion_level
-        LEFT JOIN z_engin_material_quality m ON m.id = d.brand
-        LEFT JOIN z_engin_material_quality n ON n.id = d.self_closing_valve_type
-        WHERE
-         a.create_time LIKE CONCAT(REPLACE(#{createTime}, '_', '-'),'%')
-        <if test="p.district != null and p.district != ''">
-            and a.district = #{p.district}
-        </if>
-        <if test="p.areaId != null and p.areaId != ''">
-            and a.area_id = #{p.areaId}
-        </if>
-        <if test="p.buildingId != null and p.buildingId != ''">
-            and a.building_id = #{p.buildingId}
-        </if>
-        <if test="p.unitId != null and p.unitId != ''">
-            and a.unit_id = #{p.unitId}
-        </if>
-        <if test="p.enginType != null and p.enginType != ''">
-            and a.engin_type = #{p.enginType}
-        </if>
-        <if test="p.enginClassification != null and p.enginClassification != ''">
-            and a.engin_classification = #{p.enginClassification}
-        </if>
-        <if test="p.enginCycle != null and p.enginCycle != ''">
-            and a.engin_cycle = 0
-        </if>
-        <if test="p.beginTime != null and p.beginTime != ''">
-            and  c.update_info_time between #{beginTime[0]} and #{beginTime[1]}
-        </if>
-        <if test="p.createBy != null and p.createBy != ''">
-            and c.create_by like CONCAT(#{p.createBy},'%')
-        </if>
-        <foreach collection="tableNames" item="name">
-            union
+        select * from (
             SELECT
             a.id,
             (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
@@ -436,10 +355,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             c.remark,
             d.remark as remarkd
             FROM
-            z_engineering_civil a
-            LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
-            LEFT JOIN z_engineering_info_${name} c ON b.id = c.eng_info_id
-            LEFT JOIN z_engineering_material_${name} d ON c.id = d.details_id
+                z_engineering_civil a
+            LEFT JOIN z_engineering_node b ON a.id = b.civli_id
+            LEFT JOIN z_engineering_info c ON b.id = c.eng_info_id
+            LEFT JOIN z_engineering_material d ON c.id = d.details_id
             LEFT JOIN z_engin_material_quality e ON e.id = d.material_quality
             LEFT JOIN z_engin_specifications f ON f.id = d.specifications
             LEFT JOIN z_area g ON g.id = a.area_id
@@ -448,11 +367,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN z_house j ON j.id = a.house_id
             LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
             AND k.dict_value = a.engin_classification
-            LEFT JOIN z_engin_specifications l ON l.id = d.corrosion_level
+            LEFT JOIN z_engin_material_quality l ON l.id = d.corrosion_level
             LEFT JOIN z_engin_material_quality m ON m.id = d.brand
             LEFT JOIN z_engin_material_quality n ON n.id = d.self_closing_valve_type
             WHERE
-             a.create_time LIKE CONCAT(REPLACE(#{name}, '_', '-'),'%')
+             a.create_time LIKE CONCAT(REPLACE(#{createTime}, '_', '-'),'%')
             <if test="p.district != null and p.district != ''">
                 and a.district = #{p.district}
             </if>
@@ -480,7 +399,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="p.createBy != null and p.createBy != ''">
                 and c.create_by like CONCAT(#{p.createBy},'%')
             </if>
-        </foreach>
+            <foreach collection="tableNames" item="name">
+                union
+                SELECT
+                a.id,
+                (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
+                g.`name` AS area_id,
+                h.`name` AS building_id,
+                i.`name` AS unit_id,
+                j.`name` AS house_id,
+                (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS source,
+                k.dict_label AS engin_classification,
+                CASE
+                a.engin_type
+                WHEN 'new_built' THEN
+                '新建' ELSE '旧改'
+                END AS engin_type,
+                a.completion_status,
+                b.type,
+                c.construct_addre,
+                c.construct_according_drawings,
+                c.segmented_compression_qualified,
+                c.backfill_time,
+                c.construct_phone,
+                c.construct_time,
+                c.head_name,
+                c.head_phone,
+                d.visit_type,
+                d.corrosion_level AS corrosion_level,
+                n.name as self_closing_valve_type,
+                m.name as brand,
+                e.`name` AS material_quality,
+                f.`name` AS specifications,
+                d.number,
+                c.update_info_time as updateInfoTime,
+                c.create_by as createBy,
+                c.remark,
+                d.remark as remarkd
+                FROM
+                z_engineering_civil a
+                LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
+                LEFT JOIN z_engineering_info_${name} c ON b.id = c.eng_info_id
+                LEFT JOIN z_engineering_material_${name} d ON c.id = d.details_id
+                LEFT JOIN z_engin_material_quality e ON e.id = d.material_quality
+                LEFT JOIN z_engin_specifications f ON f.id = d.specifications
+                LEFT JOIN z_area g ON g.id = a.area_id
+                LEFT JOIN z_building h ON h.id = a.building_id
+                LEFT JOIN z_unit i ON i.id = a.unit_id
+                LEFT JOIN z_house j ON j.id = a.house_id
+                LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
+                AND k.dict_value = a.engin_classification
+                LEFT JOIN z_engin_specifications l ON l.id = d.corrosion_level
+                LEFT JOIN z_engin_material_quality m ON m.id = d.brand
+                LEFT JOIN z_engin_material_quality n ON n.id = d.self_closing_valve_type
+                WHERE
+                 a.create_time LIKE CONCAT(REPLACE(#{name}, '_', '-'),'%')
+                <if test="p.district != null and p.district != ''">
+                    and a.district = #{p.district}
+                </if>
+                <if test="p.areaId != null and p.areaId != ''">
+                    and a.area_id = #{p.areaId}
+                </if>
+                <if test="p.buildingId != null and p.buildingId != ''">
+                    and a.building_id = #{p.buildingId}
+                </if>
+                <if test="p.unitId != null and p.unitId != ''">
+                    and a.unit_id = #{p.unitId}
+                </if>
+                <if test="p.enginType != null and p.enginType != ''">
+                    and a.engin_type = #{p.enginType}
+                </if>
+                <if test="p.enginClassification != null and p.enginClassification != ''">
+                    and a.engin_classification = #{p.enginClassification}
+                </if>
+                <if test="p.enginCycle != null and p.enginCycle != ''">
+                    and a.engin_cycle = 0
+                </if>
+                <if test="p.beginTime != null and p.beginTime != ''">
+                    and  c.update_info_time between #{beginTime[0]} and #{beginTime[1]}
+                </if>
+                <if test="p.createBy != null and p.createBy != ''">
+                    and c.create_by like CONCAT(#{p.createBy},'%')
+                </if>
+            </foreach>
+        ) z
+        ORDER BY
+        z.area_id,
+        CONVERT ( REPLACE ( z.building_id, '栋', '' ), UNSIGNED ),
+        CONVERT ( REPLACE ( z.unit_id, '单元', '' ), UNSIGNED ),
+        CONVERT ( REPLACE ( z.house_id, '号', '' ), UNSIGNED ) ASC
     </select>
     <select id="getTypeNumber" resultType="Long">
         SELECT