gis组管理,站点管理部分接口

This commit is contained in:
mi9688
2024-09-29 17:41:43 +08:00
parent 162a40aa62
commit 53097c8cf6
20 changed files with 1125 additions and 30 deletions

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fastbee</groupId>
<artifactId>fastbee-service</artifactId>
<version>3.8.5</version>
</parent>
<artifactId>fastbee-ggroup-service</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.fastbee</groupId>
<artifactId>fastbee-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -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<>();
}

View File

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

View File

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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fastbee.ggroup.mapper.GGroupsMapper">
<resultMap type="GGroups" id="GGroupsResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="icon" column="icon" />
<result property="tag" column="tag" />
<result property="parentId" column="parent_id" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="orderNum" column="order_num" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="space" column="space" />
</resultMap>
<resultMap id="GGroupsSiteResult" type="GGroupSite" >
<result property="parentId" column="group_id" />
<result property="parentName" column="group_name" />
<result property="siteId" column="id" />
<result property="siteName" column="name" />
<result property="icon" column="icon" />
<result property="type" column="type" />
<result property="space" column="space" />
</resultMap>
<sql id="selectGGroupsVo">
select id, name, icon, tag, parent_id, project_id, project_name, order_num, create_by, create_time, update_time, update_by, space from g_groups
</sql>
<!-- 查询组结构列表 -->
<select id="selectGGroupsList" parameterType="GGroups" resultMap="GGroupsResult">
<include refid="selectGGroupsVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
</where>
</select>
<!-- <select id="selectGGroupsSiteList" parameterType="GGroups" resultMap="" >-->
<!-- </select>-->
<select id="selectGGroupsById" parameterType="Long" resultMap="GGroupsResult">
<include refid="selectGGroupsVo"/>
where id = #{id}
</select>
<insert id="insertGGroups" parameterType="GGroups" useGeneratedKeys="true" keyProperty="id">
insert into g_groups
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="icon != null">icon,</if>
<if test="tag != null">tag,</if>
<if test="parentId != null">parent_id,</if>
<if test="projectId != null">project_id,</if>
<if test="projectName != null">project_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="space != null">space,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="icon != null">#{icon},</if>
<if test="tag != null">#{tag},</if>
<if test="parentId != null">#{parentId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="projectName != null">#{projectName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="space != null">#{space},</if>
</trim>
</insert>
<update id="updateGGroups" parameterType="GGroups">
update g_groups
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="tag != null">tag = #{tag},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="projectName != null">project_name = #{projectName},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="space != null">space = #{space},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGGroupsById" parameterType="Long">
delete from g_groups where id = #{id}
</delete>
<delete id="deleteGGroupsByIds" parameterType="String">
delete from g_groups where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fastbee.ggroup.mapper.GSitesMapper">
<resultMap type="GSites" id="GSitesResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="icon" column="icon" />
<result property="type" column="type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="space" column="space" />
</resultMap>
<sql id="selectGSitesVo">
select id, name, icon, type, create_by, create_time, update_time, update_by, space from g_sites
</sql>
<select id="selectGSitesList" parameterType="GSites" resultMap="GSitesResult">
<include refid="selectGSitesVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="space != null and space != ''"> and space = #{space}</if>
</where>
</select>
<select id="selectGSitesById" parameterType="Long" resultMap="GSitesResult">
<include refid="selectGSitesVo"/>
where id = #{id}
</select>
<insert id="insertGSites" parameterType="GSites" useGeneratedKeys="true" keyProperty="id">
insert into g_sites
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="icon != null">icon,</if>
<if test="type != null">type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="space != null">space,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="icon != null">#{icon},</if>
<if test="type != null">#{type},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="space != null">#{space},</if>
</trim>
</insert>
<update id="updateGSites" parameterType="GSites">
update g_sites
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="type != null">type = #{type},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="space != null">space = #{space},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGSitesById" parameterType="Long">
delete from g_sites where id = #{id}
</delete>
<delete id="deleteGSitesByIds" parameterType="String">
delete from g_sites where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,4 @@
public class Text {
}