<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.biz.mapper.ArStoreMapper">

    <resultMap type="com.ruoyi.biz.domain.ArStore" id="ArStoreResult">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="address" column="address"/>
        <result property="latitude" column="latitude"/>
        <result property="longitude" column="longitude"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>
    <select id="getStoreList" resultType="com.ruoyi.biz.domain.vo.ArStoreVo">
        SELECT
            id, name,address, latitude, longitude,
            ST_DISTANCE(POINT(#{longitude}, #{latitude}),POINT(longitude, latitude)) * 111195 AS distance
        FROM ar_store
        ORDER BY distance
    </select>

</mapper>
