管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-06 f52d5579915db640078c0ff2cc0cac1beef05bc5
src/main/java/com/lf/server/mapper/all/GeomBaseMapper.java
@@ -4,6 +4,8 @@
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
 * 空间基础Mapper
 * @author WWW
@@ -17,7 +19,7 @@
     * @param gid GID
     * @return WKT
     */
    @Select("select ST_AsText(geom) geom from ${tab} where gid = #{gid}")
    @Select("select ST_AsText(geom) geom from ${tab} where gid = #{gid} limit 1")
    public String selectWktById(@Param("tab") String tab, @Param("gid") Integer gid);
    /**
@@ -26,17 +28,43 @@
     * @param tab 表名
     * @return SRID
     */
    @Select("select ST_SRID(geom) from ${tab} limit 1")
    @Select("select ST_SRID(geom) from ${tab} where geom is not null limit 1")
    public Integer selectSrid(@Param("tab") String tab);
    /**
     * 根据表名查询空间类型
     *
     * @param tab 表名
     * @return SRID
     */
    @Select("select ST_GeometryType(geom) from ${tab} where geom is not null limit 1")
    public String selectGeometryType(@Param("tab") String tab);
    /**
     * 查询DB中溢出的单位ID
     *
     * @param tab       表名
     * @param depid     单位ID
     * @param geoFilter 空间过滤条件
     * @return 溢出的单位ID
     */
    @Select("<script>" +
            " select depid from ${tab} where depid is not null and depid not like '${depid}%'" +
            " <if test='geoFilter != null'>" +
            "  and ${geoFilter}" +
            " </if>" +
            " group by depid" +
            "</script>")
    public List<Integer> selectDbOverflowDep(@Param("tab") String tab, @Param("depid") String depid, @Param("geoFilter") String geoFilter);
    /**
     * 更新空间位置
     *
     * @param tab  表名
     * @param gid  GID
     * @param geom 空间位置
     * @param tab 表名
     * @param gid GID
     * @param wkt WKT
     * @return 影响行数
     */
    @Update("update ${tab} set geom = ST_GeomFromText('${geom}') where gid = #{gid}")
    public Integer updateGeom(@Param("tab") String tab, @Param("gid") Integer gid, @Param("geom") String geom);
    @Update("update ${tab} set geom = ST_GeomFromText('${wkt}') where gid = #{gid} limit 1")
    public Integer updateGeom(@Param("tab") String tab, @Param("gid") Integer gid, @Param("wkt") String wkt);
}