新增了网格操作的一些接口
This commit is contained in:
parent
4fcf860189
commit
6fd1ded8ad
@ -19,6 +19,8 @@ import java.util.List;
|
||||
@ApiModel
|
||||
public class GridVO {
|
||||
|
||||
@ApiModelProperty(name = "id", value = "网格ID")
|
||||
private String id;
|
||||
@ApiModelProperty(name = "fillColor", value = "填充颜色")
|
||||
private String fillColor;
|
||||
@ApiModelProperty(name = "gridName", value = "网格名称")
|
||||
@ -28,6 +30,14 @@ public class GridVO {
|
||||
@ApiModelProperty(name = "pointArray", value = "网格点列表")
|
||||
private List<GridPointVO> pointArray;
|
||||
|
||||
public String getId() {
|
||||
return id == null ? "" : id.trim();
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFillColor() {
|
||||
return fillColor == null ? "" : fillColor.trim();
|
||||
}
|
||||
@ -69,10 +79,12 @@ public class GridVO {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"fillColor\":\"")
|
||||
sb.append("\"id\":\"")
|
||||
.append(id).append('\"');
|
||||
sb.append(",\"fillColor\":\"")
|
||||
.append(fillColor).append('\"');
|
||||
sb.append(",\"gridName\":")
|
||||
.append(gridName);
|
||||
sb.append(",\"gridName\":\"")
|
||||
.append(gridName).append('\"');
|
||||
sb.append(",\"relationIdArray\":")
|
||||
.append(relationIdArray);
|
||||
sb.append(",\"pointArray\":")
|
||||
|
@ -4,6 +4,7 @@ import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.plugin.map.pojo.dto.GridDTO;
|
||||
import com.cm.plugin.map.pojo.dto.GridRelationDTO;
|
||||
import com.cm.plugin.map.pojo.vo.GridPointVO;
|
||||
import com.cm.plugin.map.pojo.vo.GridVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -31,22 +32,48 @@ public interface IGridService {
|
||||
void saveGrid(GridVO gridVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 通过关联关系删除网格
|
||||
* 更新网格数组
|
||||
*
|
||||
* @param relationId
|
||||
* @param gridId 网格ID
|
||||
* @param pointArray 点数组
|
||||
* @throws Exception
|
||||
*/
|
||||
void updateGridPointArrayByGridId(String gridId, List<GridPointVO> pointArray) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除网格
|
||||
*
|
||||
* @param relationId 关联关系
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void deleteGridByRelationId(String relationId) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 删除网格
|
||||
*
|
||||
* @param gridIds 网格ID列表
|
||||
* @throws SearchException
|
||||
*/
|
||||
void deleteGridByGridIds(List<String> gridIds) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 获取网格关系列表
|
||||
*
|
||||
* @param relationId
|
||||
* @param relationId 关联ID
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<GridRelationDTO> listGridRelationByRelationId(String relationId) throws SearchException;
|
||||
|
||||
/**
|
||||
* 获取网格关系列表
|
||||
*
|
||||
* @param relationIds 关联ID列表
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<GridRelationDTO> listGridRelationByRelationIds(List<String> relationIds) throws SearchException;
|
||||
|
||||
/**
|
||||
* 获取网格列表
|
||||
*
|
||||
@ -64,4 +91,5 @@ public interface IGridService {
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -53,6 +53,20 @@ public class GridServiceImpl extends AbstractService implements IGridService {
|
||||
savePointArray(gridId, pointArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGridPointArrayByGridId(String gridId, List<GridPointVO> pointArray) throws Exception {
|
||||
// 删除原有网格数组
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("gridId", gridId);
|
||||
gridDao.deleteGridPoint(params);
|
||||
// 新增网格数组
|
||||
for(GridPointVO gridPointVO : pointArray) {
|
||||
params = HashMapUtil.beanToMap(gridPointVO);
|
||||
params.put("gridId", gridId);
|
||||
gridDao.saveGridPoint(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGridByRelationId(String relationId) throws RemoveException {
|
||||
List<GridRelationDTO> gridRelationDTOs = listGridRelationByRelationId(relationId);
|
||||
@ -75,6 +89,21 @@ public class GridServiceImpl extends AbstractService implements IGridService {
|
||||
gridDao.deleteGridRelation(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGridByGridIds(List<String> gridIds) throws RemoveException {
|
||||
if(gridIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 删除网格
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("gridIds", gridIds);
|
||||
gridDao.deleteGrid(params);
|
||||
// 删除点数组
|
||||
gridDao.deleteGridPoint(params);
|
||||
// 删除关联
|
||||
gridDao.deleteGridRelation(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridRelationDTO> listGridRelationByRelationId(String relationId) throws SearchException {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
@ -82,6 +111,13 @@ public class GridServiceImpl extends AbstractService implements IGridService {
|
||||
return gridDao.listGridRelation(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridRelationDTO> listGridRelationByRelationIds(List<String> relationIds) throws SearchException {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("relationIds", relationIds);
|
||||
return gridDao.listGridRelation(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridDTO> listGridByRelationId(String relationId) throws SearchException {
|
||||
List<GridDTO> gridDTOs = gridDao.listGridByRelationId(relationId);
|
||||
|
@ -59,6 +59,9 @@
|
||||
DELETE FROM
|
||||
map_grid
|
||||
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=")">
|
||||
@ -72,6 +75,9 @@
|
||||
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=")">
|
||||
@ -85,6 +91,15 @@
|
||||
DELETE FROM
|
||||
map_grid_relation
|
||||
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>
|
||||
<if test="relationId != null and relationId != ''">
|
||||
relation_id = #{relationId}
|
||||
</if>
|
||||
@ -116,6 +131,13 @@
|
||||
AND
|
||||
relation_id = #{relationId}
|
||||
</if>
|
||||
<if test="relationIds != null and relationIds.size > 0">
|
||||
AND
|
||||
relation_id IN
|
||||
<foreach collection="relationIds" index="index" open="(" separator="," close=")">
|
||||
#{relationIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 获取网格列表(通过关联ID) -->
|
||||
|
Loading…
Reference in New Issue
Block a user