gis组管理,站点管理部分接口
This commit is contained in:
@ -0,0 +1,74 @@
|
||||
package com.fastbee.ggroup.domain;
|
||||
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 组对象 g_groups
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
@ApiModel(value = "GGroups",description = "组 g_groups")
|
||||
@Data
|
||||
|
||||
public class GGroups extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 组名 */
|
||||
@Excel(name = "组名")
|
||||
@ApiModelProperty("组名")
|
||||
private String name;
|
||||
|
||||
/** 图标 */
|
||||
@Excel(name = "图标")
|
||||
@ApiModelProperty("图标")
|
||||
private String icon;
|
||||
|
||||
/** 标签(1江河湖泊,2水利工程,3.检测站点,4.其他对象,5.水利事务,6.报警事件) */
|
||||
@Excel(name = "标签(1江河湖泊,2水利工程,3.检测站点,4.其他对象,5.水利事务,6.报警事件)")
|
||||
@ApiModelProperty("标签(1江河湖泊,2水利工程,3.检测站点,4.其他对象,5.水利事务,6.报警事件)")
|
||||
private Long tag;
|
||||
|
||||
/** 项目id */
|
||||
@Excel(name = "项目id")
|
||||
@ApiModelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
/** 项目名称 */
|
||||
@Excel(name = "项目名称")
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
/** 空间数据 */
|
||||
@Excel(name = "空间数据")
|
||||
@ApiModelProperty("空间数据")
|
||||
private String space;
|
||||
|
||||
/** 父菜单名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 父菜单ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 子部门 */
|
||||
private List<GGroups> children = new ArrayList<>();
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.fastbee.ggroup.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 站点对象 g_sites
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-29
|
||||
*/
|
||||
@ApiModel(value = "GSites",description = "站点 g_sites")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GSites extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 站点名称 */
|
||||
@Excel(name = "站点名称")
|
||||
@ApiModelProperty("站点名称")
|
||||
private String name;
|
||||
|
||||
/** 图标 */
|
||||
@Excel(name = "图标")
|
||||
@ApiModelProperty("图标")
|
||||
private String icon;
|
||||
|
||||
/** 类型 */
|
||||
@Excel(name = "类型")
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
/** 空间数据 */
|
||||
@Excel(name = "空间数据")
|
||||
@ApiModelProperty("空间数据")
|
||||
private String space;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.fastbee.ggroup.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GGroupSite {
|
||||
private Long parentId; // 对应 gsg.group_id
|
||||
private String parentName; // 对应 gg.name
|
||||
private Long siteId; // 对应 gsg.site_id
|
||||
private String name; // 对应 gs.name
|
||||
private String icon; // 对应 gs.icon
|
||||
private String type; // 对应 gs.type
|
||||
private String space; // 对应 gs.space
|
||||
|
||||
// Getter 和 Setter
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.fastbee.ggroup.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fastbee.ggroup.domain.GGroups;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSite;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
|
||||
public interface GGroupsMapper extends BaseMapper<GGroups>
|
||||
{
|
||||
/**
|
||||
* 查询组
|
||||
*
|
||||
* @param id 组主键
|
||||
* @return 组
|
||||
*/
|
||||
public GGroups selectGGroupsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组列表
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 组集合
|
||||
*/
|
||||
public List<GGroups> selectGGroupsList(GGroups gGroups);
|
||||
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"select gsg.parent_id as parent_id, gg.name as parent_name, gsg.site_id as siteId, gs.name as name, gs.icon, gs.type, gs.space",
|
||||
"from g_site_groups gsg",
|
||||
"left join g_groups gg on gsg.parent_id = gg.id",
|
||||
"left join g_sites gs on gsg.site_id = gs.id",
|
||||
"where 1=1",
|
||||
"<if test='projectId != null'>",
|
||||
"and gsg.project_id = #{projectId}",
|
||||
"</if>",
|
||||
"<if test='parentId != null'>",
|
||||
"and gsg.parent_id = #{parentId}",
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
List<GGroupSite> selectGGroupsSiteList(GGroups gGroups);
|
||||
|
||||
/**
|
||||
* 新增组
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGGroups(GGroups gGroups);
|
||||
|
||||
/**
|
||||
* 修改组
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGGroups(GGroups gGroups);
|
||||
|
||||
/**
|
||||
* 删除组
|
||||
*
|
||||
* @param id 组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGGroupsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除组
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGGroupsByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.fastbee.ggroup.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
|
||||
/**
|
||||
* 站点Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-29
|
||||
*/
|
||||
public interface GSitesMapper
|
||||
{
|
||||
/**
|
||||
* 查询站点
|
||||
*
|
||||
* @param id 站点主键
|
||||
* @return 站点
|
||||
*/
|
||||
public GSites selectGSitesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询站点列表
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 站点集合
|
||||
*/
|
||||
public List<GSites> selectGSitesList(GSites gSites);
|
||||
|
||||
/**
|
||||
* 新增站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGSites(GSites gSites);
|
||||
|
||||
/**
|
||||
* 修改站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGSites(GSites gSites);
|
||||
|
||||
/**
|
||||
* 删除站点
|
||||
*
|
||||
* @param id 站点主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSitesById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除站点
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSitesByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.fastbee.ggroup.service;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.fastbee.ggroup.domain.GGroups;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSite;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
public interface IGGroupsService
|
||||
{
|
||||
/**
|
||||
* 查询组
|
||||
*
|
||||
* @param id 组主键
|
||||
* @return 组
|
||||
*/
|
||||
public GGroups selectGGroupsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询组列表
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 组集合
|
||||
*/
|
||||
public List<GGroups> selectGGroupsList(GGroups gGroups);
|
||||
|
||||
public List<GGroupSite> selectGGroupsListSites(GGroups gGroups);
|
||||
/**
|
||||
* 新增组
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGGroups(GGroups gGroups);
|
||||
|
||||
/**
|
||||
* 修改组
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGGroups(GGroups gGroups);
|
||||
|
||||
/**
|
||||
* 批量删除组
|
||||
*
|
||||
* @param ids 需要删除的组主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGGroupsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除组信息
|
||||
*
|
||||
* @param id 组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGGroupsById(Long id);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.fastbee.ggroup.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
|
||||
/**
|
||||
* 站点Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-29
|
||||
*/
|
||||
public interface IGSitesService
|
||||
{
|
||||
/**
|
||||
* 查询站点
|
||||
*
|
||||
* @param id 站点主键
|
||||
* @return 站点
|
||||
*/
|
||||
public GSites selectGSitesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询站点列表
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 站点集合
|
||||
*/
|
||||
public List<GSites> selectGSitesList(GSites gSites);
|
||||
|
||||
/**
|
||||
* 新增站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGSites(GSites gSites);
|
||||
|
||||
/**
|
||||
* 修改站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGSites(GSites gSites);
|
||||
|
||||
/**
|
||||
* 批量删除站点
|
||||
*
|
||||
* @param ids 需要删除的站点主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSitesByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除站点信息
|
||||
*
|
||||
* @param id 站点主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSitesById(Long id);
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
package com.fastbee.ggroup.service.impl;
|
||||
|
||||
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.ggroup.domain.GGroups;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSite;
|
||||
import com.fastbee.ggroup.mapper.GGroupsMapper;
|
||||
import com.fastbee.ggroup.service.IGGroupsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 组Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
@Service
|
||||
public class GGroupsServiceImpl implements IGGroupsService
|
||||
{
|
||||
@Autowired
|
||||
private GGroupsMapper gGroupsMapper;
|
||||
|
||||
/**
|
||||
* 查询组
|
||||
*
|
||||
* @param id 组主键
|
||||
* @return 组
|
||||
*/
|
||||
@Override
|
||||
public GGroups selectGGroupsById(Long id)
|
||||
{
|
||||
|
||||
return gGroupsMapper.selectGGroupsById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询组列表
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 组
|
||||
*/
|
||||
@Override
|
||||
public List<GGroups> selectGGroupsList(GGroups gGroups)
|
||||
{
|
||||
|
||||
List<GGroups> groups = gGroupsMapper.selectGGroupsList(gGroups);
|
||||
return buildTree(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GGroupSite> selectGGroupsListSites(GGroups gGroups) {
|
||||
return gGroupsMapper.selectGGroupsSiteList(gGroups);
|
||||
}
|
||||
|
||||
|
||||
private List<GGroups> buildTree(List<GGroups> groups) {
|
||||
Map<Long, GGroups> map = new HashMap<>();
|
||||
List<GGroups> roots = new ArrayList<>();
|
||||
|
||||
for (GGroups group : groups) {
|
||||
map.put(group.getId(), group);
|
||||
}
|
||||
|
||||
for (GGroups group : groups) {
|
||||
Long parentId = group.getParentId();
|
||||
if (parentId == null || !map.containsKey(parentId)) {
|
||||
roots.add(group);
|
||||
} else {
|
||||
GGroups parent = map.get(parentId);
|
||||
if (parent.getChildren() == null) {
|
||||
parent.setChildren(new ArrayList<>());
|
||||
}
|
||||
parent.getChildren().add(group);
|
||||
}
|
||||
}
|
||||
|
||||
return roots;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增组
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGGroups(GGroups gGroups)
|
||||
{
|
||||
gGroups.setCreateTime(DateUtils.getNowDate());
|
||||
return gGroupsMapper.insertGGroups(gGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组
|
||||
*
|
||||
* @param gGroups 组
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateGGroups(GGroups gGroups)
|
||||
{
|
||||
gGroups.setUpdateTime(DateUtils.getNowDate());
|
||||
return gGroupsMapper.updateGGroups(gGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除组
|
||||
*
|
||||
* @param ids 需要删除的组主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGGroupsByIds(Long[] ids)
|
||||
{
|
||||
return gGroupsMapper.deleteGGroupsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组信息
|
||||
*
|
||||
* @param id 组主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGGroupsById(Long id)
|
||||
{
|
||||
return gGroupsMapper.deleteGGroupsById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.fastbee.ggroup.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.ggroup.mapper.GSitesMapper;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
import com.fastbee.ggroup.service.IGSitesService;
|
||||
|
||||
/**
|
||||
* 站点Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-29
|
||||
*/
|
||||
@Service
|
||||
public class GSitesServiceImpl implements IGSitesService
|
||||
{
|
||||
@Autowired
|
||||
private GSitesMapper gSitesMapper;
|
||||
|
||||
/**
|
||||
* 查询站点
|
||||
*
|
||||
* @param id 站点主键
|
||||
* @return 站点
|
||||
*/
|
||||
@Override
|
||||
public GSites selectGSitesById(Long id)
|
||||
{
|
||||
return gSitesMapper.selectGSitesById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点列表
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 站点
|
||||
*/
|
||||
@Override
|
||||
public List<GSites> selectGSitesList(GSites gSites)
|
||||
{
|
||||
return gSitesMapper.selectGSitesList(gSites);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGSites(GSites gSites)
|
||||
{
|
||||
gSites.setCreateTime(DateUtils.getNowDate());
|
||||
return gSitesMapper.insertGSites(gSites);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateGSites(GSites gSites)
|
||||
{
|
||||
gSites.setUpdateTime(DateUtils.getNowDate());
|
||||
return gSitesMapper.updateGSites(gSites);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除站点
|
||||
*
|
||||
* @param ids 需要删除的站点主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGSitesByIds(Long[] ids)
|
||||
{
|
||||
return gSitesMapper.deleteGSitesByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除站点信息
|
||||
*
|
||||
* @param id 站点主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGSitesById(Long id)
|
||||
{
|
||||
return gSitesMapper.deleteGSitesById(id);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user