76 lines
2.4 KiB
XML
76 lines
2.4 KiB
XML
<?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="ink.wgink.module.map.dao.grid.IGridPointDao">
|
||
|
||
<cache/>
|
||
|
||
<resultMap id="gridPointDTO" type="ink.wgink.module.map.pojo.dto.grid.GridPointDTO">
|
||
<id column="grid_id" property="gridId"/>
|
||
<result column="lng" property="lng"/>
|
||
<result column="lat" property="lat"/>
|
||
</resultMap>
|
||
|
||
<!-- 建表 -->
|
||
<update id="createTable">
|
||
CREATE TABLE `map_grid_point` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||
`grid_id` char(36) NOT NULL,
|
||
`lng` varchar(255) DEFAULT NULL COMMENT '点经度',
|
||
`lat` varchar(255) DEFAULT NULL COMMENT '点纬度',
|
||
PRIMARY KEY (`id`),
|
||
KEY `grid_id` (`grid_id`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='网格点';
|
||
</update>
|
||
|
||
<!-- 保存网格点 -->
|
||
<insert id="save" parameterType="map" flushCache="true">
|
||
INSERT INTO map_grid_point(
|
||
grid_id,
|
||
lng,
|
||
lat
|
||
) VALUES(
|
||
#{gridId},
|
||
#{lng},
|
||
#{lat}
|
||
)
|
||
</insert>
|
||
|
||
<!-- 删除网格点 -->
|
||
<delete id="delete" parameterType="map" flushCache="true">
|
||
DELETE FROM
|
||
map_grid_point
|
||
WHERE
|
||
<if test="gridId != null and gridId != ''">
|
||
grid_id = #{gridId}
|
||
</if>
|
||
<if test="gridIds != null and gridIds.size > 0">
|
||
grid_id IN
|
||
<foreach collection="gridIds" index="index" open="(" separator="," close=")">
|
||
#{gridIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
</delete>
|
||
|
||
<!-- 获取网格点列表(通过网格ID) -->
|
||
<select id="list" parameterType="map" resultMap="gridPointDTO" useCache="true">
|
||
SELECT
|
||
grid_id,
|
||
lng,
|
||
lat
|
||
FROM
|
||
map_grid_point
|
||
<where>
|
||
<if test="gridId != null and gridId != ''">
|
||
grid_id = #{gridId}
|
||
</if>
|
||
<if test="gridIds != null and gridIds.size > 0">
|
||
AND
|
||
grid_id IN
|
||
<foreach collection="gridIds" index="index" open="(" separator="," close=")">
|
||
#{gridIds[${index}]}
|
||
</foreach>
|
||
</if>
|
||
</where>
|
||
</select>
|
||
|
||
</mapper> |