package com.doumee.dao.business; 
 | 
  
 | 
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 
 | 
import com.doumee.dao.business.model.Member; 
 | 
import com.github.yulichang.base.MPJBaseMapper; 
 | 
import org.apache.ibatis.annotations.Param; 
 | 
import org.apache.ibatis.annotations.Select; 
 | 
  
 | 
import java.math.BigDecimal; 
 | 
import java.util.List; 
 | 
  
 | 
/** 
 | 
 * @author 江蹄蹄 
 | 
 * @date 2025/07/09 12:00 
 | 
 */ 
 | 
public interface MemberMapper extends MPJBaseMapper<Member> { 
 | 
  
 | 
    @Select(" select * , " + 
 | 
            " ifnull((select r.level from receive_weight r where r.RECEIVE_MAX > RECEIVE_NUM and RECEIVE_NUM > r.RECEIVE_MIN limit 1  ),0) as level ," + 
 | 
            "  ifnull( (select CONVERT( ST_Distance_Sphere ( POINT ( ii.lgt, ii.lat ), POINT ( #{lgt}, #{lat}  )) /1000,DECIMAL(15,2)) from identity_info ii where ii.AUDIT_STATUS = 2 and type = 0 and ii.member_id = ID limit  1 ),0) as distance " + 
 | 
            " from member  " + 
 | 
            " where  id in (   " + 
 | 
            "  select ii.member_id from identity_info ii where ii.AUDIT_STATUS = 2 and type = #{orderType}  " + 
 | 
            "  and ( CONVERT( ST_Distance_Sphere ( POINT ( ii.lgt, ii.lat ), POINT ( #{lgt}, #{lat} )) /1000,DECIMAL(15,2))) < 100 " + 
 | 
            "  )" + 
 | 
            " order by level , score desc , distance asc  ") 
 | 
    List<Member> getList(@Param("lgt") BigDecimal lgt, @Param("lat") BigDecimal lat, @Param("orderType") Integer orderType); 
 | 
  
 | 
} 
 |