2025-01-18 19:05:51 +08:00
|
|
|
<?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.central.order.mapper.TourismMapper">
|
|
|
|
|
|
|
|
|
|
<select id="findList" resultType="com.central.order.model.Tourism">
|
|
|
|
|
select * from tourisms t
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<resultMap id="TourismResultMap" type="com.central.order.model.Tourism">
|
|
|
|
|
</resultMap>
|
|
|
|
|
<select id="getTourismById" resultMap="TourismResultMap">
|
|
|
|
|
SELECT * FROM tourisms WHERE id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertTourism">
|
|
|
|
|
INSERT INTO tourisms (tourism_no, tourism_name, tourism_address,tourism_phone)
|
|
|
|
|
VALUES (#{tourismNo}, #{tourismName}, #{tourismAddress},#{tourismPhone})
|
|
|
|
|
</insert>
|
2025-07-21 10:29:00 +08:00
|
|
|
|
|
|
|
|
<!-- 获取景区设备列表 -->
|
|
|
|
|
<select id="getDevicesByTourismId" resultType="java.util.Map">
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
q.device_sn as deviceSn,
|
|
|
|
|
q.name as qrcodeName,
|
|
|
|
|
q.code_id as qrcodeId,
|
|
|
|
|
q.price as qrcodePrice,
|
|
|
|
|
q.status as qrcodeStatus,
|
|
|
|
|
q.create_time as qrcodeCreateTime,
|
|
|
|
|
t.tourism_name as tourismName,
|
|
|
|
|
t.tourism_address as tourismAddress
|
|
|
|
|
FROM qrcodes q
|
|
|
|
|
LEFT JOIN tourisms t ON q.tourism_id = t.id
|
|
|
|
|
WHERE q.tourism_id = #{tourismId}
|
|
|
|
|
AND q.is_del = 0
|
|
|
|
|
AND t.is_del = 0
|
|
|
|
|
ORDER BY q.create_time DESC
|
|
|
|
|
</select>
|
2025-07-29 12:08:44 +08:00
|
|
|
|
|
|
|
|
<!-- 查询附近景区列表 -->
|
|
|
|
|
<select id="findNearbyTourisms" resultType="com.central.order.model.TourismWithDistance">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT
|
|
|
|
|
*,
|
|
|
|
|
(
|
|
|
|
|
6371 * acos(
|
|
|
|
|
cos(radians(#{latitude})) *
|
|
|
|
|
cos(radians(latitude)) *
|
|
|
|
|
cos(radians(longitude) - radians(#{longitude})) +
|
|
|
|
|
sin(radians(#{latitude})) *
|
|
|
|
|
sin(radians(latitude))
|
|
|
|
|
)
|
|
|
|
|
) AS distance
|
|
|
|
|
FROM tourisms
|
|
|
|
|
WHERE is_del = 0
|
|
|
|
|
AND status = 1
|
|
|
|
|
AND longitude IS NOT NULL
|
|
|
|
|
AND latitude IS NOT NULL
|
|
|
|
|
HAVING distance <= #{radius}
|
|
|
|
|
ORDER BY distance ASC
|
|
|
|
|
]]>
|
|
|
|
|
<if test="limit != null and limit > 0">
|
|
|
|
|
LIMIT #{limit}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 根据经纬度范围查询景区 -->
|
|
|
|
|
<select id="findTourismsByBounds" resultType="com.central.order.model.Tourism">
|
|
|
|
|
SELECT * FROM tourisms
|
|
|
|
|
WHERE is_del = 0
|
|
|
|
|
AND status = 1
|
|
|
|
|
AND longitude BETWEEN #{minLongitude} AND #{maxLongitude}
|
|
|
|
|
AND latitude BETWEEN #{minLatitude} AND #{maxLatitude}
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-01-18 19:05:51 +08:00
|
|
|
</mapper>
|