代码注释补充,冗余删除,mapper找不到报错解决等

This commit is contained in:
mi9688 2024-10-22 11:06:15 +08:00
parent 655e22579c
commit 135a5e295d
22 changed files with 266 additions and 418 deletions

View File

@ -10,20 +10,17 @@ import com.fastbee.ggroup.enums.GroupTagEnum;
import com.fastbee.ggroup.service.IGGroupsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import static java.util.stream.Collectors.toList;
/**
* 组Controller
*
* @author kerwincui
* @date 2024-09-27
* @date 2024-09-27
*/
@RestController
@RequestMapping("/gis/groups")
@ -31,8 +28,10 @@ import static java.util.stream.Collectors.toList;
@PreAuthorize("@ss.hasPermi('ggroup:groups')")
public class GGroupsController extends BaseController
{
@Autowired
private IGGroupsService gGroupsService;
private final IGGroupsService gGroupsService;
public GGroupsController(IGGroupsService gGroupsService) {
this.gGroupsService = gGroupsService;
}
/**
* 查询组树状结构列表
@ -43,6 +42,7 @@ public class GGroupsController extends BaseController
{
return success(gGroupsService.selectGGroupsList(gGroups));
}
/**
* 查询组带叶子节点树状列表
*/
@ -52,7 +52,6 @@ public class GGroupsController extends BaseController
return success(gGroupsService.selectGGroupsAndSitesList(gGroups));
}
/**
* 查询组下面的直属站点
*/
@ -65,23 +64,19 @@ public class GGroupsController extends BaseController
return super.getDataTable(list);
}
/**
* 获取组的标签(类别)
*/
@GetMapping("/list-label")
@ApiOperation("获取组的标签(类别)")
public AjaxResult listLabel() {
// 使用传统的方式将枚举转换为列表
List<Map<String, Object>> labelList = new ArrayList<>();
for (GroupTagEnum tag : GroupTagEnum.values()) {
Map<String, Object> map = new HashMap<>();
map.put("code", tag.getCode());
map.put("value", tag.getDescription());
labelList.add(map);
}
return AjaxResult.success(labelList);
}
@ -93,7 +88,7 @@ public class GGroupsController extends BaseController
public void export(HttpServletResponse response, GGroups gGroups)
{
List<GGroups> list = gGroupsService.selectGGroupsList(gGroups);
ExcelUtil<GGroups> util = new ExcelUtil<GGroups>(GGroups.class);
ExcelUtil<GGroups> util = new ExcelUtil<>(GGroups.class);
util.exportExcel(response, list, "组数据");
}

View File

@ -6,13 +6,10 @@ import java.util.List;
import java.util.Map;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.ggroup.domain.dto.GLegendUpdateDto;
import com.fastbee.ggroup.domain.dto.GLegendDto;
import com.fastbee.ggroup.enums.SiteTypeCategoryEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -33,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
* 图例Controller
*
* @author kerwincui
* @date 2024-10-08
* &#064;date 2024-10-08
*/
@RestController
@RequestMapping("/gis/legend")
@ -41,14 +38,18 @@ import javax.servlet.http.HttpServletResponse;
@PreAuthorize("@ss.hasPermi('ggroup:legend')")
public class GLegendController extends BaseController
{
@Autowired
private IGLegendService gLegendService;
/**
* 查询/搜索图例列表
*/
@GetMapping("/list")
@ApiOperation("查询图例列表")
private final IGLegendService gLegendService;
public GLegendController(IGLegendService gLegendService) {
this.gLegendService = gLegendService;
}
/**
* 查询/搜索图例列表
*/
@GetMapping("/list")
@ApiOperation("查询图例列表")
public TableDataInfo list(GLegend gLegend)
{
startPage();
@ -64,7 +65,7 @@ public class GLegendController extends BaseController
public void export(HttpServletResponse response, GLegend gLegend)
{
List<GLegend> list = gLegendService.selectGLegendList(gLegend);
ExcelUtil<GLegend> util = new ExcelUtil<GLegend>(GLegend.class);
ExcelUtil<GLegend> util = new ExcelUtil<>(GLegend.class);
util.exportExcel(response, list, "图例数据");
}
@ -113,12 +114,12 @@ public class GLegendController extends BaseController
*/
@GetMapping("/category-list")
@ApiOperation("获取图例按照类别划分列表")
public AjaxResult listByCategory(GLegend gLegend){
public AjaxResult listByCategory(){
return success(gLegendService.getLegendListByCategory());
}
/**
*获取图例的类别列表
* 获取图例的类别列表
*/
@GetMapping(value = "/category/list")
@ApiOperation("获取图例的类别列表")
@ -133,6 +134,4 @@ public class GLegendController extends BaseController
return AjaxResult.success(labelList);
}
}

View File

@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -15,10 +14,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.ggroup.domain.GSiteInfo;
import com.fastbee.ggroup.service.IGSiteInfoService;
import com.fastbee.common.utils.poi.ExcelUtil;
@ -28,7 +25,7 @@ import com.fastbee.common.core.page.TableDataInfo;
* 站点基础信息Controller
*
* @author kerwincui
* @date 2024-10-10
* &#064;date 2024-10-10
*/
@RestController
@RequestMapping("/gis/site/info")
@ -36,14 +33,18 @@ import com.fastbee.common.core.page.TableDataInfo;
@Api(tags = "站点基础信息")
public class GSiteInfoController extends BaseController
{
@Autowired
private IGSiteInfoService gSiteInfoService;
/**
* 查询站点基础信息列表
*/
@GetMapping("/list")
@ApiOperation("查询站点基础信息列表")
private final IGSiteInfoService gSiteInfoService;
public GSiteInfoController(IGSiteInfoService gSiteInfoService) {
this.gSiteInfoService = gSiteInfoService;
}
/**
* 查询站点基础信息列表
*/
@GetMapping("/list")
@ApiOperation("查询站点基础信息列表")
public TableDataInfo list(GSiteInfo gSiteInfo)
{
startPage();
@ -59,7 +60,7 @@ public class GSiteInfoController extends BaseController
public void export(HttpServletResponse response, GSiteInfo gSiteInfo)
{
List<GSiteInfo> list = gSiteInfoService.selectGSiteInfoList(gSiteInfo);
ExcelUtil<GSiteInfo> util = new ExcelUtil<GSiteInfo>(GSiteInfo.class);
ExcelUtil<GSiteInfo> util = new ExcelUtil<>(GSiteInfo.class);
util.exportExcel(response, list, "站点基础信息数据");
}

View File

@ -1,8 +1,8 @@
package com.fastbee.data.controller.gis;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
import com.fastbee.ggroup.domain.dto.GGroupSiteRelateDto;
import com.fastbee.ggroup.domain.dto.GSitesEditDto;
@ -10,7 +10,6 @@ import com.fastbee.ggroup.domain.dto.GSitesSelectDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -19,20 +18,19 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.ggroup.domain.GSites;
import com.fastbee.ggroup.service.IGSitesService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;
import javax.servlet.http.HttpServletResponse;
/**
* 站点Controller
*
* @author kerwincui
* @date 2024-09-29
* &#064;date 2024-09-29
*/
@RestController
@RequestMapping("/gis/sites")
@ -40,44 +38,47 @@ import com.fastbee.common.core.page.TableDataInfo;
@PreAuthorize("@ss.hasPermi('ggroup:groups')")
public class GSitesController extends BaseController
{
@Autowired
private IGSitesService gSitesService;
/**
* 查询/搜索站点列表
*/
private final IGSitesService gSitesService;
@GetMapping("/list")
@ApiOperation("查询站点列表")
public GSitesController(IGSitesService gSitesService) {
this.gSitesService = gSitesService;
}
/**
* 查询/搜索站点列表
*/
@GetMapping("/list")
@ApiOperation("查询站点列表")
public TableDataInfo list(GSitesSelectDto gSites)
{
startPage();
List<?> list = gSitesService.selectGSitesList(gSites);
List<GSites> list = gSitesService.selectGSitesList(gSites);
return getDataTable(list);
}
/**
* 站点关联组
*/
@PostMapping("/relate")
@ApiOperation("站点关联组")
public AjaxResult relate(@RequestBody GGroupSiteRelateDto gGroupSiteRelateDto){
return toAjax(gSitesService.relateGroup(gGroupSiteRelateDto));
}
// /**
// * 导出站点列表
// */
// @ApiOperation("导出站点列表")
// @PreAuthorize("@ss.hasPermi('ggroup:sites:export')")
// @PostMapping("/export")
// public void export(HttpServletResponse response, GSitesSelectDto gSites)
// {
// List<GSites> list = gSitesService.selectGSitesList(gSites);
// ExcelUtil<GSites> util = new ExcelUtil<GSites>(GSites.class);
// util.exportExcel(response, list, "站点数据");
// }
/**
* 导出站点列表
*/
@ApiOperation("导出站点列表")
@PreAuthorize("@ss.hasPermi('ggroup:sites:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, GSitesSelectDto gSites)
{
List<GSites> list = gSitesService.selectGSitesList(gSites);
ExcelUtil<GSites> util = new ExcelUtil<>(GSites.class);
util.exportExcel(response, list, "站点数据");
}
/**
* 获取站点详细信息
@ -120,7 +121,7 @@ public class GSitesController extends BaseController
/**
* 删除站点
* 批量删除站点
*/
@DeleteMapping("/batch/{ids}")
@ApiOperation("删除站点")

View File

@ -12,7 +12,6 @@ import com.fastbee.project.service.IProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -29,18 +28,22 @@ import com.fastbee.common.core.page.TableDataInfo;
* 项目Controller
*
* @author kerwincui
* @date 2024-09-26
* &#064;date 2024-09-26
*/
@RestController
@RequestMapping("/project")
@Api(tags = "项目")
public class ProjectController extends BaseController
{
@Autowired
private IProjectService projectService;
private final IProjectService projectService;
public ProjectController(IProjectService projectService) {
this.projectService = projectService;
}
/**
* 查询项目列表
* 查询/搜索项目列表
*/
@PreAuthorize("@ss.hasPermi('iot:project:list')")
@GetMapping("/list")
@ -53,9 +56,8 @@ public class ProjectController extends BaseController
}
/**
* 获取项目信息
* 获取管理员所管理的项目id以及子项目id列表
*/
// @PreAuthorize("@ss.hasPermi('iot:project:query')")
@GetMapping("/info/{userId}")
@ApiOperation("获取项目信息")
public AjaxResult getProjectInfo(@PathVariable("userId") Long userId){

View File

@ -1,10 +1,10 @@
package com.fastbee.ggroup.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.ggroup.domain.GGroups;
import com.fastbee.ggroup.domain.vo.GGroupSiteVo;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@ -13,9 +13,9 @@ import java.util.List;
* 组Mapper接口
*
* @author kerwincui
* @date 2024-09-27
* &#064;date 2024-09-27
*/
@Mapper
public interface GGroupsMapper extends MPJBaseMapper<GGroups>
{
/**
@ -24,7 +24,7 @@ public interface GGroupsMapper extends MPJBaseMapper<GGroups>
* @param id 组主键
* @return
*/
public GGroups selectGGroupsById(Long id);
GGroups selectGGroupsById(Long id);
/**
* 查询组列表
@ -32,7 +32,7 @@ public interface GGroupsMapper extends MPJBaseMapper<GGroups>
* @param gGroups
* @return 组集合
*/
public List<GGroups> selectGGroupsList(GGroups gGroups);
List<GGroups> selectGGroupsList(GGroups gGroups);
@Select({
@ -63,7 +63,7 @@ public interface GGroupsMapper extends MPJBaseMapper<GGroups>
* @param gGroups
* @return 结果
*/
public int insertGGroups(GGroups gGroups);
int insertGGroups(GGroups gGroups);
/**
* 修改组
@ -71,7 +71,7 @@ public interface GGroupsMapper extends MPJBaseMapper<GGroups>
* @param gGroups
* @return 结果
*/
public int updateGGroups(GGroups gGroups);
int updateGGroups(GGroups gGroups);
/**
* 删除组
@ -79,7 +79,7 @@ public interface GGroupsMapper extends MPJBaseMapper<GGroups>
* @param id 组主键
* @return 结果
*/
public int deleteGGroupsById(Long id);
int deleteGGroupsById(Long id);
/**
* 批量删除组
@ -87,5 +87,5 @@ public interface GGroupsMapper extends MPJBaseMapper<GGroups>
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGGroupsByIds(Long[] ids);
int deleteGGroupsByIds(Long[] ids);
}

View File

@ -3,13 +3,15 @@ package com.fastbee.ggroup.mapper;
import java.util.List;
import com.fastbee.ggroup.domain.GLegend;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 图例Mapper接口
*
* @author kerwincui
* @date 2024-10-08
* &#064;date 2024-10-08
*/
@Mapper
public interface GLegendMapper extends MPJBaseMapper<GLegend>
{
/**
@ -18,7 +20,7 @@ public interface GLegendMapper extends MPJBaseMapper<GLegend>
* @param id 图例主键
* @return 图例
*/
public GLegend selectGLegendById(Long id);
GLegend selectGLegendById(Long id);
/**
* 查询图例列表
@ -26,7 +28,7 @@ public interface GLegendMapper extends MPJBaseMapper<GLegend>
* @param gLegend 图例
* @return 图例集合
*/
public List<GLegend> selectGLegendList(GLegend gLegend);
List<GLegend> selectGLegendList(GLegend gLegend);
/**
* 新增图例
@ -34,7 +36,7 @@ public interface GLegendMapper extends MPJBaseMapper<GLegend>
* @param gLegend 图例
* @return 结果
*/
public int insertGLegend(GLegend gLegend);
int insertGLegend(GLegend gLegend);
/**
* 修改图例
@ -42,7 +44,7 @@ public interface GLegendMapper extends MPJBaseMapper<GLegend>
* @param gLegend 图例
* @return 结果
*/
public int updateGLegend(GLegend gLegend);
int updateGLegend(GLegend gLegend);
/**
* 删除图例
@ -50,7 +52,7 @@ public interface GLegendMapper extends MPJBaseMapper<GLegend>
* @param id 图例主键
* @return 结果
*/
public int deleteGLegendById(Long id);
int deleteGLegendById(Long id);
/**
* 批量删除图例
@ -58,6 +60,6 @@ public interface GLegendMapper extends MPJBaseMapper<GLegend>
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGLegendByIds(Long[] ids);
int deleteGLegendByIds(Long[] ids);
}

View File

@ -1,19 +1,19 @@
package com.fastbee.ggroup.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.ggroup.domain.GSiteGroups;
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
/**
* 站点组关系Mapper接口
*
* @author kerwincui
* @date 2024-09-30
* &#064;date 2024-09-30
*/
@Mapper
public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
{
@ -23,7 +23,7 @@ public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
* @param id 站点组关系主键
* @return 站点组关系
*/
public GSiteGroups selectGSiteGroupsById(Long id);
GSiteGroups selectGSiteGroupsById(Long id);
/**
* 查询站点组关系列表
@ -31,7 +31,7 @@ public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
* @param gSiteGroups 站点组关系
* @return 站点组关系集合
*/
public List<GSiteGroups> selectGSiteGroupsList(GSiteGroups gSiteGroups);
List<GSiteGroups> selectGSiteGroupsList(GSiteGroups gSiteGroups);
/**
* 新增站点组关系
@ -41,7 +41,7 @@ public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
*/
@Insert("insert into g_site_groups (site_id, parent_id, project_id,order_num) " +
"value (#{siteId},#{parentId},#{projectId},#{orderNum})")
public int insertGSiteGroups(GGroupSiteDto gSiteGroups);
int insertGSiteGroups(GGroupSiteDto gSiteGroups);
/**
* 修改站点组关系
@ -49,7 +49,7 @@ public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
* @param gSiteGroups 站点组关系
* @return 结果
*/
public int updateGSiteGroups(GSiteGroups gSiteGroups);
int updateGSiteGroups(GSiteGroups gSiteGroups);
/**
* 删除站点组关系
@ -57,7 +57,7 @@ public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
* @param id 站点组关系主键
* @return 结果
*/
public int deleteGSiteGroupsById(Long id);
int deleteGSiteGroupsById(Long id);
/**
* 批量删除站点组关系
@ -65,5 +65,5 @@ public interface GSiteGroupsMapper extends MPJBaseMapper<GSiteGroups>
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGSiteGroupsByIds(Long[] ids);
int deleteGSiteGroupsByIds(Long[] ids);
}

View File

@ -4,13 +4,15 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.ggroup.domain.GSiteInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* 站点基础信息Mapper接口
*
* @author kerwincui
* @date 2024-10-10
* &#064;date 2024-10-10
*/
@Mapper
public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
{
/**
@ -19,7 +21,7 @@ public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
* @param id 站点基础信息主键
* @return 站点基础信息
*/
public GSiteInfo selectGSiteInfoById(Long id);
GSiteInfo selectGSiteInfoById(Long id);
/**
* 查询站点基础信息列表
@ -27,7 +29,7 @@ public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
* @param gSiteInfo 站点基础信息
* @return 站点基础信息集合
*/
public List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo);
List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo);
/**
* 新增站点基础信息
@ -35,7 +37,7 @@ public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int insertGSiteInfo(GSiteInfo gSiteInfo);
int insertGSiteInfo(GSiteInfo gSiteInfo);
/**
* 修改站点基础信息
@ -43,7 +45,7 @@ public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int updateGSiteInfo(GSiteInfo gSiteInfo);
int updateGSiteInfo(GSiteInfo gSiteInfo);
/**
* 删除站点基础信息
@ -51,7 +53,7 @@ public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
* @param id 站点基础信息主键
* @return 结果
*/
public int deleteGSiteInfoById(Long id);
int deleteGSiteInfoById(Long id);
/**
* 批量删除站点基础信息
@ -59,5 +61,5 @@ public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGSiteInfoByIds(Long[] ids);
int deleteGSiteInfoByIds(Long[] ids);
}

View File

@ -5,15 +5,16 @@ import java.util.List;
import com.fastbee.ggroup.domain.GSites;
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 站点Mapper接口
*
* @author kerwincui
* @date 2024-09-29
* &#064;date 2024-09-29
*/
@Mapper
public interface GSitesMapper extends MPJBaseMapper<GSites>
{
/**
@ -23,7 +24,7 @@ public interface GSitesMapper extends MPJBaseMapper<GSites>
* @return 站点
*/
public GSites selectGSitesById(Long id);
GSites selectGSitesById(Long id);
/**
* 查询站点列表
@ -31,7 +32,7 @@ public interface GSitesMapper extends MPJBaseMapper<GSites>
* @param gSites 站点
* @return 站点集合
*/
public List<GSites> selectGSitesList(GSites gSites);
List<GSites> selectGSitesList(GSites gSites);
/**
* 新增站点
@ -39,7 +40,7 @@ public interface GSitesMapper extends MPJBaseMapper<GSites>
* @param gGroupSiteDto 站点
* @return 结果
*/
public int insertGSites(GGroupSiteDto gGroupSiteDto);
int insertGSites(GGroupSiteDto gGroupSiteDto);
/**
* 修改站点
@ -47,7 +48,7 @@ public interface GSitesMapper extends MPJBaseMapper<GSites>
* @param gSites 站点
* @return 结果
*/
public int updateGSites(GSites gSites);
int updateGSites(GSites gSites);
/**
* 删除站点
@ -56,8 +57,7 @@ public interface GSitesMapper extends MPJBaseMapper<GSites>
* @return 结果
*/
// @Delete("delete from g_site_groups where id= #{id}")
public int deleteGSitesById(@Param("id") Long id);
int deleteGSitesById(@Param("id") Long id);
/**
* 批量删除站点
@ -65,5 +65,5 @@ public interface GSitesMapper extends MPJBaseMapper<GSites>
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGSitesByIds(Long[] ids);
int deleteGSitesByIds(Long[] ids);
}

View File

@ -12,63 +12,43 @@ import java.util.List;
* 组Service接口
*
* @author kerwincui
* @date 2024-09-27
* &#064;date 2024-09-27
*/
public interface IGGroupsService
{
/**
* 查询组
*
* @param id 组主键
* @return
* 根据id查询组详情
*/
public GGroups selectGGroupsById(Long id);
GGroups selectGGroupsById(Long id);
/**
* 查询组树状列表
*
* @param gGroups
* @return 组集合
* 查询组树状列表(不带叶子节点)
*/
public List<GGroups> selectGGroupsList(GGroups gGroups);
List<GGroups> selectGGroupsList(GGroups gGroups);
/**
* 查询组下面的站点列表
*/
List<GGroupSiteVo> selectGGroupsListSites(GGroups gGroups);
public List<GGroupSiteVo> selectGGroupsListSites(GGroups gGroups);
/**
* 新增组
*
* @param gGroups
* @return 结果
*/
public int insertGGroups(GGroups gGroups);
int insertGGroups(GGroups gGroups);
/**
* 修改组
*
* @param gGroups
* @return 结果
*/
public int updateGGroups(GGroups gGroups);
int updateGGroups(GGroups gGroups);
/**
* 批量删除组
*
* @param ids 需要删除的组主键集合
* @return 结果
* 删除组
*/
public int deleteGGroupsByIds(Long[] ids);
int deleteGGroupsById(Long id);
/**
* 删除组信息
*
* @param id 组主键
* @return 结果
*/
public int deleteGGroupsById(Long id);
/**
* 查询组和站点(叶子节点)的树状结构
* @param gGroups
* @return 列表
* 查询组和站点(叶子节点)的树状结构组下面会有组或者站点
*/
List<?> selectGGroupsAndSitesList(GGroups gGroups);

View File

@ -3,69 +3,45 @@ package com.fastbee.ggroup.service;
import java.util.List;
import com.fastbee.ggroup.domain.GLegend;
import com.fastbee.ggroup.domain.dto.GLegendUpdateDto;
import com.fastbee.ggroup.domain.dto.GLegendDto;
/**
* 图例Service接口
*
* @author kerwincui
* @date 2024-10-08
* &#064;date 2024-10-08
*/
public interface IGLegendService
{
/**
* 查询图例
*
* @param id 图例主键
* @return 图例
*/
public GLegend selectGLegendById(Long id);
GLegend selectGLegendById(Long id);
/**
* 查询/搜索图例列表
*
* @param gLegend 图例
* @return 图例集合
*/
public List<GLegend> selectGLegendList(GLegend gLegend);
List<GLegend> selectGLegendList(GLegend gLegend);
/**
* 新增图例
*
* @param gLegend 图例
* @return 结果
*/
public int insertGLegend(GLegend gLegend);
int insertGLegend(GLegend gLegend);
/**
* 修改图例
*
* @param gLegend 图例
* @return 结果
*/
public int updateGLegend(GLegend gLegend);
int updateGLegend(GLegend gLegend);
/**
* 批量删除图例
*
* @param ids 需要删除的图例主键集合
* @return 结果
*/
public int deleteGLegendByIds(Long[] ids);
int deleteGLegendByIds(Long[] ids);
/**
* 删除图例信息
*
* @param id 图例主键
* @return 结果
*/
public int deleteGLegendById(Long id);
/**
* 获取不同类别图例列表
*/
public List<?> getLegendListByCategory();
List<?> getLegendListByCategory();
}

View File

@ -7,7 +7,7 @@ import com.fastbee.ggroup.domain.GSiteInfo;
* 站点基础信息Service接口
*
* @author kerwincui
* @date 2024-10-10
* &#064;date 2024-10-10
*/
public interface IGSiteInfoService
{
@ -17,7 +17,7 @@ public interface IGSiteInfoService
* @param id 站点基础信息主键
* @return 站点基础信息
*/
public GSiteInfo selectGSiteInfoById(Long id);
GSiteInfo selectGSiteInfoById(Long id);
/**
* 查询站点基础信息列表
@ -25,7 +25,7 @@ public interface IGSiteInfoService
* @param gSiteInfo 站点基础信息
* @return 站点基础信息集合
*/
public List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo);
List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo);
/**
* 新增站点基础信息
@ -33,7 +33,7 @@ public interface IGSiteInfoService
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int insertGSiteInfo(GSiteInfo gSiteInfo);
int insertGSiteInfo(GSiteInfo gSiteInfo);
/**
* 修改站点基础信息
@ -41,7 +41,7 @@ public interface IGSiteInfoService
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int updateGSiteInfo(GSiteInfo gSiteInfo);
int updateGSiteInfo(GSiteInfo gSiteInfo);
/**
* 批量删除站点基础信息
@ -49,13 +49,6 @@ public interface IGSiteInfoService
* @param ids 需要删除的站点基础信息主键集合
* @return 结果
*/
public int deleteGSiteInfoByIds(Long[] ids);
int deleteGSiteInfoByIds(Long[] ids);
/**
* 删除站点基础信息信息
*
* @param id 站点基础信息主键
* @return 结果
*/
public int deleteGSiteInfoById(Long id);
}

View File

@ -11,70 +11,47 @@ import com.fastbee.ggroup.domain.dto.GSitesSelectDto;
* 站点Service接口
*
* @author kerwincui
* @date 2024-09-29
* &#064;date 2024-09-29
*/
public interface IGSitesService
{
/**
* 查询站点
*
* @param id 站点主键
* @return 站点
*/
public GSites selectGSitesById(Long id);
GSites selectGSitesById(Long id);
/**
* 查询站点列表
*
* @param gSites 站点
* @return 站点集合
*/
public List<?> selectGSitesList(GSitesSelectDto gSites);
List<GSites> selectGSitesList(GSitesSelectDto gSites);
/**
* 新增站点
*
* @param gGroupSiteDto 站点
* @return 结果
*/
public int insertGSites(GGroupSiteDto gGroupSiteDto);
int insertGSites(GGroupSiteDto gGroupSiteDto);
/**
* 修改站点
*
* @param gSitesEditDto 站点
* @return 结果
*/
public int updateGSites(GSitesEditDto gSitesEditDto);
int updateGSites(GSitesEditDto gSitesEditDto);
/**
* 批量删除站点
*
* @param ids 需要删除的站点主键集合
* @return 结果
*/
public int deleteGSitesByIds(Long[] ids);
int deleteGSitesByIds(Long[] ids);
/**
* 删除站点信息
*
* @param id 站点主键
* @return 结果
*/
public int deleteGSitesById(Long id);
int deleteGSitesById(Long id);
/**
* 站点关联组
*
* @param gGroupSiteRelateDto
* @return
*/
int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto);
/**
* 搜索站点列表
* @param gSites
* @return
*/
List<GSites> searchGSitesList(GSites gSites);
}

View File

@ -1,7 +1,6 @@
package com.fastbee.ggroup.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.holder.ProjectHolder;
@ -12,11 +11,9 @@ import com.fastbee.ggroup.domain.GSites;
import com.fastbee.ggroup.domain.vo.GGroupSiteVo;
import com.fastbee.ggroup.mapper.GGroupsMapper;
import com.fastbee.ggroup.mapper.GSiteGroupsMapper;
import com.fastbee.ggroup.mapper.GSitesMapper;
import com.fastbee.ggroup.service.IGGroupsService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@ -32,16 +29,19 @@ import java.util.stream.Collectors;
@Service
public class GGroupsServiceImpl implements IGGroupsService
{
@Autowired
private GGroupsMapper gGroupsMapper;
private final GGroupsMapper gGroupsMapper;
@Autowired
private GSiteGroupsMapper gSiteGroupsMapper;
private final GSiteGroupsMapper gSiteGroupsMapper;
public GGroupsServiceImpl(GGroupsMapper gGroupsMapper, GSiteGroupsMapper gSiteGroupsMapper) {
this.gGroupsMapper = gGroupsMapper;
this.gSiteGroupsMapper = gSiteGroupsMapper;
}
/**
* 查询组
* 根据id查询组详情
*
* @param id 组主键
* @return
@ -54,7 +54,7 @@ public class GGroupsServiceImpl implements IGGroupsService
/**
* 查询组树状结构列表
* 查询组树状列表(不带叶子节点)
*
* @param gGroups
* @return
@ -69,7 +69,7 @@ public class GGroupsServiceImpl implements IGGroupsService
GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList())
.eq(gGroups.getProjectId()!=null, GGroups::getProjectId, gGroups.getProjectId())
.list();
return buildTree(list);
return buildGroupTree(list);
}
/**
@ -91,19 +91,22 @@ public class GGroupsServiceImpl implements IGGroupsService
return gSiteGroupsMapper.selectJoinList(GGroupSiteVo.class,gSiteGroupsMPJLambdaWrapper);
}
private List<GGroups> buildTree(List<GGroups> groups) {
/**
* 构建组树状列表
*/
private List<GGroups> buildGroupTree(List<GGroups> groups) {
Map<Long, GGroups> map = new HashMap<>();
List<GGroups> roots = new ArrayList<>();
for (GGroups group : groups) {
map.put(group.getId(), group);
}
return getgGroups(groups, map, roots);
return combinationGroupsTree(groups, map, roots);
}
/**
* 组合组树状结构列表
*/
private List<GGroups> getgGroups(List<GGroups> groups, Map<Long, GGroups> map, List<GGroups> roots) {
private List<GGroups> combinationGroupsTree(List<GGroups> groups, Map<Long, GGroups> map, List<GGroups> roots) {
for (GGroups group : groups) {
Long parentId = group.getParentId();
if (parentId == null || !map.containsKey(parentId)) {
@ -119,6 +122,9 @@ public class GGroupsServiceImpl implements IGGroupsService
return roots;
}
/**
* 构建组和站点树状列表
*/
private List<GGroups> buildTreeSite(List<GGroups> groupsList) {
// 构建一个Map用于存储每个组对象:id->组对象
Map<Long, GGroups> map = new HashMap<>();
@ -147,7 +153,7 @@ public class GGroupsServiceImpl implements IGGroupsService
map.put(group.getId(), group);
}
//构建组树状结构
return getgGroups(groupsList, map, roots);
return combinationGroupsTree(groupsList, map, roots);
}
/**
@ -159,17 +165,14 @@ public class GGroupsServiceImpl implements IGGroupsService
@Override
public int insertGGroups(GGroups gGroups)
{
//判断所属项目
//同一个父节点下组名不能重复
GGroups duplicateName=gGroupsMapper.selectOne(new LambdaQueryWrapper<GGroups>()
List<GGroups> duplicateNameList = new LambdaQueryChainWrapper<>(gGroupsMapper)
.select(GGroups::getId)
.eq(GGroups::getName, gGroups.getName().trim())
.eq(GGroups::getParentId, gGroups.getParentId())
);
if(Objects.nonNull(duplicateName)){
throw new ServiceException("组名已存在!");
.list();
if(!duplicateNameList.isEmpty()){
throw new ServiceException("组名重复!");
}
gGroups.setCreateTime(DateUtils.getNowDate());
return gGroupsMapper.insertGGroups(gGroups);
@ -185,29 +188,20 @@ public class GGroupsServiceImpl implements IGGroupsService
public int updateGGroups(GGroups gGroups)
{
//同一个父节点下组名不能重复
GGroups duplicateName=gGroupsMapper.selectOne(new LambdaQueryWrapper<GGroups>()
List<GGroups> duplicateNameList = new LambdaQueryChainWrapper<>(gGroupsMapper)
.select(GGroups::getId)
.eq(GGroups::getName, gGroups.getName().trim())
.eq(GGroups::getParentId, gGroups.getParentId())
.ne(GGroups::getId, gGroups.getId()));
if(Objects.nonNull(duplicateName)){
throw new ServiceException("组名已存在!");
.eq(GGroups::getName, gGroups.getName().trim())
.ne(GGroups::getId, gGroups.getId())
.list();
if(!duplicateNameList.isEmpty()){
throw new ServiceException("组名重复!");
}
gGroups.setUpdateTime(DateUtils.getNowDate());
return gGroupsMapper.updateGGroups(gGroups);
}
/**
* 批量删除组
*
* @param ids 需要删除的组主键
* @return 结果
*/
@Override
public int deleteGGroupsByIds(Long[] ids)
{
return gGroupsMapper.deleteGGroupsByIds(ids);
}
/**
* 删除组信息
@ -229,17 +223,15 @@ public class GGroupsServiceImpl implements IGGroupsService
*/
@Override
public List<?> selectGGroupsAndSitesList(GGroups gGroups) {
List<GGroups> list = new LambdaQueryChainWrapper<>(gGroupsMapper)
.select(GGroups::getId, GGroups::getName, GGroups::getParentId,
GGroups::getIcon,GGroups::getTag,
List<GGroups> groupSiteTreeList = new LambdaQueryChainWrapper<>(gGroupsMapper)
.select(GGroups::getId, GGroups::getName, GGroups::getParentId, GGroups::getIcon,GGroups::getTag,
GGroups::getSpace, GGroups::getSpaceValue, GGroups::getProjectId)
.eq(Objects.nonNull(gGroups.getTag()), GGroups::getTag, gGroups.getTag())
.in(Objects.nonNull(ProjectHolder.getProjectInfo().getProjectIdList()),GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList())
.in(Objects.nonNull(ProjectHolder.getProjectInfo().getProjectIdList()),GGroups::getProjectId,
ProjectHolder.getProjectInfo().getProjectIdList())
.list();
System.err.println(ProjectHolder.getProjectInfo());
list.forEach(System.err::println);
List<GGroups> gGroupsList = buildTreeSite(list);
//组的树状结构外层数组元素套一层数组
List<GGroups> gGroupsList = buildTreeSite(groupSiteTreeList);
//组的树状结构外层数组元素套一层数组方便前端数据渲染
return gGroupsList.stream().map(gGroups1 -> {
List<GGroups> list1 = new ArrayList<>();
list1.add(gGroups1);

View File

@ -5,13 +5,11 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GLegendMapper;
import com.fastbee.ggroup.domain.GLegend;
@ -27,8 +25,12 @@ import com.fastbee.ggroup.service.IGLegendService;
@Slf4j
public class GLegendServiceImpl implements IGLegendService
{
@Autowired
private GLegendMapper gLegendMapper;
private final GLegendMapper gLegendMapper;
public GLegendServiceImpl(GLegendMapper gLegendMapper) {
this.gLegendMapper = gLegendMapper;
}
/**
@ -40,9 +42,10 @@ public class GLegendServiceImpl implements IGLegendService
@Override
public GLegend selectGLegendById(Long id)
{
return gLegendMapper.selectOne(new LambdaQueryWrapper<GLegend>()
return new LambdaQueryChainWrapper<>(gLegendMapper)
.select(GLegend::getId,GLegend::getIcon,GLegend::getName,GLegend::getCategory)
.eq(GLegend::getId,id));
.eq(GLegend::getId,id)
.one();
}
/**
@ -68,10 +71,12 @@ public class GLegendServiceImpl implements IGLegendService
public int insertGLegend(GLegend gLegend)
{
//图例名称不能重复
if(!new LambdaQueryChainWrapper<>(gLegendMapper)
.select(GLegend::getId,GLegend::getName)
.eq(GLegend::getName,gLegend.getName().trim()).list().isEmpty()){
throw new ServiceException("图例名称已存在!");
List<GLegend> duplicateNameList = new LambdaQueryChainWrapper<>(gLegendMapper)
.select(GLegend::getId, GLegend::getName)
.eq(GLegend::getName, gLegend.getName().trim())
.list();
if(!duplicateNameList.isEmpty()){
throw new ServiceException("图例名称重复!");
}
return gLegendMapper.insertGLegend(gLegend);
}
@ -86,9 +91,11 @@ public class GLegendServiceImpl implements IGLegendService
public int updateGLegend(GLegend gLegend)
{
//图例名称不能重复
if(!new LambdaQueryChainWrapper<>(gLegendMapper)
List<GLegend> duplicateNameList=new LambdaQueryChainWrapper<>(gLegendMapper)
.select(GLegend::getId,GLegend::getName)
.eq(GLegend::getName,gLegend.getName().trim()).ne(GLegend::getId,gLegend.getId()).list().isEmpty()){
.eq(GLegend::getName,gLegend.getName().trim())
.ne(GLegend::getId,gLegend.getId()).list();
if(!duplicateNameList.isEmpty()){
throw new ServiceException("图例名称已存在!");
}
gLegend.setUpdateTime(DateUtils.getNowDate());
@ -106,17 +113,7 @@ public class GLegendServiceImpl implements IGLegendService
return gLegendMapper.deleteGLegendByIds(ids);
}
/**
* 删除图例信息
*
* @param id 图例主键
* @return 结果
*/
@Override
public int deleteGLegendById(Long id)
{
return gLegendMapper.deleteGLegendById(id);
}
/**
* 按照类别返回所有类别下图例列表
@ -127,6 +124,7 @@ public class GLegendServiceImpl implements IGLegendService
return new LambdaQueryChainWrapper<>(gLegendMapper)
.select(GLegend::getId,GLegend::getIcon, GLegend::getName,GLegend::getCategory)
.list().stream()
//按照类别分组
.collect(Collectors.groupingBy(GLegend::getCategory))
.entrySet().stream()
.map(entry -> {

View File

@ -6,9 +6,6 @@ import java.util.Objects;
import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.common.utils.ValidationUtils;
import com.fastbee.ggroup.domain.GSites;
import com.fastbee.ggroup.mapper.GSitesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GSiteInfoMapper;
import com.fastbee.ggroup.domain.GSiteInfo;
@ -18,13 +15,17 @@ import com.fastbee.ggroup.service.IGSiteInfoService;
* 站点基础信息Service业务层处理
*
* @author kerwincui
* @date 2024-10-10
* &#064;date 2024-10-10
*/
@Service
public class GSiteInfoServiceImpl implements IGSiteInfoService
{
@Autowired
private GSiteInfoMapper gSiteInfoMapper;
private final GSiteInfoMapper gSiteInfoMapper;
public GSiteInfoServiceImpl(GSiteInfoMapper gSiteInfoMapper) {
this.gSiteInfoMapper = gSiteInfoMapper;
}
/**
@ -102,15 +103,4 @@ public class GSiteInfoServiceImpl implements IGSiteInfoService
return gSiteInfoMapper.deleteGSiteInfoByIds(ids);
}
/**
* 删除站点基础信息信息
*
* @param id 站点基础信息主键
* @return 结果
*/
@Override
public int deleteGSiteInfoById(Long id)
{
return gSiteInfoMapper.deleteGSiteInfoById(id);
}
}

View File

@ -1,9 +1,6 @@
package com.fastbee.ggroup.service.impl;
import java.io.*;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -15,7 +12,6 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fastbee.common.config.RuoYiConfig;
import com.fastbee.common.exception.ServiceException;
import com.fastbee.ggroup.domain.GSiteGroups;
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
@ -24,10 +20,8 @@ import com.fastbee.ggroup.domain.dto.GSitesEditDto;
import com.fastbee.ggroup.domain.dto.GSitesSelectDto;
import com.fastbee.ggroup.mapper.GSiteGroupsMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GSitesMapper;
import com.fastbee.ggroup.domain.GSites;
@ -43,17 +37,17 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Slf4j
public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups> implements IGSitesService {
@Autowired
private GSitesMapper gSitesMapper;
@Autowired
private GSiteGroupsMapper gSiteGroupsMapper;
private final GSitesMapper gSitesMapper;
private final GSiteGroupsMapper gSiteGroupsMapper;
public GSitesServiceImpl(GSitesMapper gSitesMapper, GSiteGroupsMapper gSiteGroupsMapper) {
this.gSitesMapper = gSitesMapper;
this.gSiteGroupsMapper = gSiteGroupsMapper;
}
/**
* 查询站点
*
* @param id 站点主键
* @return 站点
*/
@Override
public GSites selectGSitesById(Long id) {
@ -61,24 +55,18 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}
/**
* 查询/搜索全部站点列表
*
* @param gSites 站点
* @return 站点
* 查询全部站点列表
*/
@Override
public List<?> selectGSitesList(GSitesSelectDto gSites) {
return gSitesMapper.selectList(new LambdaQueryWrapper<GSites>()
public List<GSites> selectGSitesList(GSitesSelectDto gSites) {
return new LambdaQueryChainWrapper<>(gSitesMapper)
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType)
.eq(GSites::getProjectId, gSites.getProjectId())
);
.list();
}
/**
* 新增站点
*
* @param gGroupSiteDto 站点
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
@ -99,21 +87,18 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}
//设置坐标值等信息
getReadJsonFileContent(gSites);
// 插入站点表
//插入站点表
int inserted = gSitesMapper.insert(gSites);
gGroupSiteDto.setSiteId(gSites.getId());
//插入关系表
int inserted1 = gSiteGroupsMapper.insertGSiteGroups(gGroupSiteDto);
return inserted == 1 && inserted1 == 1 ? 1 : 0;
// return 1;
}
/**
* 读取上传的站点图信息并赋值
* @param gSites 站点
*/
private void getReadJsonFileContent(GSites gSites) {
String json;
//TODO 路径优化
//发起http请求获取json数据
String space = gSites.getSpace();
@ -137,9 +122,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
throw new ServiceException("json格式不正确");
}
int startIndex = space.indexOf("/profile/upload/");
// System.err.println("路径匹配截取开始下标:"+startIndex);
String relativeUrl = space.substring(startIndex);
// System.err.println("相对路径:"+relativeUrl);
gSites.setSpace(relativeUrl);
gSites.setSpaceValue(jsonData);
@ -148,9 +131,6 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
/**
* 修改站点
*
* @param gSitesEditDto 站点
* @return 结果
*/
@Override
public int updateGSites(GSitesEditDto gSitesEditDto) {
@ -183,9 +163,6 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}
/**
* 批量删除站点
*
* @param ids 需要删除的站点主键
* @return 结果
*/
@Override
public int deleteGSitesByIds(Long[] ids) {
@ -194,9 +171,6 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
/**
* 删除站点信息
*
* @param id 站点主键
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
@ -221,13 +195,10 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}
//如果有跟其他组建立关系只删除跟当前组的关系
return gSiteGroupsMapper.deleteById(id);
}
/**
* 站点关联组
* @param gGroupSiteRelateDto 传输对象
* @return 结果
*/
@Override
public int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto) {
@ -251,8 +222,6 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
/**
* 搜索站点列表
* @param gSites 站点对象
* @return 结果
*/
@Override
public List<GSites> searchGSitesList(GSites gSites) {

View File

@ -4,6 +4,7 @@ package com.fastbee.project.mapper;
import com.fastbee.project.domain.Project;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -11,8 +12,9 @@ import java.util.List;
* 项目Mapper接口
*
* @author kerwincui
* @date 2024-10-17
* &#064;date 2024-10-17
*/
@Mapper
public interface ProjectMapper extends MPJBaseMapper<Project>
{
/**
@ -21,7 +23,7 @@ public interface ProjectMapper extends MPJBaseMapper<Project>
* @param projectId 项目主键
* @return 项目
*/
public Project selectProjectByProjectId(Long projectId);
Project selectProjectByProjectId(Long projectId);
/**
* 查询项目列表
@ -29,7 +31,7 @@ public interface ProjectMapper extends MPJBaseMapper<Project>
* @param project 项目
* @return 项目集合
*/
public List<Project> selectProjectList(Project project);
List<Project> selectProjectList(Project project);
/**
* 新增项目
@ -37,7 +39,7 @@ public interface ProjectMapper extends MPJBaseMapper<Project>
* @param project 项目
* @return 结果
*/
public int insertProject(Project project);
int insertProject(Project project);
/**
* 修改项目
@ -45,7 +47,7 @@ public interface ProjectMapper extends MPJBaseMapper<Project>
* @param project 项目
* @return 结果
*/
public int updateProject(Project project);
int updateProject(Project project);
/**
* 删除项目
@ -53,7 +55,7 @@ public interface ProjectMapper extends MPJBaseMapper<Project>
* @param projectId 项目主键
* @return 结果
*/
public int deleteProjectByProjectId(Long projectId);
int deleteProjectByProjectId(Long projectId);
/**
* 批量删除项目
@ -61,5 +63,5 @@ public interface ProjectMapper extends MPJBaseMapper<Project>
* @param projectIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteProjectByProjectIds(Long[] projectIds);
int deleteProjectByProjectIds(Long[] projectIds);
}

View File

@ -10,7 +10,7 @@ import java.util.Map;
* 项目Service接口
*
* @author kerwincui
* @date 2024-09-26
* &#064;date 2024-09-26
*/
public interface IProjectService
{
@ -20,7 +20,7 @@ public interface IProjectService
* @param projectId 项目主键
* @return 项目
*/
public Project selectProjectByProjectId(Long projectId);
Project selectProjectByProjectId(Long projectId);
/**
* 查询项目列表
@ -28,7 +28,7 @@ public interface IProjectService
* @param project 项目
* @return 项目集合
*/
public List<Project> selectProjectList(Project project);
List<Project> selectProjectList(Project project);
/**
* 新增项目
@ -36,7 +36,7 @@ public interface IProjectService
* @param project 项目
* @return 结果
*/
public int insertProject(Project project);
int insertProject(Project project);
/**
* 修改项目
@ -44,7 +44,7 @@ public interface IProjectService
* @param project 项目
* @return 结果
*/
public int updateProject(Project project);
int updateProject(Project project);
/**
* 批量删除项目
@ -52,20 +52,12 @@ public interface IProjectService
* @param projectIds 需要删除的项目主键集合
* @return 结果
*/
public int deleteProjectByProjectIds(Long[] projectIds);
int deleteProjectByProjectIds(Long[] projectIds);
/**
* 删除项目信息
*
* @param projectId 项目主键
* @return 结果
*/
public int deleteProjectByProjectId(Long projectId);
/**
* 查询项目基本信息
* @param userId 用户ID
* @return 项目信息
* 获取管理员所管理的项目id以及子项目id列表
*/
Map<String,Object> selectProjectByUserId(Long userId);
@ -76,7 +68,7 @@ public interface IProjectService
List<SysDept> getUnbindDeptList();
/**
* 查询管理员项目切换下拉框数据
* 查询管理员可管理项目下拉框列表
* @return 项目列表
*/
List<Project> selectAdminProjectList();

View File

@ -13,7 +13,6 @@ import com.fastbee.project.service.IProjectService;
import com.fastbee.system.mapper.SysDeptMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@ -27,11 +26,16 @@ import java.util.*;
@Service
public class ProjectServiceImpl implements IProjectService
{
@Autowired
private ProjectMapper projectMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
private final ProjectMapper projectMapper;
private final SysDeptMapper sysDeptMapper;
public ProjectServiceImpl(ProjectMapper projectMapper, SysDeptMapper sysDeptMapper) {
this.projectMapper = projectMapper;
this.sysDeptMapper = sysDeptMapper;
}
/**
* 查询项目
@ -47,9 +51,6 @@ public class ProjectServiceImpl implements IProjectService
/**
* 查询项目列表
*
* @param project 项目
* @return 项目
*/
@Override
public List<Project> selectProjectList(Project project)
@ -65,9 +66,6 @@ public class ProjectServiceImpl implements IProjectService
/**
* 新增项目
*
* @param project 项目
* @return 结果
*/
@Override
public int insertProject(Project project)
@ -84,8 +82,6 @@ public class ProjectServiceImpl implements IProjectService
/**
* 修改项目
*
* @param project 项目
* @return 结果
*/
@Override
@ -107,9 +103,6 @@ public class ProjectServiceImpl implements IProjectService
/**
* 批量删除项目
*
* @param projectIds 需要删除的项目主键
* @return 结果
*/
@Override
public int deleteProjectByProjectIds(Long[] projectIds)
@ -117,24 +110,10 @@ public class ProjectServiceImpl implements IProjectService
return projectMapper.deleteProjectByProjectIds(projectIds);
}
/**
* 删除项目信息
*
* @param projectId 项目主键
* @return 结果
*/
@Override
public int deleteProjectByProjectId(Long projectId)
{
return projectMapper.deleteProjectByProjectId(projectId);
}
/**
* 查询项目基本信息
* @param userId 管理员id
* @return 结果
* 获取管理员所管理的项目id以及子项目id列表
*/
@Override
public Map<String, Object> selectProjectByUserId(Long userId) {
//查询该管理员所管理的项目id以及子项目id列表
@ -145,7 +124,6 @@ public class ProjectServiceImpl implements IProjectService
if(Objects.isNull(project)){
return null;
}
List<Long> projects = getAllProjects(project.getProjectId());
//把列表进行Base64编码
String projectsBase64 = Base64.encode(projects.toString());
@ -159,7 +137,6 @@ public class ProjectServiceImpl implements IProjectService
/**
* 查询未绑定项目的部门列表
* @return 部门列表
*/
@Override
public List<SysDept> getUnbindDeptList() {
@ -176,13 +153,14 @@ public class ProjectServiceImpl implements IProjectService
if (Objects.nonNull(project.getDeptId()))
sysDeptList.removeIf(sysDept -> sysDept.getDeptId().equals(project.getDeptId()));
}
return sysDeptList;
}
/**
* 查询管理员可管理项目下拉框列表
*/
@Override
public List<Project> selectAdminProjectList() {
Map<String, Object> rest = new HashMap<>();
//判断管理员级别
List<Project> projectList=new ArrayList<>();
//超级管理员
@ -201,7 +179,6 @@ public class ProjectServiceImpl implements IProjectService
.in(Project::getParentId, ProjectHolder.getProjectInfo().getProjectIdList())
.list();
}
return projectList;
}

View File

@ -9,7 +9,7 @@ import com.fastbee.system.domain.SysDistrict;
* 行政区划Mapper接口
*
* @author kerwincui
* @date 2024-10-18
* &#064;date 2024-10-18
*/
public interface SysDistrictMapper extends BaseMapper<SysDistrict>
{