parent
2f36cd7637
commit
5073c129d9
@ -0,0 +1,13 @@
|
|||||||
|
package com.luoo.user.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.luoo.user.dto.store.StoreSearchDto;
|
||||||
|
import com.luoo.user.pojo.Store;
|
||||||
|
import com.luoo.user.vo.store.StoreAppVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface StoreMapper extends BaseMapper<Store> {
|
||||||
|
public List<StoreAppVO> getListForApp(@Param("storeSearchDto") StoreSearchDto storeSearchDto);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
<?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.luoo.user.mapper.StoreMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.luoo.user.vo.store.StoreAppVO">
|
||||||
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="regionId" column="region_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="address" column="address" jdbcType="VARCHAR"/>
|
||||||
|
<result property="lng" column="lng" jdbcType="VARCHAR"/>
|
||||||
|
<result property="lat" column="lat" jdbcType="VARCHAR"/>
|
||||||
|
<result property="contact" column="contact" jdbcType="VARCHAR"/>
|
||||||
|
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||||
|
<result property="tel" column="tel" jdbcType="VARCHAR"/>
|
||||||
|
<result property="openingHours" column="openingHours" jdbcType="VARCHAR"/>
|
||||||
|
<result property="background" column="background" jdbcType="VARCHAR"/>
|
||||||
|
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||||||
|
<result property="contactAvatar" column="contact_avatar" jdbcType="VARCHAR"/>
|
||||||
|
<result property="contactNickName" column="contact_nick_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="distance" column="distance" jdbcType="DOUBLE"/>
|
||||||
|
<result property="visitCount" column="visit_count" jdbcType="INTEGER"/>
|
||||||
|
<result property="introduction" column="introduction" jdbcType="VARCHAR"/>
|
||||||
|
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getListForApp" resultMap="BaseResultMap">
|
||||||
|
SELECT t1.*, t2.avatar contact_avatar, t2.nick_name contact_nick_name,
|
||||||
|
st_distance_sphere(point(lng, lat), point(#{storeSearchDto.lng}, #{storeSearchDto.lat})) as distance
|
||||||
|
FROM tb_store t1
|
||||||
|
left join tb_user_info t2
|
||||||
|
on t1.contact = t2.id
|
||||||
|
WHERE 1=1
|
||||||
|
<if test="storeSearchDto.searchStr != null and storeSearchDto.searchStr != ''">
|
||||||
|
and (t1.name like concat('%',#{storeSearchDto.searchStr},'%')
|
||||||
|
or t1.contact like concat('%',#{storeSearchDto.searchStr},'%')
|
||||||
|
or t1.phone like concat('%',#{storeSearchDto.searchStr},'%'))
|
||||||
|
</if>
|
||||||
|
<if test="storeSearchDto.startTime != null">
|
||||||
|
and t1.create_time >= #{storeSearchDto.startTime}
|
||||||
|
</if>
|
||||||
|
<if test="storeSearchDto.endTime != null">
|
||||||
|
and t1.create_time <![CDATA[ <= ]]> #{storeSearchDto.endTime}
|
||||||
|
</if>
|
||||||
|
<if test="storeSearchDto.status != null">
|
||||||
|
and t1.status = #{storeSearchDto.status}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
ORDER BY distance
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in new issue