吉安感知网项目-后端
linwei
5 days ago 51a551a7f8eae7654f973d45cd2fa2952774673d
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideExtMapper.xml
@@ -8,30 +8,13 @@
        <result column="area_divide_id" property="areaDivideId"/>
        <result column="area_type_key" property="areaTypeKey"/>
        <result column="area_type_value" property="areaTypeValue"/>
        <result column="geom" property="geom"/>
        <result column="geom_json" property="geomJson"/>
        <result column="area_code" property="areaCode"/>
    </resultMap>
    <select id="getByAreaDivideId" resultMap="fwAreaDivideExtResultMap">
        select
            id,
            area_divide_id,
            area_type_key,
            area_type_value,
            case
                when geom is null then null
                when ST_SRID(geom) is null
                    or ST_SRID(geom) = 0 then ST_AsText(geom)
                else concat(ST_AsText(ST_SwapXY(geom)), ' | ', ST_SRID(geom))
                end as geom,
            area_code,
            create_user,
            create_dept,
            create_time,
            update_user,
            update_time,
            status,
            is_deleted
            *
        from ja_fw_area_divide_ext where is_deleted = 0 and area_divide_id = #{areaDivideId}
    </select>
@@ -49,7 +32,7 @@
            area_divide_id,
            area_type_key,
            area_type_value,
            geom,
            geom_json,
            area_code,
            create_user,
            create_dept,
@@ -64,26 +47,15 @@
                #{item.areaDivideId},
                #{item.areaTypeKey},
                #{item.areaTypeValue},
                <choose>
                    <when test="item.geom != null and item.geom != ''">
                        case
                            when instr(#{item.geom}, '|') &gt; 0 then ST_SRID(
                                ST_GeomFromText(trim(substring_index(#{item.geom}, '|', 1))),
                                cast(trim(substring_index(#{item.geom}, '|', -1)) as unsigned)
                            )
                            else ST_GeomFromText(trim(#{item.geom}))
                        end
                    </when>
                    <otherwise>null</otherwise>
                </choose>,
                #{item.geomJson},
                #{item.areaCode},
                #{item.createUser},
                #{item.createDept},
                #{item.createTime},
                #{item.updateUser},
                #{item.updateTime},
                IFNULL(#{item.status}, '0'),
                IFNULL(#{item.isDeleted}, 0)
            COALESCE(#{item.status}, '0'),
            COALESCE(#{item.isDeleted}, 0)
            )
        </foreach>
    </insert>