private final int pageSize = 10;
int beginrow = (pageNumber - 1) * pageSize;
SELECT
*
FROM
tb_user
ORDER BY
round( 6367000 * 2 * asin(
sqrt( pow(
sin( ( (latitude * pi()) / 180 - (" + latitude + " * pi()) / 180
) / 2 ), 2 ) + cos( (" + latitude + " * pi()) / 180 ) * cos((latitude * pi()) / 180) * pow( sin( ( (longitude * pi()) / 180 - (" + longitude + " * pi()) / 180 ) / 2 ), 2 ) ) )
) ASC
LIMIT " + beginrow + ",
" + pageSize + "");
网友评论