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

@ -1,5 +1,7 @@
package com.fastbee.common.core.domain; package com.fastbee.common.core.domain;
import lombok.Getter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -8,6 +10,7 @@ import java.util.List;
* *
* @author ruoyi * @author ruoyi
*/ */
@Getter
public class TreeEntity extends BaseEntity public class TreeEntity extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -27,51 +30,26 @@ public class TreeEntity extends BaseEntity
/** 子部门 */ /** 子部门 */
private List<?> children = new ArrayList<>(); private List<?> children = new ArrayList<>();
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName) public void setParentName(String parentName)
{ {
this.parentName = parentName; this.parentName = parentName;
} }
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId) public void setParentId(Long parentId)
{ {
this.parentId = parentId; this.parentId = parentId;
} }
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum) public void setOrderNum(Integer orderNum)
{ {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getAncestors()
{
return ancestors;
}
public void setAncestors(String ancestors) public void setAncestors(String ancestors)
{ {
this.ancestors = ancestors; this.ancestors = ancestors;
} }
public List<?> getChildren()
{
return children;
}
public void setChildren(List<?> children) public void setChildren(List<?> children)
{ {
this.children = children; this.children = children;

View File

@ -24,7 +24,7 @@ public class CodeGenerator {
String password = "rtB8EhbRRYSGyxHw"; String password = "rtB8EhbRRYSGyxHw";
//TODO 修改为自己的表名 //TODO 修改为自己的表名
List<String> tables = new ArrayList<>();//需要生成对应代码的表名的集合 List<String> tables = new ArrayList<>();//需要生成对应代码的表名的集合
tables.add("project"); tables.add("g_groups");
FastAutoGenerator.create(url, username, password) FastAutoGenerator.create(url, username, password)
//全局配置---------------------------------------------------------------------------------------- //全局配置----------------------------------------------------------------------------------------
@ -81,8 +81,6 @@ public class CodeGenerator {
.formatFileName("%sController") .formatFileName("%sController")
// .enableFileOverride()// TODO 开启覆盖已生成的controller文件(谨慎开启),关闭则注释本行 // .enableFileOverride()// TODO 开启覆盖已生成的controller文件(谨慎开启),关闭则注释本行
.enableRestStyle();//启用rest风格自动添加@RestController .enableRestStyle();//启用rest风格自动添加@RestController
}) })
.execute(); .execute();

View File

@ -48,8 +48,14 @@
<version>3.8.5</version> <version>3.8.5</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.fastbee</groupId>
<artifactId>fastbee-ggroup-service</artifactId>
<version>3.8.5</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.fastbee</groupId>--> <!-- <groupId>com.fastbee</groupId>-->
<!-- <artifactId>fastbee-project-service</artifactId>--> <!-- <artifactId>fastbee-project-service</artifactId>-->
<!-- </dependency>--> <!-- </dependency>-->

View File

@ -0,0 +1,114 @@
package com.fastbee.data.controller.gis;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.core.page.TableDataInfo;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.ggroup.domain.GGroups;
import com.fastbee.ggroup.domain.dto.GGroupSite;
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.List;
/**
* 组Controller
*
* @author kerwincui
* @date 2024-09-27
*/
@RestController
@RequestMapping("/gis/groups")
@Api(tags = "")
public class GGroupsController extends BaseController
{
@Autowired
private IGGroupsService gGroupsService;
/**
* 查询组列表
*/
@PreAuthorize("@ss.hasPermi('iot:groups:list')")
@GetMapping("/list")
@ApiOperation("查询组列表")
public AjaxResult list(GGroups gGroups)
{
List<GGroups> list = gGroupsService.selectGGroupsList(gGroups);
return success(list);
}
/**
* 查询组下面的直属站点
*/
@PreAuthorize("@ss.hasPermi('iot:groups:listSite')")
@GetMapping("/list-site")
@ApiOperation("查询组下面的直属站点")
public TableDataInfo listSite(GGroups gGroups)
{
super.startPage();
List<GGroupSite> list = gGroupsService.selectGGroupsListSites(gGroups);
return super.getDataTable(list);
}
/**
* 导出组列表
*/
@ApiOperation("导出组列表")
@PreAuthorize("@ss.hasPermi('iot:groups:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, GGroups gGroups)
{
List<GGroups> list = gGroupsService.selectGGroupsList(gGroups);
ExcelUtil<GGroups> util = new ExcelUtil<GGroups>(GGroups.class);
util.exportExcel(response, list, "组数据");
}
/**
* 获取组详细信息
*/
@PreAuthorize("@ss.hasPermi('iot:groups:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取组详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(gGroupsService.selectGGroupsById(id));
}
/**
* 新增组
*/
@PreAuthorize("@ss.hasPermi('iot:groups:add')")
@PostMapping
@ApiOperation("新增组")
public AjaxResult add(@RequestBody GGroups gGroups)
{
return toAjax(gGroupsService.insertGGroups(gGroups));
}
/**
* 修改组
*/
@PreAuthorize("@ss.hasPermi('iot:groups:edit')")
@PutMapping
@ApiOperation("修改组")
public AjaxResult edit(@RequestBody GGroups gGroups)
{
return toAjax(gGroupsService.updateGGroups(gGroups));
}
/**
* 删除组
*/
@PreAuthorize("@ss.hasPermi('iot:groups:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除组")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(gGroupsService.deleteGGroupsByIds(ids));
}
}

View File

@ -0,0 +1,110 @@
package com.fastbee.data.controller.gis;
import java.util.List;
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;
import org.springframework.web.bind.annotation.DeleteMapping;
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;
/**
* 站点Controller
*
* @author kerwincui
* @date 2024-09-29
*/
@RestController
@RequestMapping("/gis/sites")
@Api(tags = "站点")
public class GSitesController extends BaseController
{
@Autowired
private IGSitesService gSitesService;
/**
* 查询站点列表
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:list')")
@GetMapping("/list")
@ApiOperation("查询站点列表")
public TableDataInfo list(GSites gSites)
{
startPage();
List<GSites> list = gSitesService.selectGSitesList(gSites);
return getDataTable(list);
}
/**
* 导出站点列表
*/
@ApiOperation("导出站点列表")
@PreAuthorize("@ss.hasPermi('ggroup:sites:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, GSites gSites)
{
List<GSites> list = gSitesService.selectGSitesList(gSites);
ExcelUtil<GSites> util = new ExcelUtil<GSites>(GSites.class);
util.exportExcel(response, list, "站点数据");
}
/**
* 获取站点详细信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取站点详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(gSitesService.selectGSitesById(id));
}
/**
* 新增站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:add')")
@PostMapping
@ApiOperation("新增站点")
public AjaxResult add(@RequestBody GSites gSites)
{
return toAjax(gSitesService.insertGSites(gSites));
}
/**
* 修改站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:edit')")
@PutMapping
@ApiOperation("修改站点")
public AjaxResult edit(@RequestBody GSites gSites)
{
return toAjax(gSitesService.updateGSites(gSites));
}
/**
* 删除站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除站点")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(gSitesService.deleteGSitesByIds(ids));
}
}

View File

@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult; import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.core.page.TableDataInfo; import com.fastbee.common.core.page.TableDataInfo;

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

View File

@ -18,6 +18,7 @@
<module>fastbee-xunjian-service</module> <module>fastbee-xunjian-service</module>
<module>fastbee-waterele-service</module> <module>fastbee-waterele-service</module>
<module>fastbee-project-service</module> <module>fastbee-project-service</module>
<module>fastbee-ggroup-service</module>
</modules> </modules>