站点搜索接口,图例管理,mybatis-plus连表插件整合,零碎修改等

This commit is contained in:
mi9688
2024-10-09 15:03:18 +08:00
parent b66357dd77
commit 04def663c1
21 changed files with 568 additions and 28 deletions

View File

@ -0,0 +1,41 @@
package com.fastbee.ggroup.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
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_legend_type
*
* @author kerwincui
* @date 2024-10-09
*/
@ApiModel(value = "GLegendType",description = "图例类型 g_legend_type")
@Data
public class GLegendType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 图例类型名称 */
@Excel(name = "图例类型名称")
@ApiModelProperty("图例类型名称")
private String typeName;
/** 图例类型描述 */
@Excel(name = "图例类型描述")
@ApiModelProperty("图例类型描述")
private String description;
/** 类别 */
@Excel(name = "类别")
@ApiModelProperty("类别")
private String category;
}

View File

@ -0,0 +1,24 @@
package com.fastbee.ggroup.domain.dto;
import com.fastbee.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GLegendDto {
/** 主键id */
private Long id;
/** 图标 */
private String icon;
/** 类型 */
private Long type;
/** 图标名称 */
private String name;
/** 项目id */
private Long projectId;
/** 图例类型名称 */
private String typeName;
/** 类别 */
private String category;
}

View File

@ -2,6 +2,7 @@ package com.fastbee.ggroup.mapper;
import java.util.List;
import com.fastbee.ggroup.domain.GLegend;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 图例Mapper接口
@ -9,7 +10,7 @@ import com.fastbee.ggroup.domain.GLegend;
* @author kerwincui
* @date 2024-10-08
*/
public interface GLegendMapper
public interface GLegendMapper extends MPJBaseMapper<GLegend>
{
/**
* 查询图例

View File

@ -0,0 +1,62 @@
package com.fastbee.ggroup.mapper;
import java.util.List;
import com.fastbee.ggroup.domain.GLegendType;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 图例类型Mapper接口
*
* @author kerwincui
* @date 2024-10-09
*/
public interface GLegendTypeMapper extends MPJBaseMapper<GLegendType>
{
/**
* 查询图例类型
*
* @param id 图例类型主键
* @return 图例类型
*/
public GLegendType selectGLegendTypeById(Long id);
/**
* 查询图例类型列表
*
* @param gLegendType 图例类型
* @return 图例类型集合
*/
public List<GLegendType> selectGLegendTypeList(GLegendType gLegendType);
/**
* 新增图例类型
*
* @param gLegendType 图例类型
* @return 结果
*/
public int insertGLegendType(GLegendType gLegendType);
/**
* 修改图例类型
*
* @param gLegendType 图例类型
* @return 结果
*/
public int updateGLegendType(GLegendType gLegendType);
/**
* 删除图例类型
*
* @param id 图例类型主键
* @return 结果
*/
public int deleteGLegendTypeById(Long id);
/**
* 批量删除图例类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGLegendTypeByIds(Long[] ids);
}

View File

@ -2,10 +2,9 @@ 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 com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
@ -15,7 +14,7 @@ import org.apache.ibatis.annotations.Param;
* @author kerwincui
* @date 2024-09-29
*/
public interface GSitesMapper extends BaseMapper<GSites>
public interface GSitesMapper extends MPJBaseMapper<GSites>
{
/**
* 查询站点

View File

@ -2,6 +2,7 @@ package com.fastbee.ggroup.service;
import java.util.List;
import com.fastbee.ggroup.domain.GLegend;
import com.fastbee.ggroup.domain.dto.GLegendDto;
/**
* 图例Service接口
@ -25,7 +26,7 @@ public interface IGLegendService
* @param gLegend 图例
* @return 图例集合
*/
public List<GLegend> selectGLegendList(GLegend gLegend);
public List<GLegendDto> selectGLegendList(GLegend gLegend);
/**
* 新增图例

View File

@ -0,0 +1,61 @@
package com.fastbee.ggroup.service;
import java.util.List;
import com.fastbee.ggroup.domain.GLegendType;
/**
* 图例类型Service接口
*
* @author kerwincui
* @date 2024-10-09
*/
public interface IGLegendTypeService
{
/**
* 查询图例类型
*
* @param id 图例类型主键
* @return 图例类型
*/
public GLegendType selectGLegendTypeById(Long id);
/**
* 查询图例类型列表
*
* @param gLegendType 图例类型
* @return 图例类型集合
*/
public List<GLegendType> selectGLegendTypeList(GLegendType gLegendType);
/**
* 新增图例类型
*
* @param gLegendType 图例类型
* @return 结果
*/
public int insertGLegendType(GLegendType gLegendType);
/**
* 修改图例类型
*
* @param gLegendType 图例类型
* @return 结果
*/
public int updateGLegendType(GLegendType gLegendType);
/**
* 批量删除图例类型
*
* @param ids 需要删除的图例类型主键集合
* @return 结果
*/
public int deleteGLegendTypeByIds(Long[] ids);
/**
* 删除图例类型信息
*
* @param id 图例类型主键
* @return 结果
*/
public int deleteGLegendTypeById(Long id);
}

View File

@ -41,7 +41,7 @@ public interface IGSitesService
/**
* 修改站点
*
* @param gSites 站点
* @param gSitesEditDto 站点
* @return 结果
*/
public int updateGSites(GSitesEditDto gSitesEditDto);
@ -69,4 +69,6 @@ public interface IGSitesService
* @return
*/
int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto);
List<GSites> searchGSitesList(GSites gSites);
}

View File

@ -2,6 +2,10 @@ package com.fastbee.ggroup.service.impl;
import java.util.List;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.ggroup.domain.GLegendType;
import com.fastbee.ggroup.domain.dto.GLegendDto;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GLegendMapper;
@ -39,9 +43,16 @@ public class GLegendServiceImpl implements IGLegendService
* @return 图例
*/
@Override
public List<GLegend> selectGLegendList(GLegend gLegend)
public List<GLegendDto> selectGLegendList(GLegend gLegend)
{
return gLegendMapper.selectGLegendList(gLegend);
MPJLambdaWrapper<GLegend> wrapper = new MPJLambdaWrapper<GLegend>()
.select(GLegend::getId,GLegend::getIcon,GLegend::getType,GLegend::getName)
.select(GLegendType::getTypeName,GLegendType::getCategory)
.leftJoin(GLegendType.class,GLegendType::getId,GLegend::getType);
return gLegendMapper.selectJoinList(GLegendDto.class,wrapper);
// return gLegendMapper.selectGLegendList(gLegend);
}
/**

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.GLegendTypeMapper;
import com.fastbee.ggroup.domain.GLegendType;
import com.fastbee.ggroup.service.IGLegendTypeService;
/**
* 图例类型Service业务层处理
*
* @author kerwincui
* @date 2024-10-09
*/
@Service
public class GLegendTypeServiceImpl implements IGLegendTypeService
{
@Autowired
private GLegendTypeMapper gLegendTypeMapper;
/**
* 查询图例类型
*
* @param id 图例类型主键
* @return 图例类型
*/
@Override
public GLegendType selectGLegendTypeById(Long id)
{
return gLegendTypeMapper.selectGLegendTypeById(id);
}
/**
* 查询图例类型列表
*
* @param gLegendType 图例类型
* @return 图例类型
*/
@Override
public List<GLegendType> selectGLegendTypeList(GLegendType gLegendType)
{
return gLegendTypeMapper.selectGLegendTypeList(gLegendType);
}
/**
* 新增图例类型
*
* @param gLegendType 图例类型
* @return 结果
*/
@Override
public int insertGLegendType(GLegendType gLegendType)
{
gLegendType.setCreateTime(DateUtils.getNowDate());
return gLegendTypeMapper.insertGLegendType(gLegendType);
}
/**
* 修改图例类型
*
* @param gLegendType 图例类型
* @return 结果
*/
@Override
public int updateGLegendType(GLegendType gLegendType)
{
gLegendType.setUpdateTime(DateUtils.getNowDate());
return gLegendTypeMapper.updateGLegendType(gLegendType);
}
/**
* 批量删除图例类型
*
* @param ids 需要删除的图例类型主键
* @return 结果
*/
@Override
public int deleteGLegendTypeByIds(Long[] ids)
{
return gLegendTypeMapper.deleteGLegendTypeByIds(ids);
}
/**
* 删除图例类型信息
*
* @param id 图例类型主键
* @return 结果
*/
@Override
public int deleteGLegendTypeById(Long id)
{
return gLegendTypeMapper.deleteGLegendTypeById(id);
}
}

View File

@ -13,6 +13,8 @@ import com.fastbee.ggroup.domain.dto.GGroupSiteRelateDto;
import com.fastbee.ggroup.domain.dto.GSitesEditDto;
import com.fastbee.ggroup.mapper.GSiteGroupsMapper;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,6 +57,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
*/
@Override
public List<GSites> selectGSitesList(GSites gSites) {
return gSitesMapper.selectList(new LambdaQueryWrapper<GSites>()
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType)
.eq(GSites::getProjectId, 1)
@ -108,7 +111,6 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
if(gSites.getName().trim().equals(gSitesEditDto.getName().trim())){
return 1;
}
//不能有重复名字的站点
GSites gSites1 = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
.select(GSites::getName, GSites::getId)
@ -151,6 +153,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
return gSiteGroupsMapper.deleteById(id);
}
@Override
public int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto) {
Long parentId = gGroupSiteRelateDto.getParentId();
@ -175,6 +178,14 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
return 1;
}
@Override
public List<GSites> searchGSitesList(GSites gSites) {
return gSitesMapper.selectList(new LambdaQueryWrapper<GSites>()
.eq(GSites::getProjectId, gSites.getProjectId())
.select(GSites::getId, GSites::getName, GSites::getType, GSites::getIcon)
.like(GSites::getName, gSites.getSearchValue()));
}
private GSiteGroups setSiteIdToSiteGroups(Long siteId) {
GSiteGroups gSiteGroups = new GSiteGroups();
gSiteGroups.setSiteId(siteId);

View File

@ -0,0 +1,82 @@
<?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.GLegendTypeMapper">
<resultMap type="GLegendType" id="GLegendTypeResult">
<result property="id" column="id" />
<result property="typeName" column="type_name" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="category" column="category" />
</resultMap>
<sql id="selectGLegendTypeVo">
select id, type_name, description, create_time, create_by, update_time, update_by, category from g_legend_type
</sql>
<select id="selectGLegendTypeList" parameterType="GLegendType" resultMap="GLegendTypeResult">
<include refid="selectGLegendTypeVo"/>
<where>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="category != null and category != ''"> and category = #{category}</if>
</where>
</select>
<select id="selectGLegendTypeById" parameterType="Long" resultMap="GLegendTypeResult">
<include refid="selectGLegendTypeVo"/>
where id = #{id}
</select>
<insert id="insertGLegendType" parameterType="GLegendType" useGeneratedKeys="true" keyProperty="id">
insert into g_legend_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeName != null and typeName != ''">type_name,</if>
<if test="description != null">description,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="category != null">category,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="description != null">#{description},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="category != null">#{category},</if>
</trim>
</insert>
<update id="updateGLegendType" parameterType="GLegendType">
update g_legend_type
<trim prefix="SET" suffixOverrides=",">
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="description != null">description = #{description},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="category != null">category = #{category},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGLegendTypeById" parameterType="Long">
delete from g_legend_type where id = #{id}
</delete>
<delete id="deleteGLegendTypeByIds" parameterType="String">
delete from g_legend_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>