“mitao”
2026-03-06 ddcce4e9bc4f1a71284008135f0065349c3b960a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?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.xiaopeng.map.mapper.XpPointMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.xiaopeng.api.model.operation.XpPoint">
        <id column="id" property="id" />
        <result column="point_name" property="pointName" />
        <result column="point_poi" property="pointPoi" />
        <result column="point_number" property="pointNumber" />
        <result column="operation_status" property="operationStatus" />
        <result column="point_type" property="pointType" />
        <result column="verification_status" property="verificationStatus" />
        <result column="parking_time_limit" property="parkingTimeLimit" />
        <result column="operation_type" property="operationType" />
        <result column="effective_period" property="effectivePeriod" />
        <result column="effective_time_period" property="effectiveTimePeriod" />
        <result column="remarks" property="remarks" />
        <result column="point_pictures" property="pointPictures" />
        <result column="point_lon" property="pointLon" />
        <result column="point_lat" property="pointLat" />
        <result column="is_deleted" property="deleted" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="create_by" property="createBy" />
        <result column="update_by" property="updateBy" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,electronic_area_id, point_name, point_poi, point_number, operation_status, point_type, verification_status, parking_time_limit, operation_type, effective_period, effective_time_period, remarks, point_pictures, point_lon, point_lat, is_deleted, create_time, update_time, create_by, update_by
    </sql>
    <select id="pointMap" resultType="com.xiaopeng.api.model.operation.XpPoint">
        select t1.*,
        ROUND(
        6378.138 * 2 * ASIN(
        SQRT(
        POW(
        SIN(
        (
        #{query.lat} * PI() / 180 - t1.point_lat * PI() / 180
        ) / 2
        ),
        2
        ) + COS(#{query.lat} * PI() / 180) * COS(t1.point_lat * PI() / 180) * POW(
        SIN(
        (
        #{query.lon} * PI() / 180 - t1.point_lon * PI() / 180
        ) / 2
        ),
        2
        )
        )
        ) * 1000
        ) AS distance
               from xp_point t1
        where t1.is_deleted = 0
        <if test="query.pointName != null and query.pointName != ''">
            and t1.point_name like concat('%',#{query.pointName},'%')
        </if>
        <if test="query.pointType != null">
            and t1.point_type = #{query.pointType}
        </if>
        <if test="query.operationStatus != null">
            and t1.operation_status = #{query.operationStatus}
        </if>
        order by distance  asc
    </select>
    <select id="listAll" resultType="com.xiaopeng.api.model.operation.XpPoint">
        select t1.*
        from xp_point t1
        where t1.is_deleted = 0
        <if test="query.queryParams != null and query.queryParams != ''">
            and (
            t1.point_name like concat('%',#{query.queryParams},'%')
            or t1.point_poi like concat('%',#{query.queryParams},'%')
            or t1.point_number like concat('%',#{query.queryParams},'%')
            )
        </if>
        <if test="query.pointType != null">
            and t1.point_type = #{query.pointType}
        </if>
        <if test="query.operationStatusList != null and query.operationStatusList.size() > 0">
            <trim prefix="and (" suffix=")" prefixOverrides="OR">
                <foreach collection="query.operationStatusList" item="st">
                    <choose>
                        <when test="st == 1">OR t1.verification_status = 1</when>
                        <when test="st == 2">OR t1.verification_status = 2</when>
                        <when test="st == 3">OR t1.verification_status = 4</when>
                        <when test="st == 4">OR (t1.verification_status = 3 and t1.operation_status = 1)</when>
                        <when test="st == 5">OR (t1.verification_status = 5 and t1.operation_status = 1)</when>
                        <when test="st == 6">OR t1.operation_status = 2</when>
                        <when test="st == 7">OR t1.operation_status = 3</when>
                        <when test="st == 8">OR t1.operation_status = 4</when>
                        <otherwise>OR 1 = 0</otherwise>
                    </choose>
                </foreach>
            </trim>
        </if>
        order by t1.create_time desc
    </select>
 
 
    <select id="queryPointByName" resultType="com.xiaopeng.api.vo.order.XpPointsListVo">
        select p.id,p.electronic_area_id as electronicAreaId,p.point_name as name,p.point_address as address,p.point_lon as longitude,p.point_lat as latitude,p.effective_period,p.effective_time_period
        from xp_electronic_fence_area xefa
        left join xp_point p on p.electronic_area_id = xefa.id
        where p.is_deleted = 0 and p.operation_status =2 and xefa.is_deleted = 0
        and xefa.area_status = 1 and p.electronic_area_id is not null
        and xefa.city_code = #{query.cityCode}
        <if test="query.pointPoi != null and query.pointPoi != ''">
            and p.point_poi like concat('%',#{query.pointPoi},'%')
        </if>
        <if test="query.electronicAreaId != null">
            and p.electronic_area_id = #{query.electronicAreaId}
        </if>
 
    </select>
    <select id="pageList" resultType="com.xiaopeng.api.model.operation.XpPoint">
        select xp.id,xp.point_number as pointNumber,xp.point_name as pointName,xp.point_poi as pointPoi,
               xp.point_address as pointAddress,
               xp.point_lon as pointLon,xp.point_lat as pointLat,xp.create_time as createTime,xp.create_by as createBy
        ,xp.parking_time_limit as parkingTimeLimit,xp.verification_status as verificationStatus,xp.operation_status as operationStatus
        from xp_point xp
        where xp.is_deleted = 0
        <if test="query.pointName != null and query.pointName != ''">
            and xp.point_name like concat('%',#{query.pointName},'%')
        </if>
        <if test="query.pointNumber != null and query.pointNumber != ''">
            and xp.point_number like concat('%',#{query.pointNumber},'%')
        </if>
        <if test="query.createBy != null and query.createBy != ''">
            and xp.create_by like concat('%',#{query.createBy},'%')
        </if>
        <if test="query.parkingTimeLimit != null">
            and xp.parking_time_limit = #{query.parkingTimeLimit}
        </if>
        <if test="query.pointLonAndLat != null and query.pointLonAndLat != ''">
            and #{query.pointLonAndLat}  like concat('%',xp.point_lon,'%')
        and #{query.pointLonAndLat}  like concat('%',xp.point_lat,'%')
        </if>
 
        <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
            and xp.create_time between #{query.startTime} and #{query.endTime}
        </if>
        <if test="query.operationStatusList != null and query.operationStatusList.size() > 0">
            <trim prefix="and (" suffix=")" prefixOverrides="OR">
                <foreach collection="query.operationStatusList" item="st">
                    <choose>
                        <when test="st == 1">OR xp.verification_status = 1</when>
                        <when test="st == 2">OR xp.verification_status = 2</when>
                        <when test="st == 3">OR xp.verification_status = 4</when>
                        <when test="st == 4">OR (xp.verification_status = 3 and xp.operation_status = 1)</when>
                        <when test="st == 5">OR (xp.verification_status = 5 and xp.operation_status = 1)</when>
                        <when test="st == 6">OR xp.operation_status = 2</when>
                        <when test="st == 7">OR xp.operation_status = 3</when>
                        <when test="st == 8">OR xp.operation_status = 4</when>
                        <otherwise>OR 1 = 0</otherwise>
                    </choose>
                </foreach>
            </trim>
        </if>
        order by xp.create_time desc
    </select>
 
</mapper>