新增首页接口
This commit is contained in:
56
src/main/resources/mapper/CompanyStoreMapper.xml
Normal file
56
src/main/resources/mapper/CompanyStoreMapper.xml
Normal file
@ -0,0 +1,56 @@
|
||||
<?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.sczx.store.mapper.CompanyStoreMapper">
|
||||
|
||||
<select id="listStoresByBBoxWithDistance" resultType="com.sczx.store.dto.CompanyStoreDTO">
|
||||
SELECT
|
||||
t.id,
|
||||
t.name,
|
||||
t.contact_person,
|
||||
t.phone,
|
||||
t.contact_person2,
|
||||
t.phone2,
|
||||
t.province_id,
|
||||
t.province_name,
|
||||
t.city_id,
|
||||
t.city_name,
|
||||
t.area_id,
|
||||
t.area_name,
|
||||
t.address,
|
||||
t.detailed_address,
|
||||
t.image,
|
||||
t.latitude,
|
||||
t.longitude,
|
||||
(6371 * 1000 * 2 * ATAN2(
|
||||
SQRT(
|
||||
SIN(RADIANS(t.latitude - #{storeDistanceReq.currentLat}) / 2) *
|
||||
SIN(RADIANS(t.latitude - #{storeDistanceReq.currentLat}) / 2) +
|
||||
COS(RADIANS(#{storeDistanceReq.currentLat})) *
|
||||
COS(RADIANS(t.latitude)) *
|
||||
SIN(RADIANS(t.longitude - #{storeDistanceReq.currentLng}) / 2) *
|
||||
SIN(RADIANS(t.longitude - #{storeDistanceReq.currentLng}) / 2)
|
||||
),
|
||||
SQRT(
|
||||
1 - (
|
||||
SIN(RADIANS(t.latitude - #{storeDistanceReq.currentLat}) / 2) *
|
||||
SIN(RADIANS(t.latitude - #{storeDistanceReq.currentLat}) / 2) +
|
||||
COS(RADIANS(#{storeDistanceReq.currentLat})) *
|
||||
COS(RADIANS(t.latitude)) *
|
||||
SIN(RADIANS(t.longitude - #{storeDistanceReq.currentLng}) / 2) *
|
||||
SIN(RADIANS(t.longitude - #{storeDistanceReq.currentLng}) / 2)
|
||||
)
|
||||
)
|
||||
)) AS distance
|
||||
FROM
|
||||
zc_company_store t
|
||||
<where>
|
||||
t.is_del = 0
|
||||
and t.is_show = 1
|
||||
and t.latitude between #{storeDistanceReq.minLat} and #{storeDistanceReq.maxLat}
|
||||
and t.longitude between #{storeDistanceReq.minLng} and #{storeDistanceReq.maxLng}
|
||||
</where>
|
||||
order by distance asc
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user