<?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>
|