<?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="cc.mrbird.febs.mall.mapper.MallShopMapper"> 
 | 
  
 | 
    <select id="selectShopListInPage" resultType="cc.mrbird.febs.mall.entity.MallShop"> 
 | 
        select 
 | 
               a.*, 
 | 
               lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) distance 
 | 
        from mall_shop a 
 | 
        <where> 
 | 
            1=1 
 | 
            <if test="record != null"> 
 | 
                <if test="record.shopName != null and record.shopName != ''"> 
 | 
                    and shop_name like concat('%', concat(#{record.shopName}, '%')) 
 | 
                </if> 
 | 
                <if test="record.state != null"> 
 | 
                    and state = #{record.state} 
 | 
                </if> 
 | 
            </if> 
 | 
        </where> 
 | 
    </select> 
 | 
  
 | 
  
 | 
    <select id="selectShopDistanceList" resultType="cc.mrbird.febs.mall.entity.MallShop"> 
 | 
        select 
 | 
        a.*, 
 | 
        lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) distance 
 | 
        from mall_shop a 
 | 
        <where> 
 | 
            1=1 
 | 
            <if test="record != null"> 
 | 
                <if test="record.shopName != null and record.shopName != ''"> 
 | 
                    and shop_name like concat('%', concat(#{record.shopName}, '%')) 
 | 
                </if> 
 | 
                <if test="record.state != null"> 
 | 
                    and state = #{record.state} 
 | 
                </if> 
 | 
            </if> 
 | 
        </where> 
 | 
        <if test="record.longitude != null and record.latitude != null"> 
 | 
            order by lat_lng_distance(#{record.latitude}, #{record.longitude}, a.latitude, a.longitude) desc 
 | 
        </if> 
 | 
        limit #{page.pageNum},#{page.pageSize} 
 | 
    </select> 
 | 
</mapper> 
 |