<?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.xzx.gc.user.mapper.UserGatherInfoMapper">
|
<resultMap id="BaseResultMap" type="com.xzx.gc.entity.UserGatherInfo">
|
<!--
|
WARNING - @mbg.generated
|
-->
|
<id column="user_id" jdbcType="VARCHAR" property="userId" />
|
<result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
|
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
|
<result column="login_account" jdbcType="VARCHAR" property="loginAccount" />
|
<result column="password" jdbcType="VARCHAR" property="password" />
|
<result column="salt" jdbcType="VARCHAR" property="salt" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
|
<result column="birthday" jdbcType="VARCHAR" property="birthday" />
|
<result column="sex" jdbcType="VARCHAR" property="sex" />
|
<result column="user_type" jdbcType="VARCHAR" property="userType" />
|
<result column="open_id" jdbcType="VARCHAR" property="openId" />
|
<result column="country" jdbcType="VARCHAR" property="country" />
|
<result column="province" jdbcType="VARCHAR" property="province" />
|
<result column="city" jdbcType="VARCHAR" property="city" />
|
<result column="regist_time" jdbcType="VARCHAR" property="registTime" />
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
<result column="longitude" jdbcType="VARCHAR" property="longitude" />
|
<result column="latitude" jdbcType="VARCHAR" property="latitude" />
|
<result column="regist_type" jdbcType="SMALLINT" property="registType" />
|
<result column="is_prohibit" jdbcType="BIT" property="isProhibit" />
|
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
|
<result column="townshipName" jdbcType="VARCHAR" property="applyInfo.townshipName" />
|
<result column="detail_address" jdbcType="VARCHAR" property="applyInfo.detailAddress" />
|
<result column="address_area" jdbcType="VARCHAR" property="applyInfo.addressArea" />
|
<result column="receive_address" jdbcType="VARCHAR" property="applyInfo.receiveAddress" />
|
<result column="tag_name" jdbcType="VARCHAR" property="applyInfo.tagName" />
|
</resultMap>
|
|
<select id="findNearestByLocation" resultMap="BaseResultMap">
|
select * from xzx_user_gather_info a
|
inner join xzx_user_address_info b on a.user_id=b.user_id
|
where b.del_flag=0 and b.flag='1' and a.del_flag=0 and ROUND(lat_lng_distance(#{lat}, #{lon}, b.latitude, b.longitude), 3)<=0.5
|
order by ROUND(lat_lng_distance(#{lat}, #{lon}, b.latitude, b.longitude), 3) asc limit 1
|
</select>
|
|
<select id="list" resultMap="BaseResultMap">
|
SELECT
|
a.*,
|
c.level_3_name "townshipName",
|
b.detail_address,
|
b.address_area,
|
b.receive_address,
|
b.tag_name
|
FROM
|
xzx_user_gather_info a
|
INNER JOIN (
|
SELECT
|
d.*
|
FROM
|
xzx_user_gather_apply d
|
INNER JOIN ( SELECT id, max( id ) AS id1, receive_address FROM xzx_user_gather_apply GROUP BY relation_id ) e ON d.id = e.id1
|
) b ON a.user_id = b.relation_id
|
LEFT JOIN xzx_sys_address_level_info c ON b.township_id = c.level_3_id
|
WHERE
|
1=1
|
<if test="delFlag != null and delFlag != ''">
|
and a.del_flag=#{delFlag}
|
</if>
|
<if test="townshipId != null and townshipId != ''">
|
and b.township_id=#{townshipId}
|
</if>
|
<if test="tagName != null and tagName != ''">
|
and b.tag_name=#{tagName}
|
</if>
|
order by b.examine_time desc
|
</select>
|
</mapper>
|