查询项目的行政区域信息接口,项目相关管理接口逻辑完善,行政区划管理相关接口逻辑完善
This commit is contained in:
@ -68,4 +68,7 @@ public class GSites extends BaseEntity {
|
||||
@Excel(name = "关联的视频设备")
|
||||
@ApiModelProperty("关联的视频设备")
|
||||
private String videoDevices;
|
||||
|
||||
/** 类型id(即图例id) */
|
||||
private Long typeId;
|
||||
}
|
@ -33,9 +33,9 @@ public interface IGLegendService
|
||||
int updateGLegend(GLegend gLegend);
|
||||
|
||||
/**
|
||||
* 批量删除图例
|
||||
* 删除图例
|
||||
*/
|
||||
int deleteGLegendByIds(Long[] ids);
|
||||
int deleteGLegendById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -132,8 +132,8 @@ public class GGroupsServiceImpl implements IGGroupsService
|
||||
List<GGroups> roots = new ArrayList<>();
|
||||
//所有站点列表
|
||||
List<GGroupSiteVo> gGroupSiteAllList = selectGGroupsAllListSites(new GGroups());
|
||||
System.err.println("当前项目下所有站点:");
|
||||
gGroupSiteAllList.forEach(System.err::println);
|
||||
// System.err.println("当前项目下所有站点:");
|
||||
// gGroupSiteAllList.forEach(System.err::println);
|
||||
|
||||
for (GGroups group : groupsList) {
|
||||
//查询组的直接子站点列表
|
||||
|
@ -3,18 +3,23 @@ package com.fastbee.ggroup.service.impl;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
import com.fastbee.ggroup.enums.SiteTypeCategoryEnum;
|
||||
import com.fastbee.ggroup.mapper.GSitesMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.ggroup.mapper.GLegendMapper;
|
||||
import com.fastbee.ggroup.domain.GLegend;
|
||||
import com.fastbee.ggroup.service.IGLegendService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 图例Service业务层处理
|
||||
@ -29,8 +34,11 @@ public class GLegendServiceImpl implements IGLegendService
|
||||
|
||||
private final GLegendMapper gLegendMapper;
|
||||
|
||||
public GLegendServiceImpl(GLegendMapper gLegendMapper) {
|
||||
private final GSitesMapper gSitesMapper;
|
||||
|
||||
public GLegendServiceImpl(GLegendMapper gLegendMapper, GSitesMapper gSitesMapper) {
|
||||
this.gLegendMapper = gLegendMapper;
|
||||
this.gSitesMapper = gSitesMapper;
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +103,7 @@ public class GLegendServiceImpl implements IGLegendService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor=Exception. class)
|
||||
public int updateGLegend(GLegend gLegend)
|
||||
{
|
||||
//图例名称不能重复
|
||||
@ -105,21 +114,35 @@ public class GLegendServiceImpl implements IGLegendService
|
||||
if(!duplicateNameList.isEmpty()){
|
||||
throw new ServiceException("图例名称已存在!");
|
||||
}
|
||||
|
||||
gLegend.setUpdateTime(DateUtils.getNowDate());
|
||||
return gLegendMapper.updateGLegend(gLegend);
|
||||
}
|
||||
/**
|
||||
* 批量删除图例
|
||||
* 删除图例
|
||||
*
|
||||
* @param ids 需要删除的图例主键
|
||||
* @param id 需要删除的图例主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGLegendByIds(Long[] ids)
|
||||
public int deleteGLegendById(Long id)
|
||||
{
|
||||
return gLegendMapper.deleteGLegendByIds(ids);
|
||||
}
|
||||
List<GLegend> list = new LambdaQueryChainWrapper<>(gLegendMapper)
|
||||
.select(GLegend::getId, GLegend::getName)
|
||||
.eq(GLegend::getId, id).list();
|
||||
if (list.isEmpty()){
|
||||
throw new ServiceException("图例不存在!");
|
||||
}
|
||||
|
||||
List<GSites> gSitesList = new LambdaQueryChainWrapper<>(gSitesMapper)
|
||||
.select(GSites::getId, GSites::getType)
|
||||
.eq(GSites::getType, list.get(0).getName())
|
||||
.list();
|
||||
if(!gSitesList.isEmpty()){
|
||||
throw new ServiceException("图例已被站点使用,无法删除!");
|
||||
}
|
||||
return gLegendMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user