AdaKing88
2023-08-21 23258c585a626b15d770459870a8b24763cf540c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.tairui.app.cim.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tairui.app.cim.dao.model.AlarmPoint;
import com.tairui.app.cim.dao.model.Elevation;
import com.vividsolutions.jts.geom.Point;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
 
import java.util.List;
 
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yw
 * @since 2022-05-21
 */
@Mapper
@Repository
public interface ElevationMapper extends BaseMapper<Elevation> {
 
        /**
         * 包含面
         * select * from (select gid,geom,coor_z,cen_x,cen_y,name from elevation_correction where floor_num='Floor5')
         * as xx where ST_Within(st_geomfromtext('Point(124.041948 41.840189)',4326),xx.geom)
         *
         * @param x
         * @param y
         * @param floor
         * @return
         */
       @Select("select gid,to_char(coor_z,'999.999') as high ,name from elevation_correction " +
                "where floor_num='${floor_num}' and  ST_Within(st_geomfromtext('Point(${x} ${y})',4326),geom) ")
        public List<Elevation> queryFloor(@Param("x") double x, @Param("y") double y,  @Param("floor_num") String floor_num);
 
 
        /**
         * 查询最近的面
         * select * from (select gid,geom,coor_z,cen_x,cen_y,name from elevation_correction
         * where floor_num='Floor3') as xx order by (st_geomfromtext('Point(124.04 41.840)',4326)<->xx.geom) asc limit 1
         *
         * @param x
         * @param y
         * @param floor
         * @return
         */
 
        @Select("select gid,to_char(coor_z,'999.999') as high ,ST_X(ST_AsText(ST_PointOnSurface(geom::geometry))) as cen_x," +
                "ST_Y(ST_AsText(ST_PointOnSurface(geom::geometry))) as cen_y,name from elevation_correction " +
                "where floor_num='${floor_num}'  order by (st_geomfromtext('Point(${x} ${y})',4326)<->geom) asc limit 1")
        public List<Elevation> queryMinDistance(@Param("x") double x, @Param("y") double y, @Param("floor_num") String floor_num);
}