| | |
| | | WHERE type = 1 AND is_deleted = 0 |
| | | </select> |
| | | |
| | | <!--通过空间分析点位,找到离风险源最近的防控点 风险源找1,1找2,2找3--> |
| | | <select id="spatialAnalysisPoint" resultType="org.springblade.modules.yw.vo.EmergencySpaceVO"> |
| | | SELECT |
| | | *, |
| | | ST_Distance_Sphere ( |
| | | ST_GeomFromText(concat("POINT(",lng," ",lat,")")), |
| | | ST_GeomFromText (concat("POINT(",#{emergencySpace.lng}," ",#{emergencySpace.lat},")")) |
| | | ) AS distance |
| | | FROM |
| | | yw_emergency_space |
| | | where lng is not null |
| | | <if test="emergencySpace.preLevel!=null"> |
| | | and pre_level = #{emergencySpace.preLevel} |
| | | </if> |
| | | <if test="emergencySpace.firmId!=null"> |
| | | and firm_id = #{emergencySpace.firmId} |
| | | </if> |
| | | ORDER BY distance |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <!--查找距离当前点最近的线--> |
| | | <select id="spatialAnalysisPointToLines" resultType="org.springblade.modules.yw.vo.EmergencySpaceVO"> |
| | | SELECT |
| | | 2 as preLevel, |
| | | ST_AsText(geom) as geom, |
| | | ST_Distance(ST_GeomFromText(concat("POINT(",#{emergencySpace.lng}," ",#{emergencySpace.lat},")")), geom) AS distance |
| | | FROM yw_geom_info |
| | | ORDER BY distance ASC |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |