查询项目信息接口,完善接口逻辑逻辑等
This commit is contained in:
@ -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;
|
||||
}
|
@ -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">
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||
* @author kerwincui
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
public interface ProjectMapper
|
||||
public interface ProjectMapper extends BaseMapper<Project>
|
||||
{
|
||||
/**
|
||||
* 查询项目
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user