查询项目信息接口,完善接口逻辑逻辑等

This commit is contained in:
mi9688
2024-10-16 18:00:59 +08:00
parent 834cfc3e7d
commit 0fb3e4bd8d
12 changed files with 123 additions and 59 deletions

View File

@ -28,6 +28,7 @@ import static java.util.stream.Collectors.toList;
@RestController
@RequestMapping("/gis/groups")
@Api(tags = "")
@PreAuthorize("@ss.hasPermi('ggroup:groups')")
public class GGroupsController extends BaseController
{
@Autowired
@ -36,7 +37,6 @@ public class GGroupsController extends BaseController
/**
* 查询组树状结构列表
*/
@PreAuthorize("@ss.hasPermi('iot:groups:list')")
@GetMapping("/list")
@ApiOperation("查询组列表")
public AjaxResult list(GGroups gGroups)
@ -46,7 +46,6 @@ public class GGroupsController extends BaseController
/**
* 查询组带叶子节点树状列表
*/
@PreAuthorize("@ss.hasPermi('iot:groups:list')")
@GetMapping("/list-with-leaf")
@ApiOperation("查询组带叶子节点树状列表")
public AjaxResult listWithLeaf(GGroups gGroups){
@ -57,7 +56,6 @@ public class GGroupsController extends BaseController
/**
* 查询组下面的直属站点
*/
@PreAuthorize("@ss.hasPermi('iot:groups:listSite')")
@GetMapping("/list-site")
@ApiOperation("查询组下面的直属站点")
public TableDataInfo listSite(GGroups gGroups)
@ -71,7 +69,6 @@ public class GGroupsController extends BaseController
/**
* 获取组的标签(类别)
*/
@PreAuthorize("@ss.hasPermi('iot:groups:list')")
@GetMapping("/list-label")
@ApiOperation("获取组的标签(类别)")
public AjaxResult listLabel() {
@ -92,7 +89,6 @@ public class GGroupsController extends BaseController
* 导出组列表
*/
@ApiOperation("导出组列表")
@PreAuthorize("@ss.hasPermi('iot:groups:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, GGroups gGroups)
{
@ -104,7 +100,6 @@ public class GGroupsController extends BaseController
/**
* 获取组详细信息
*/
@PreAuthorize("@ss.hasPermi('iot:groups:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取组详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
@ -115,7 +110,6 @@ public class GGroupsController extends BaseController
/**
* 新增组
*/
@PreAuthorize("@ss.hasPermi('iot:groups:add')")
@PostMapping
@ApiOperation("新增组")
public AjaxResult add(@RequestBody GGroups gGroups)
@ -126,7 +120,6 @@ public class GGroupsController extends BaseController
/**
* 修改组
*/
@PreAuthorize("@ss.hasPermi('iot:groups:edit')")
@PutMapping
@ApiOperation("修改组")
public AjaxResult edit(@RequestBody GGroups gGroups)
@ -137,7 +130,6 @@ public class GGroupsController extends BaseController
/**
* 删除组
*/
@PreAuthorize("@ss.hasPermi('iot:groups:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除组")
public AjaxResult remove(@PathVariable Long[] ids)

View File

@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/gis/legend")
@Api(tags = "图例")
@PreAuthorize("@ss.hasPermi('ggroup:legend')")
public class GLegendController extends BaseController
{
@Autowired
@ -46,7 +47,6 @@ public class GLegendController extends BaseController
/**
* 查询/搜索图例列表
*/
@PreAuthorize("@ss.hasPermi('ggroup:legend:list')")
@GetMapping("/list")
@ApiOperation("查询图例列表")
public TableDataInfo list(GLegend gLegend)
@ -60,7 +60,6 @@ public class GLegendController extends BaseController
* 导出图例列表
*/
@ApiOperation("导出图例列表")
@PreAuthorize("@ss.hasPermi('ggroup:legend:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, GLegend gLegend)
{
@ -72,7 +71,6 @@ public class GLegendController extends BaseController
/**
* 获取图例详细信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:legend:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取图例详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
@ -83,7 +81,6 @@ public class GLegendController extends BaseController
/**
* 新增图例
*/
@PreAuthorize("@ss.hasPermi('ggroup:legend:add')")
@PostMapping
@ApiOperation("新增图例")
public AjaxResult add(@RequestBody GLegend gLegend)
@ -94,7 +91,6 @@ public class GLegendController extends BaseController
/**
* 修改图例
*/
@PreAuthorize("@ss.hasPermi('ggroup:legend:edit')")
@PutMapping
@ApiOperation("修改图例")
public AjaxResult edit(@RequestBody GLegend gLegend)
@ -105,7 +101,6 @@ public class GLegendController extends BaseController
/**
* 删除图例
*/
@PreAuthorize("@ss.hasPermi('ggroup:legend:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除图例")
public AjaxResult remove(@PathVariable Long[] ids)
@ -116,7 +111,6 @@ public class GLegendController extends BaseController
/**
* 获取图例按照类别划分列表
*/
@PreAuthorize("@ss.hasPermi('ggroup:legend:list')")
@GetMapping("/category-list")
@ApiOperation("获取图例按照类别划分列表")
public AjaxResult listByCategory(GLegend gLegend){
@ -126,7 +120,6 @@ public class GLegendController extends BaseController
/**
*获取图例的类别列表
*/
@PreAuthorize("@ss.hasPermi('ggroup:type:category')")
@GetMapping(value = "/category/list")
@ApiOperation("获取图例的类别列表")
public AjaxResult typeList()

View File

@ -32,6 +32,7 @@ import com.fastbee.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/gis/site/info")
@PreAuthorize("@ss.hasPermi('ggroup:groups')")
@Api(tags = "站点基础信息")
public class GSiteInfoController extends BaseController
{
@ -41,7 +42,6 @@ public class GSiteInfoController extends BaseController
/**
* 查询站点基础信息列表
*/
@PreAuthorize("@ss.hasPermi('ggroup:info:list')")
@GetMapping("/list")
@ApiOperation("查询站点基础信息列表")
public TableDataInfo list(GSiteInfo gSiteInfo)
@ -55,7 +55,6 @@ public class GSiteInfoController extends BaseController
* 导出站点基础信息列表
*/
@ApiOperation("导出站点基础信息列表")
@PreAuthorize("@ss.hasPermi('ggroup:info:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, GSiteInfo gSiteInfo)
{
@ -67,7 +66,6 @@ public class GSiteInfoController extends BaseController
/**
* 获取站点基础信息详细信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:info:query')")
@GetMapping(value = "/{siteId}")
@ApiOperation("获取站点基础信息详细信息")
public AjaxResult getInfo(@PathVariable("siteId") Long siteId)
@ -78,7 +76,6 @@ public class GSiteInfoController extends BaseController
/**
* 新增站点基础信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:info:add')")
@PostMapping
@ApiOperation("新增站点基础信息")
public AjaxResult add(@RequestBody GSiteInfo gSiteInfo)
@ -89,7 +86,6 @@ public class GSiteInfoController extends BaseController
/**
* 修改站点基础信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:info:edit')")
@PutMapping
@ApiOperation("修改站点基础信息")
public AjaxResult edit(@RequestBody GSiteInfo gSiteInfo)
@ -100,7 +96,6 @@ public class GSiteInfoController extends BaseController
/**
* 删除站点基础信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:info:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除站点基础信息")
public AjaxResult remove(@PathVariable Long[] ids)

View File

@ -37,6 +37,7 @@ import com.fastbee.common.core.page.TableDataInfo;
@RestController
@RequestMapping("/gis/sites")
@Api(tags = "站点")
@PreAuthorize("@ss.hasPermi('ggroup:groups')")
public class GSitesController extends BaseController
{
@Autowired
@ -45,7 +46,7 @@ public class GSitesController extends BaseController
/**
* 查询/搜索站点列表
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:list')")
@GetMapping("/list")
@ApiOperation("查询站点列表")
public TableDataInfo list(GSitesSelectDto gSites)
@ -58,7 +59,7 @@ public class GSitesController extends BaseController
/**
* 站点关联组
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:relate')")
@PostMapping("/relate")
@ApiOperation("站点关联组")
public AjaxResult relate(@RequestBody GGroupSiteRelateDto gGroupSiteRelateDto){
@ -81,7 +82,6 @@ public class GSitesController extends BaseController
/**
* 获取站点详细信息
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取站点详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
@ -92,7 +92,6 @@ public class GSitesController extends BaseController
/**
* 新增站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:add')")
@PostMapping
@ApiOperation("新增站点")
public AjaxResult add(@RequestBody GGroupSiteDto gGroupSiteDto)
@ -103,7 +102,6 @@ public class GSitesController extends BaseController
/**
* 修改站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:edit')")
@PutMapping
@ApiOperation("修改站点")
public AjaxResult edit(@RequestBody GSitesEditDto gSitesEditDto)
@ -114,7 +112,6 @@ public class GSitesController extends BaseController
/**
* 根据id删除站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:remove')")
@DeleteMapping("/{id}")
@ApiOperation("根据id删除站点")
public AjaxResult remove(@PathVariable Long id){
@ -125,7 +122,6 @@ public class GSitesController extends BaseController
/**
* 删除站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:remove')")
@DeleteMapping("/batch/{ids}")
@ApiOperation("删除站点")
public AjaxResult remove(@PathVariable Long[] ids)
@ -136,7 +132,6 @@ public class GSitesController extends BaseController
/**
* 搜索站点
*/
@PreAuthorize("@ss.hasPermi('ggroup:sites:search')")
@GetMapping("/search")
@ApiOperation("搜索站点")
public TableDataInfo search(GSites gSites){

View File

@ -50,6 +50,16 @@ public class ProjectController extends BaseController
return getDataTable(list);
}
/**
* 获取项目信息
*/
// @PreAuthorize("@ss.hasPermi('iot:project:query')")
@GetMapping("/info/{userId}")
@ApiOperation("获取项目信息")
public AjaxResult getProjectInfo(@PathVariable("userId") Long userId){
return success(projectService.selectProjectByUserId(userId));
}
/**
* 导出项目列表
*/

View File

@ -18,36 +18,35 @@ import java.util.Map;
* @date 2024-09-29
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "GSites",description = "站点 g_sites")
@ApiModel(value = "GSites", description = "站点 g_sites")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GSites extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class GSites extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 站点名称 */
@Excel(name = "站点名称")
@ApiModelProperty("站点名称")
@Excel(name = "站点名称")
@ApiModelProperty("站点名称")
private String name;
/** 图标 */
@Excel(name = "图标")
@ApiModelProperty("图标")
@Excel(name = "图标")
@ApiModelProperty("图标")
private String icon;
/** 类型 */
@Excel(name = "类型")
@ApiModelProperty("类型")
@Excel(name = "类型")
@ApiModelProperty("类型")
private String type;
/** 空间数据 */
@Excel(name = "空间数据")
@ApiModelProperty("空间数据")
@Excel(name = "空间数据")
@ApiModelProperty("空间数据")
private String space;
/** 项目id */
@ -55,6 +54,18 @@ private static final long serialVersionUID = 1L;
@ApiModelProperty("项目id")
private Long projectId;
/** 空间值 */
@Excel(name = "空间值")
@ApiModelProperty("空间值")
private String spaceValue;
/** 关联的数据设备 */
@Excel(name = "关联的数据设备")
@ApiModelProperty("关联的数据设备")
private String dataDevices;
/** 关联的视频设备 */
@Excel(name = "关联的视频设备")
@ApiModelProperty("关联的视频设备")
private String videoDevices;
}

View File

@ -14,10 +14,14 @@
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="space" column="space" />
<result property="projectId" column="project_id" />
<result property="spaceValue" column="space_value" />
<result property="dataDevices" column="data_devices" />
<result property="videoDevices" column="video_devices" />
</resultMap>
<sql id="selectGSitesVo">
select id, name, icon, type, create_by, create_time, update_time, update_by, space from g_sites
select id, name, icon, type, create_by, create_time, update_time, update_by, space, project_id, space_value, data_devices, video_devices from g_sites
</sql>
<select id="selectGSitesList" parameterType="GSites" resultMap="GSitesResult">
@ -26,9 +30,11 @@
<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="projectId != null and projectId != ''"> and space = #{projectId}</if>
<if test="space != null and space != ''"> and space = #{space}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="spaceValue != null and spaceValue != ''"> and space_value = #{spaceValue}</if>
<if test="dataDevices != null and dataDevices != ''"> and data_devices = #{dataDevices}</if>
<if test="videoDevices != null and videoDevices != ''"> and video_devices = #{videoDevices}</if>
</where>
</select>
@ -48,7 +54,10 @@
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="space != null">space,</if>
<if test="spaceValue != null">spaceValue,</if>
<if test="projectId != null">project_id,</if>
<if test="spaceValue != null">space_value,</if>
<if test="dataDevices != null">data_devices,</if>
<if test="videoDevices != null">video_devices,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
@ -59,11 +68,14 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="space != null">#{space},</if>
<if test="projectId != null">#{projectId},</if>
<if test="spaceValue != null">#{spaceValue},</if>
<if test="dataDevices != null">#{dataDevices},</if>
<if test="videoDevices != null">#{videoDevices},</if>
</trim>
</insert>
<update id="updateGSites" parameterType="GSitesEditDto">
<update id="updateGSites" parameterType="GSites">
update g_sites
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
@ -74,13 +86,16 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="space != null">space = #{space},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="spaceValue != null">space_value = #{spaceValue},</if>
<if test="dataDevices != null">data_devices = #{dataDevices},</if>
<if test="videoDevices != null">video_devices = #{videoDevices},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGSitesById" parameterType="Long">
delete from g_site_groups where id = #{id}
delete from g_sites where id = #{id}
</delete>
<delete id="deleteGSitesByIds" parameterType="String">

View File

@ -1,21 +1,21 @@
package com.fastbee.project.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 lombok.EqualsAndHashCode;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 项目对象 project
*
* @author kerwincui
* @date 2024-09-26
* @date 2024-10-16
*/
@ApiModel(value = "Project",description = "项目 project")
@Data
@EqualsAndHashCode(callSuper = true)
public class Project extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -25,46 +25,57 @@ public class Project extends BaseEntity
/** 项目名称 */
@Excel(name = "项目名称")
@ApiModelProperty("项目名称")
private String projectName;
/** 系统显示名称 */
@Excel(name = "系统显示名称")
@ApiModelProperty("系统显示名称")
private String sysShowName;
/** 中心坐标 */
@Excel(name = "中心坐标")
@ApiModelProperty("中心坐标")
private String centralCoordinates;
/** 项目范围(经纬度) */
@Excel(name = "项目范围(经纬度)")
@ApiModelProperty("项目范围(经纬度)")
private String scope;
/** 行政区域 */
@Excel(name = "行政区域")
@ApiModelProperty("行政区域")
private String administrativeArea;
/** 项目拥有人 */
@Excel(name = "项目拥有人")
@ApiModelProperty("项目拥有人")
private String owner;
/** 项目logo */
@Excel(name = "项目logo")
@ApiModelProperty("项目logo")
private String logo;
/** 项目图片 */
@Excel(name = "项目图片")
@ApiModelProperty("项目图片")
private String image;
/** 园区视频介绍 */
@Excel(name = "园区视频介绍")
@ApiModelProperty("园区视频介绍")
private String videoIntroduction;
/** 项目参数 */
@Excel(name = "项目参数")
@ApiModelProperty("项目参数")
private String pParams;
/** 项目介绍 */
@Excel(name = "项目介绍")
@ApiModelProperty("项目介绍")
private String introduce;
/** 删除状态[1删除,-1未删除] */
@ -72,14 +83,22 @@ public class Project extends BaseEntity
/** 项目介绍 */
@Excel(name = "项目介绍")
@ApiModelProperty("项目介绍")
private String remarks;
/** 租户id */
@Excel(name = "租户id")
@ApiModelProperty("租户id")
private Long tenantId;
/** 租户名称 */
@Excel(name = "租户名称")
@ApiModelProperty("租户名称")
private String tenantName;
/** 负责人id */
@Excel(name = "负责人id")
@ApiModelProperty("负责人id")
private Long ownerId;
}

View File

@ -13,7 +13,7 @@ import java.util.List;
* @author kerwincui
* @date 2024-09-26
*/
public interface ProjectMapper
public interface ProjectMapper extends BaseMapper<Project>
{
/**
* 查询项目

View File

@ -3,6 +3,7 @@ package com.fastbee.project.service;
import com.fastbee.project.domain.Project;
import java.util.List;
import java.util.Map;
/**
* 项目Service接口
@ -59,4 +60,7 @@ public interface IProjectService
* @return 结果
*/
public int deleteProjectByProjectId(Long projectId);
Map<String,Object> selectProjectByUserId(Long userId);
}

View File

@ -1,5 +1,6 @@
package com.fastbee.project.service.impl;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.project.domain.Project;
import com.fastbee.project.mapper.ProjectMapper;
@ -8,7 +9,10 @@ import com.fastbee.project.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 项目Service业务层处理
@ -95,5 +99,26 @@ public class ProjectServiceImpl implements IProjectService
{
return projectMapper.deleteProjectByProjectId(projectId);
}
/**
* 查询项目基本信息
* @param userId 管理员id
* @return 结果
*/
@Override
public Map<String, Object> selectProjectByUserId(Long userId) {
Project project = new LambdaQueryChainWrapper<>(projectMapper)
.select(Project::getProjectId, Project::getProjectName)
.eq(Project::getOwnerId, userId)
.one();
HashMap<String , Object> map = new HashMap<>();
if(Objects.isNull(project)){
return null;
}
map.put("projectId", project.getProjectId());
map.put("projectName", project.getProjectName());
return map;
}
}

View File

@ -25,10 +25,11 @@
<result property="remarks" column="remarks" />
<result property="tenantId" column="tenant_id" />
<result property="tenantName" column="tenant_name" />
<result property="ownerId" column="owner_id" />
</resultMap>
<sql id="selectProjectVo">
select project_id, project_name, sys_show_name, central_coordinates, scope, administrative_area, owner, logo, image, video_introduction, remark, p_params, introduce, del_flag, create_time, create_by, update_time, remarks, tenant_id, tenant_name from project
select project_id, project_name, sys_show_name, central_coordinates, scope, administrative_area, owner, logo, image, video_introduction, remark, p_params, introduce, del_flag, create_time, create_by, update_time, remarks, tenant_id, tenant_name, owner_id from project
</sql>
<select id="selectProjectList" parameterType="Project" resultMap="ProjectResult">
@ -48,6 +49,7 @@
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
<if test="ownerId != null "> and owner_id = #{ownerId}</if>
</where>
</select>
@ -79,6 +81,7 @@
<if test="remarks != null">remarks,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="tenantName != null">tenant_name,</if>
<if test="ownerId != null">owner_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
@ -101,6 +104,7 @@
<if test="remarks != null">#{remarks},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="tenantName != null">#{tenantName},</if>
<if test="ownerId != null">#{ownerId},</if>
</trim>
</insert>
@ -126,6 +130,7 @@
<if test="remarks != null">remarks = #{remarks},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="tenantName != null">tenant_name = #{tenantName},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
</trim>
where project_id = #{projectId}
</update>