<!--传入的参数为 纬度 纬度 经度 --> <select id="getListByDis" resultMap="BaseResultMap"> SELECT*,ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((#{lat} * PI() / 180 - latitude * PI() / 180 ) / 2),2) + COS(40.0497810000 * PI() / 180) * COS(latitude * PI() / 180) * POW( SIN( ( #{long} * PI() / 180 - longitude * PI() / 180 ) / 2),2))) * 1000 ) AS dis FROM sj_shop_info ORDER BY dis DESC </select>
mysql根据经纬度按距离排序
最新推荐文章于 2024-06-18 09:47:41 发布