图例管理接口完善

This commit is contained in:
mi9688
2024-10-08 17:45:30 +08:00
parent d562b85179
commit b66357dd77
4 changed files with 23 additions and 7 deletions

View File

@ -54,7 +54,6 @@ public class GGroupsController extends BaseController
{
super.startPage();
List<GGroupSiteVo> list = gGroupsService.selectGGroupsListSites(gGroups);
list.forEach(System.err::println);
return super.getDataTable(list);
}

View File

@ -31,7 +31,7 @@ import com.fastbee.common.core.page.TableDataInfo;
* @date 2024-10-08
*/
@RestController
@RequestMapping("/ggroup/legend")
@RequestMapping("/gis/legend")
@Api(tags = "图例")
public class GLegendController extends BaseController
{

View File

@ -36,4 +36,9 @@ public class GLegend extends BaseEntity
@ApiModelProperty("图标名称")
private String name;
/** 项目id */
@Excel(name = "项目id")
@ApiModelProperty("项目id")
private Long projectId;
}

View File

@ -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