package com.ruoyi.system.mapper;

import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.InfoAddress;
import com.ruoyi.system.domain.PosStore;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * addressMapper接口
 * 
 * @author ruoyi
 * @date 2023-05-24
 */
public interface InfoAddressMapper  extends BaseMapper<InfoAddress>
{
    //按照距离查询推荐商家
    @Select("SELECT *,(st_distance(point(longitude,latitude),point(#{longitude},#{latitude}))*111195/1000 ) as juli FROM info_address WHERE user_id = #{userId} ORDER BY juli")  //查询语句
    List<InfoAddress> getmyaddress(@Param("longitude") BigDecimal longitude, @Param("latitude")BigDecimal latitude,  @Param("userId")Integer userId);  //反回结果
    /**
     * 查询address
     * 
     * @param id address主键
     * @return address
     */
    public InfoAddress selectInfoAddressById(Long id);

    /**
     * 查询address列表
     * 
     * @param infoAddress address
     * @return address集合
     */
    public List<InfoAddress> selectInfoAddressList(InfoAddress infoAddress);

    /**
     * 新增address
     * 
     * @param infoAddress address
     * @return 结果
     */
    public int insertInfoAddress(InfoAddress infoAddress);

    /**
     * 修改address
     * 
     * @param infoAddress address
     * @return 结果
     */
    public int updateInfoAddress(InfoAddress infoAddress);

    /**
     * 删除address
     * 
     * @param id address主键
     * @return 结果
     */
    public int deleteInfoAddressById(Long id);

    /**
     * 批量删除address
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteInfoAddressByIds(Long[] ids);
}
