新增查询方法
This commit is contained in:
parent
b8700606ae
commit
25185405c3
@ -81,20 +81,38 @@ public interface IGridDao {
|
|||||||
List<GridRelationDTO> listGridRelation(Map<String, Object> params) throws SearchException;
|
List<GridRelationDTO> listGridRelation(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网格列表(通过关联ID)
|
* 获取网格列表
|
||||||
*
|
*
|
||||||
* @param areaId
|
* @param relationId 关联ID
|
||||||
* @return
|
* @return
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<GridDTO> listGridByRelationId(String areaId) throws SearchException;
|
List<GridDTO> listGridByRelationId(String relationId) throws SearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网格点列表(通过网格ID)
|
* 获取网格点列表
|
||||||
*
|
*
|
||||||
* @param gridId
|
* @param gridId 网格ID
|
||||||
* @return
|
* @return
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<GridPointDTO> listPointByGridId(String gridId) throws SearchException;
|
List<GridPointDTO> listPointByGridId(String gridId) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网格点列表
|
||||||
|
*
|
||||||
|
* @param relationIds 关联ID列表
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网格点列表
|
||||||
|
*
|
||||||
|
* @param gridIds 网格ID列表
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<GridPointDTO> listPointByGridIds(List<String> gridIds) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,20 @@ public interface IGridService {
|
|||||||
List<GridRelationDTO> listGridRelationByRelationId(String relationId) throws SearchException;
|
List<GridRelationDTO> listGridRelationByRelationId(String relationId) throws SearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网格列表(通过关联ID)
|
* 获取网格列表
|
||||||
* @param areaId
|
*
|
||||||
|
* @param relationId 关联ID
|
||||||
* @return
|
* @return
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<GridDTO> listGridByRelationId(String areaId) throws SearchException;
|
List<GridDTO> listGridByRelationId(String relationId) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网格列表
|
||||||
|
*
|
||||||
|
* @param relationIds 关联ID列表
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cm.plugin.map.service.impl;
|
package com.cm.plugin.map.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.druid.util.StringUtils;
|
||||||
import com.cm.common.base.AbstractService;
|
import com.cm.common.base.AbstractService;
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.RemoveException;
|
||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
@ -82,8 +83,8 @@ public class GridServiceImpl extends AbstractService implements IGridService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GridDTO> listGridByRelationId(String areaId) throws SearchException {
|
public List<GridDTO> listGridByRelationId(String relationId) throws SearchException {
|
||||||
List<GridDTO> gridDTOs = gridDao.listGridByRelationId(areaId);
|
List<GridDTO> gridDTOs = gridDao.listGridByRelationId(relationId);
|
||||||
if (gridDTOs.isEmpty()) {
|
if (gridDTOs.isEmpty()) {
|
||||||
return gridDTOs;
|
return gridDTOs;
|
||||||
}
|
}
|
||||||
@ -94,6 +95,37 @@ public class GridServiceImpl extends AbstractService implements IGridService {
|
|||||||
return gridDTOs;
|
return gridDTOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException {
|
||||||
|
if (relationIds == null && relationIds.size() == 0) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<GridDTO> gridDTOs = gridDao.listGridByRelationIds(relationIds);
|
||||||
|
if (gridDTOs.isEmpty()) {
|
||||||
|
return gridDTOs;
|
||||||
|
}
|
||||||
|
List<String> gridIds = new ArrayList<>();
|
||||||
|
for (GridDTO gridDTO : gridDTOs) {
|
||||||
|
gridIds.add(gridDTO.getGridId());
|
||||||
|
}
|
||||||
|
// 获取所有点
|
||||||
|
List<GridPointDTO> gridPointDTOs = gridDao.listPointByGridIds(gridIds);
|
||||||
|
if (gridPointDTOs.isEmpty()) {
|
||||||
|
return gridDTOs;
|
||||||
|
}
|
||||||
|
// 构建所有点
|
||||||
|
for (GridDTO gridDTO : gridDTOs) {
|
||||||
|
List<GridPointDTO> pointArray = new ArrayList<>();
|
||||||
|
for (GridPointDTO gridPointDTO : gridPointDTOs) {
|
||||||
|
if (StringUtils.equals(gridDTO.getGridId(), gridPointDTO.getGridId())) {
|
||||||
|
pointArray.add(gridPointDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gridDTO.setPointArray(pointArray);
|
||||||
|
}
|
||||||
|
return gridDTOs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存关联关系
|
* 保存关联关系
|
||||||
*
|
*
|
||||||
|
@ -137,6 +137,27 @@
|
|||||||
t2.relation_id = #{_parameter}
|
t2.relation_id = #{_parameter}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="listGridByRelationIds" parameterType="java.util.List" resultMap="gridDTO">
|
||||||
|
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>
|
||||||
|
|
||||||
<!-- 获取网格点列表(通过网格ID) -->
|
<!-- 获取网格点列表(通过网格ID) -->
|
||||||
<select id="listPointByGridId" parameterType="java.lang.String" resultMap="gridPointDTO">
|
<select id="listPointByGridId" parameterType="java.lang.String" resultMap="gridPointDTO">
|
||||||
SELECT
|
SELECT
|
||||||
@ -149,4 +170,19 @@
|
|||||||
grid_id = #{_parameter}
|
grid_id = #{_parameter}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取网格点列表(通过网格ID列表) -->
|
||||||
|
<select id="listPointByGridIds" parameterType="java.util.List" resultMap="gridPointDTO">
|
||||||
|
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>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user