var req = new { //经度 Longitude = 1, //纬度 Latitude = 1, //跳过条数 offset = 1, //显示条数 limit = 1, //条件范围 每增加1搜索范围差不多增加110km scope = 10, }; string sql = $@"select * from store where 1=1 "; sql = sql + $@"and longitude > ({req.Longitude}-{ req.scope}) and longitude < ({req.Longitude}+{ req.scope}) and latitude > ({req.Latitude}-{ req.scope}) and latitude< ({req.Latitude}+{ req.scope}) order by ACOS(SIN(({req.Latitude} * 3.1415) / 180 ) *SIN((latitude * 3.1415) / 180 ) +COS(({req.Latitude} * 3.1415) / 180 ) * COS((latitude * 3.1415) / 180 ) *COS(({req.Longitude}* 3.1415) / 180 - (longitude * 3.1415) / 180 ) ) * 6380 "; sql = sql + ($@" limit { req.offset},{ req.limit}");