2020-10-21 19:07:57 +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.cm.plugin.map.dao.IGridDao">
|
|
|
|
|
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<cache/>
|
|
|
|
|
|
2020-10-21 19:07:57 +08:00
|
|
|
|
<resultMap id="gridRelationDTO" type="com.cm.plugin.map.pojo.dto.GridRelationDTO">
|
|
|
|
|
<id column="relation_id" property="relationId"/>
|
|
|
|
|
<result column="grid_id" property="gridId"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="gridDTO" type="com.cm.plugin.map.pojo.dto.GridDTO" extends="gridRelationDTO">
|
|
|
|
|
<id column="grid_id" property="gridId"/>
|
|
|
|
|
<result column="fill_color" property="fillColor"/>
|
|
|
|
|
<result column="grid_name" property="gridName"/>
|
|
|
|
|
<result column="relation_id" property="relationId"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="gridPointDTO" type="com.cm.plugin.map.pojo.dto.GridPointDTO">
|
|
|
|
|
<id column="grid_id" property="gridId"/>
|
|
|
|
|
<result column="lng" property="lng"/>
|
|
|
|
|
<result column="lat" property="lat"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- 保存网格 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<insert id="saveGrid" parameterType="map" flushCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
INSERT INTO map_grid(
|
|
|
|
|
grid_id,
|
|
|
|
|
grid_name,
|
|
|
|
|
fill_color,
|
|
|
|
|
gmt_create,
|
|
|
|
|
creator,
|
|
|
|
|
gmt_modified,
|
|
|
|
|
modifier,
|
|
|
|
|
is_delete
|
|
|
|
|
) VALUES(
|
|
|
|
|
#{gridId},
|
|
|
|
|
#{gridName},
|
|
|
|
|
#{fillColor},
|
|
|
|
|
#{gmtCreate},
|
|
|
|
|
#{creator},
|
|
|
|
|
#{gmtModified},
|
|
|
|
|
#{modifier},
|
|
|
|
|
#{isDelete}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 保存网格关联关系 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<insert id="saveGridRelation" parameterType="map" flushCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
INSERT INTO map_grid_relation(
|
|
|
|
|
grid_id,
|
|
|
|
|
relation_id
|
|
|
|
|
) VALUES(
|
|
|
|
|
#{gridId},
|
|
|
|
|
#{relationId}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 删除网格 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<delete id="deleteGrid" parameterType="map" flushCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
DELETE FROM
|
|
|
|
|
map_grid
|
|
|
|
|
WHERE
|
2020-10-27 23:47:39 +08:00
|
|
|
|
<if test="gridId != null and gridId != ''">
|
|
|
|
|
grid_id = #{gridId}
|
|
|
|
|
</if>
|
2020-10-21 19:07:57 +08:00
|
|
|
|
<if test="gridIds != null and gridIds.size > 0">
|
|
|
|
|
grid_id IN
|
|
|
|
|
<foreach collection="gridIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{gridIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<!-- 删除网格点 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<delete id="deleteGridPoint" parameterType="map" flushCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
DELETE FROM
|
|
|
|
|
map_grid_point
|
|
|
|
|
WHERE
|
2020-10-27 23:47:39 +08:00
|
|
|
|
<if test="gridId != null and gridId != ''">
|
|
|
|
|
grid_id = #{gridId}
|
|
|
|
|
</if>
|
2020-10-21 19:07:57 +08:00
|
|
|
|
<if test="gridIds != null and gridIds.size > 0">
|
|
|
|
|
grid_id IN
|
|
|
|
|
<foreach collection="gridIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{gridIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<!-- 删除网格关联关系 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<delete id="deleteGridRelation" parameterType="map" flushCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
DELETE FROM
|
|
|
|
|
map_grid_relation
|
2021-05-22 09:19:30 +08:00
|
|
|
|
<where>
|
2020-10-27 23:47:39 +08:00
|
|
|
|
<if test="gridId != null and gridId != ''">
|
|
|
|
|
grid_id = #{gridId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="gridIds != null and gridIds.size > 0">
|
2021-05-22 09:19:30 +08:00
|
|
|
|
AND
|
2020-10-27 23:47:39 +08:00
|
|
|
|
grid_id IN
|
|
|
|
|
<foreach collection="gridIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{gridIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2020-10-21 19:07:57 +08:00
|
|
|
|
<if test="relationId != null and relationId != ''">
|
2021-05-22 09:19:30 +08:00
|
|
|
|
AND
|
2020-10-21 19:07:57 +08:00
|
|
|
|
relation_id = #{relationId}
|
|
|
|
|
</if>
|
2021-05-22 09:19:30 +08:00
|
|
|
|
</where>
|
2020-10-21 19:07:57 +08:00
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<!-- 保存网格点 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<insert id="saveGridPoint" parameterType="map" flushCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
INSERT INTO map_grid_point(
|
|
|
|
|
grid_id,
|
|
|
|
|
lng,
|
|
|
|
|
lat
|
|
|
|
|
) VALUES(
|
|
|
|
|
#{gridId},
|
|
|
|
|
#{lng},
|
|
|
|
|
#{lat}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 获取关联关系列表 -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<select id="listGridRelation" parameterType="map" resultMap="gridRelationDTO" useCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
SELECT
|
|
|
|
|
relation_id,
|
|
|
|
|
grid_id
|
|
|
|
|
FROM
|
|
|
|
|
map_grid_relation
|
|
|
|
|
WHERE
|
|
|
|
|
1 = 1
|
|
|
|
|
<if test="relationId != null">
|
|
|
|
|
AND
|
|
|
|
|
relation_id = #{relationId}
|
|
|
|
|
</if>
|
2020-10-27 23:47:39 +08:00
|
|
|
|
<if test="relationIds != null and relationIds.size > 0">
|
|
|
|
|
AND
|
|
|
|
|
relation_id IN
|
|
|
|
|
<foreach collection="relationIds" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{relationIds[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2020-10-30 18:06:53 +08:00
|
|
|
|
<if test="gridId != null and gridId != ''">
|
|
|
|
|
AND
|
|
|
|
|
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>
|
2020-10-21 19:07:57 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 获取网格列表(通过关联ID) -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<select id="listGridByRelationId" parameterType="java.lang.String" resultMap="gridDTO" useCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
SELECT
|
|
|
|
|
t1.grid_id,
|
|
|
|
|
t1.fill_color,
|
|
|
|
|
t1.grid_name,
|
|
|
|
|
t2.relation_id
|
|
|
|
|
FROM
|
|
|
|
|
map_grid t1
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
map_grid_relation t2
|
|
|
|
|
ON
|
|
|
|
|
t1.grid_id = t2.grid_id
|
|
|
|
|
WHERE
|
|
|
|
|
t1.is_delete = 0
|
|
|
|
|
AND
|
|
|
|
|
t2.relation_id = #{_parameter}
|
|
|
|
|
</select>
|
|
|
|
|
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<select id="listGridByRelationIds" parameterType="java.util.List" resultMap="gridDTO" useCache="true">
|
2020-10-23 18:05:48 +08:00
|
|
|
|
SELECT
|
|
|
|
|
t1.grid_id,
|
|
|
|
|
t1.fill_color,
|
|
|
|
|
t1.grid_name,
|
|
|
|
|
t2.relation_id
|
|
|
|
|
FROM
|
|
|
|
|
map_grid t1
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
map_grid_relation t2
|
|
|
|
|
ON
|
|
|
|
|
t1.grid_id = t2.grid_id
|
|
|
|
|
WHERE
|
|
|
|
|
t1.is_delete = 0
|
|
|
|
|
AND
|
|
|
|
|
t2.relation_id IN
|
|
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{list[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-05-22 09:19:30 +08:00
|
|
|
|
<select id="listGridGroupByRelationIds" parameterType="java.util.List" resultMap="gridDTO" useCache="true">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.grid_id,
|
|
|
|
|
t1.fill_color,
|
|
|
|
|
t1.grid_name
|
|
|
|
|
FROM
|
|
|
|
|
map_grid t1
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
map_grid_relation t2
|
|
|
|
|
ON
|
|
|
|
|
t1.grid_id = t2.grid_id
|
|
|
|
|
WHERE
|
|
|
|
|
t1.is_delete = 0
|
|
|
|
|
AND
|
|
|
|
|
t2.relation_id IN
|
|
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{list[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
GROUP BY
|
|
|
|
|
t1.grid_id,
|
|
|
|
|
t1.fill_color,
|
|
|
|
|
t1.grid_name
|
|
|
|
|
</select>
|
|
|
|
|
|
2020-10-21 19:07:57 +08:00
|
|
|
|
<!-- 获取网格点列表(通过网格ID) -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<select id="listPointByGridId" parameterType="java.lang.String" resultMap="gridPointDTO" useCache="true">
|
2020-10-21 19:07:57 +08:00
|
|
|
|
SELECT
|
|
|
|
|
grid_id,
|
|
|
|
|
lng,
|
|
|
|
|
lat
|
|
|
|
|
FROM
|
|
|
|
|
map_grid_point
|
|
|
|
|
WHERE
|
|
|
|
|
grid_id = #{_parameter}
|
|
|
|
|
</select>
|
|
|
|
|
|
2020-10-23 18:05:48 +08:00
|
|
|
|
<!-- 获取网格点列表(通过网格ID列表) -->
|
2020-11-04 20:16:45 +08:00
|
|
|
|
<select id="listPointByGridIds" parameterType="java.util.List" resultMap="gridPointDTO" useCache="true">
|
2020-10-23 18:05:48 +08:00
|
|
|
|
SELECT
|
|
|
|
|
grid_id,
|
|
|
|
|
lng,
|
|
|
|
|
lat
|
|
|
|
|
FROM
|
|
|
|
|
map_grid_point
|
|
|
|
|
WHERE
|
|
|
|
|
grid_id IN
|
|
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
|
#{list[${index}]}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
2020-10-21 19:07:57 +08:00
|
|
|
|
</mapper>
|