在数据库创建函数时报错:you might want to use the less safe log_bin_trust_function_creators variable 需要执行下面的语句: SET GLOBAL log_bin_trust_function_creators = 1; 附:根据当前坐标计算距离排序的函数和sql语句:
BEGIN DECLARE num FLOAT DEFAULT 0;
SET num=2 1000 * 6378.137ASIN(SQRT(POW(SIN(PI()*(lat1-(lat2))/360),2)+ COS(PI()*lat1/180)COS(lat2PI()/180)POW(SIN(PI()(lng1-(lng2))/360),2))); RETURN ROUND(num,0); ENDlat1 DOUBLE,lng1 DOUBLE,lat2 DOUBLE,lng2 DOUBLE
float
<isGreaterThan property="foodStoreInfo.shopLatitude" compareValue="0"> <isGreaterThan property="foodStoreInfo.shopLongitude" compareValue="0"> ORDER by IFNULL(fun_getDistance(#foodStoreInfo.shopLatitude#,#foodStoreInfo.shopLongitude#,ifnull(shop_latitude,0),ifnull(shop_longitude,0)),0) ASC </isGreaterThan> </isGreaterThan>