gis组管理,站点管理相关接口完成
This commit is contained in:
@ -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_site_groups
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-30
|
||||
*/
|
||||
@ApiModel(value = "GSiteGroups",description = "站点组关系 g_site_groups")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GSiteGroups extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 站点id */
|
||||
@Excel(name = "站点id")
|
||||
@ApiModelProperty("站点id")
|
||||
private Long siteId;
|
||||
|
||||
/** 组id(关联表g_group的id) */
|
||||
@Excel(name = "组id(关联表g_group的id)")
|
||||
@ApiModelProperty("组id(关联表g_group的id)")
|
||||
private Long parentId;
|
||||
|
||||
/** 项目id */
|
||||
@Excel(name = "项目id")
|
||||
@ApiModelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
/** 排序 */
|
||||
@Excel(name = "排序")
|
||||
@ApiModelProperty("排序")
|
||||
private Long orderNum;
|
||||
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.fastbee.ggroup.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
@ -23,6 +26,7 @@ public class GSites extends BaseEntity
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 站点名称 */
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.fastbee.ggroup.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GGroupSiteDto {
|
||||
private Long parentId; // 父节点id
|
||||
private String parentName; // 父节点名称
|
||||
private Long siteId; // 站点id
|
||||
private String name; // 站点名称
|
||||
private String icon; // 站点图标
|
||||
private String type; // 站点类型
|
||||
private String space; // 站点空间
|
||||
private Integer orderNum;// 排序
|
||||
private Long projectId;//项目id
|
||||
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
package com.fastbee.ggroup.domain.dto;
|
||||
package com.fastbee.ggroup.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GGroupSite {
|
||||
public class GGroupSiteVo {
|
||||
private Long id; // 对应 gsg.id
|
||||
private Long parentId; // 对应 gsg.group_id
|
||||
private String parentName; // 对应 gg.name
|
||||
private Long siteId; // 对应 gsg.site_id
|
||||
@ -11,6 +12,5 @@ public class GGroupSite {
|
||||
private String icon; // 对应 gs.icon
|
||||
private String type; // 对应 gs.type
|
||||
private String space; // 对应 gs.space
|
||||
|
||||
// Getter 和 Setter
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.fastbee.ggroup.enums;
|
||||
|
||||
public enum GroupTagEnum {
|
||||
RIVERS_LAKES(1, "江河湖泊"),
|
||||
WATER_CONSERVANCY_PROJECTS(2, "水利工程"),
|
||||
MONITORING_STATIONS(3, "检测站点"),
|
||||
OTHER_OBJECTS(4, "其他对象"),
|
||||
WATER_AFFAIRS(5, "水利事务"),
|
||||
ALARM_EVENTS(6, "报警事件");
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
GroupTagEnum(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static GroupTagEnum fromCode(int code) {
|
||||
for (GroupTagEnum tag : GroupTagEnum.values()) {
|
||||
if (tag.getCode() == code) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("No tag found with code: " + code);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ 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 com.fastbee.ggroup.domain.vo.GGroupSiteVo;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
@ -36,7 +36,7 @@ public interface GGroupsMapper extends BaseMapper<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",
|
||||
"select gsg.id ,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",
|
||||
@ -49,7 +49,7 @@ public interface GGroupsMapper extends BaseMapper<GGroups>
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
List<GGroupSite> selectGGroupsSiteList(GGroups gGroups);
|
||||
List<GGroupSiteVo> selectGGroupsSiteList(GGroups gGroups);
|
||||
|
||||
/**
|
||||
* 新增组
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.fastbee.ggroup.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fastbee.ggroup.domain.GSiteGroups;
|
||||
|
||||
/**
|
||||
* 站点组关系Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-09-30
|
||||
*/
|
||||
public interface GSiteGroupsMapper extends BaseMapper<GSiteGroups>
|
||||
{
|
||||
/**
|
||||
* 查询站点组关系
|
||||
*
|
||||
* @param id 站点组关系主键
|
||||
* @return 站点组关系
|
||||
*/
|
||||
public GSiteGroups selectGSiteGroupsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询站点组关系列表
|
||||
*
|
||||
* @param gSiteGroups 站点组关系
|
||||
* @return 站点组关系集合
|
||||
*/
|
||||
public List<GSiteGroups> selectGSiteGroupsList(GSiteGroups gSiteGroups);
|
||||
|
||||
/**
|
||||
* 新增站点组关系
|
||||
*
|
||||
* @param gSiteGroups 站点组关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGSiteGroups(GSiteGroups gSiteGroups);
|
||||
|
||||
/**
|
||||
* 修改站点组关系
|
||||
*
|
||||
* @param gSiteGroups 站点组关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGSiteGroups(GSiteGroups gSiteGroups);
|
||||
|
||||
/**
|
||||
* 删除站点组关系
|
||||
*
|
||||
* @param id 站点组关系主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSiteGroupsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除站点组关系
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSiteGroupsByIds(Long[] ids);
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
package com.fastbee.ggroup.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 站点Mapper接口
|
||||
@ -9,7 +15,7 @@ import com.fastbee.ggroup.domain.GSites;
|
||||
* @author kerwincui
|
||||
* @date 2024-09-29
|
||||
*/
|
||||
public interface GSitesMapper
|
||||
public interface GSitesMapper extends BaseMapper<GSites>
|
||||
{
|
||||
/**
|
||||
* 查询站点
|
||||
@ -30,10 +36,12 @@ public interface GSitesMapper
|
||||
/**
|
||||
* 新增站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @param gGroupSiteDto 站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGSites(GSites gSites);
|
||||
@Insert("insert into g_site_groups (site_id, parent_id, project_id,order_num) " +
|
||||
"value (#{siteId},#{parentId},#{projectId},#{orderNum})")
|
||||
public int insertGSites(GGroupSiteDto gGroupSiteDto);
|
||||
|
||||
/**
|
||||
* 修改站点
|
||||
@ -49,7 +57,9 @@ public interface GSitesMapper
|
||||
* @param id 站点主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGSitesById(Long id);
|
||||
|
||||
// @Delete("delete from g_site_groups where id= #{id}")
|
||||
public int deleteGSitesById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 批量删除站点
|
||||
|
@ -4,7 +4,7 @@ package com.fastbee.ggroup.service;
|
||||
|
||||
|
||||
import com.fastbee.ggroup.domain.GGroups;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSite;
|
||||
import com.fastbee.ggroup.domain.vo.GGroupSiteVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -32,7 +32,7 @@ public interface IGGroupsService
|
||||
*/
|
||||
public List<GGroups> selectGGroupsList(GGroups gGroups);
|
||||
|
||||
public List<GGroupSite> selectGGroupsListSites(GGroups gGroups);
|
||||
public List<GGroupSiteVo> selectGGroupsListSites(GGroups gGroups);
|
||||
/**
|
||||
* 新增组
|
||||
*
|
||||
|
@ -2,6 +2,7 @@ package com.fastbee.ggroup.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.ggroup.domain.GSites;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
|
||||
|
||||
/**
|
||||
* 站点Service接口
|
||||
@ -30,10 +31,10 @@ public interface IGSitesService
|
||||
/**
|
||||
* 新增站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @param gGroupSiteDto 站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGSites(GSites gSites);
|
||||
public int insertGSites(GGroupSiteDto gGroupSiteDto);
|
||||
|
||||
/**
|
||||
* 修改站点
|
||||
|
@ -3,7 +3,7 @@ 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.domain.vo.GGroupSiteVo;
|
||||
import com.fastbee.ggroup.mapper.GGroupsMapper;
|
||||
import com.fastbee.ggroup.service.IGGroupsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -57,7 +57,7 @@ public class GGroupsServiceImpl implements IGGroupsService
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GGroupSite> selectGGroupsListSites(GGroups gGroups) {
|
||||
public List<GGroupSiteVo> selectGGroupsListSites(GGroups gGroups) {
|
||||
return gGroupsMapper.selectGGroupsSiteList(gGroups);
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,15 @@ package com.fastbee.ggroup.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.ggroup.domain.GSiteGroups;
|
||||
import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
|
||||
import com.fastbee.ggroup.mapper.GSiteGroupsMapper;
|
||||
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;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 站点Service业务层处理
|
||||
@ -20,6 +24,9 @@ public class GSitesServiceImpl implements IGSitesService
|
||||
@Autowired
|
||||
private GSitesMapper gSitesMapper;
|
||||
|
||||
@Autowired
|
||||
private GSiteGroupsMapper gSiteGroupsMapper;
|
||||
|
||||
/**
|
||||
* 查询站点
|
||||
*
|
||||
@ -47,14 +54,22 @@ public class GSitesServiceImpl implements IGSitesService
|
||||
/**
|
||||
* 新增站点
|
||||
*
|
||||
* @param gSites 站点
|
||||
* @param gGroupSiteDto 站点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGSites(GSites gSites)
|
||||
{
|
||||
gSites.setCreateTime(DateUtils.getNowDate());
|
||||
return gSitesMapper.insertGSites(gSites);
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertGSites(GGroupSiteDto gGroupSiteDto)
|
||||
{ //更新关系表
|
||||
GSites gSites = new GSites();
|
||||
gSites.setName(gGroupSiteDto.getName());
|
||||
gSites.setType(gGroupSiteDto.getType());
|
||||
gSites.setIcon(gGroupSiteDto.getIcon());
|
||||
|
||||
int inserted = gSitesMapper.insert(gSites);
|
||||
gGroupSiteDto.setSiteId(gSites.getId());
|
||||
int inserted1 = gSitesMapper.insertGSites(gGroupSiteDto);
|
||||
return inserted==1&&inserted1==1?1:0 ;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +82,7 @@ public class GSitesServiceImpl implements IGSitesService
|
||||
public int updateGSites(GSites gSites)
|
||||
{
|
||||
gSites.setUpdateTime(DateUtils.getNowDate());
|
||||
return gSitesMapper.updateGSites(gSites);
|
||||
return gSitesMapper.updateById(gSites);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +104,16 @@ public class GSitesServiceImpl implements IGSitesService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteGSitesById(Long id)
|
||||
{
|
||||
return gSitesMapper.deleteGSitesById(id);
|
||||
GSiteGroups gSiteGroups =gSiteGroupsMapper.selectGSiteGroupsById(id);
|
||||
if(gSiteGroups==null){
|
||||
throw new RuntimeException("站点不存在");
|
||||
}
|
||||
int deleted= gSitesMapper.deleteById(gSiteGroups.getId());
|
||||
//删除关系
|
||||
int deleted1=gSiteGroupsMapper.deleteById(id);
|
||||
return deleted==1&&deleted1==1?1:0 ;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user