charging_pile/common/target/classes/mapper/ServiceAreaMapper.xml

81 lines
2.5 KiB
XML
Raw Normal View History

<?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.hcy.common.mapper.serviceArea.ServiceAreaMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hcy.common.entity.serviceArea.ServiceArea">
<!-- <id column="id" property="id"/>
<result column="name" property="name"/>
<result column="region_id" property="regionId"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="polygongeo" property="polygongeo"/>
<result column="is_delete" property="isDelete"/>-->
</resultMap>
<select id="selectById" resultType="com.hcy.common.dto.result.ServiceAreaResultDto">
select id,
name,
region_id as regionId,
longitude,
latitude,
ST_AsText(polygongeo) as polygongeo
from la_service_area
<where>
id = #{id}
</where>
</select>
<select id="pageByRegionId" resultType="com.hcy.common.dto.result.ServiceAreaResultDto">
select id,
name,
region_id as regionId,
longitude,
latitude,
ST_AsText(polygongeo) as polygongeo
from la_service_area
<where>
is_delete = 0
<if test="form.regionId != null">
and region_id = #{form.regionId}
</if>
</where>
</select>
<insert id="insertArea" useGeneratedKeys="true" keyProperty="id">
insert into la_service_area
(name,
region_id,
longitude,
latitude,
create_time,
update_time,
polygongeo)
values
(#{name},
#{regionId},
#{longitude},
#{latitude},
#{createTime},
#{updateTime},
PolygonFromText(#{polygongeo}))
</insert>
<select id="selectByPoint" resultType="com.hcy.common.dto.result.ServiceAreaResultDto">
select id,
name,
region_id as regionId,
longitude,
latitude,
ST_AsText(polygongeo) as polygongeo
from la_service_area
<where>
is_delete = 0
and region_id = #{regionId}
and st_intersects(ST_GeomFromText(#{point}), polygongeo);
</where>
</select>
</mapper>