图例管理接口完善
This commit is contained in:
@ -36,4 +36,9 @@ public class GLegend extends BaseEntity
|
||||
@ApiModelProperty("图标名称")
|
||||
private String name;
|
||||
|
||||
/** 项目id */
|
||||
@Excel(name = "项目id")
|
||||
@ApiModelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fastbee.ggroup.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -74,6 +75,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
|
||||
gSites.setName(gGroupSiteDto.getName().trim());
|
||||
gSites.setType(gGroupSiteDto.getType());
|
||||
gSites.setIcon(gGroupSiteDto.getIcon());
|
||||
gSites.setProjectId(gGroupSiteDto.getProjectId());
|
||||
//根据名称判断是否存在该站点
|
||||
GSites gSites1 = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
|
||||
.select(GSites::getName, GSites::getId)
|
||||
@ -97,11 +99,22 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
|
||||
*/
|
||||
@Override
|
||||
public int updateGSites(GSitesEditDto gSitesEditDto) {
|
||||
//查修改前站点名称
|
||||
GSites gSites = gSitesMapper.selectGSitesById(gSitesEditDto.getId());
|
||||
if (Objects.isNull(gSites)) {
|
||||
throw new ServiceException("修改站点不存在!");
|
||||
}
|
||||
//判断修改后是否和修改前一致
|
||||
if(gSites.getName().trim().equals(gSitesEditDto.getName().trim())){
|
||||
return 1;
|
||||
}
|
||||
|
||||
//不能有重复名字的站点
|
||||
GSites gSites1 = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
|
||||
.select(GSites::getName, GSites::getId)
|
||||
.eq(GSites::getName, gSitesEditDto.getName().trim()));
|
||||
if (gSites1 != null) {
|
||||
|
||||
if (Objects.nonNull(gSites1)) {
|
||||
throw new ServiceException("站点名称已存在!");
|
||||
}
|
||||
GSites sites = new GSites();
|
||||
@ -130,13 +143,12 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteGSitesById(Long id) {
|
||||
GSiteGroups gSiteGroups = gSiteGroupsMapper.selectGSiteGroupsById(id);
|
||||
if (gSiteGroups == null) {
|
||||
if (Objects.isNull(gSiteGroups)) {
|
||||
throw new ServiceException("站点不存在");
|
||||
}
|
||||
int deleted = gSitesMapper.deleteById(gSiteGroups.getSiteId());
|
||||
// int deleted = gSitesMapper.deleteById(gSiteGroups.getSiteId());
|
||||
//删除关系
|
||||
int deleted1 = gSiteGroupsMapper.deleteById(id);
|
||||
return deleted == 1 && deleted1 == 1 ? 1 : 0;
|
||||
return gSiteGroupsMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user