验收5-mqtt配置

This commit is contained in:
2025-11-06 19:39:53 +08:00
parent 72c7c0c3e0
commit 43edc47aaa
7 changed files with 459 additions and 16 deletions

View File

@ -78,6 +78,7 @@ public class EmsFaultProtectionPlanController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody EmsFaultProtectionPlan emsFaultProtectionPlan)
{
emsFaultProtectionPlan.setCreateBy(getUsername());
return toAjax(emsFaultProtectionPlanService.insertEmsFaultProtectionPlan(emsFaultProtectionPlan));
}
@ -89,6 +90,7 @@ public class EmsFaultProtectionPlanController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody EmsFaultProtectionPlan emsFaultProtectionPlan)
{
emsFaultProtectionPlan.setUpdateBy(getUsername());
return toAjax(emsFaultProtectionPlanService.updateEmsFaultProtectionPlan(emsFaultProtectionPlan));
}

View File

@ -0,0 +1,106 @@
package com.xzzn.web.controller.ems;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.xzzn.common.annotation.Log;
import com.xzzn.common.core.controller.BaseController;
import com.xzzn.common.core.domain.AjaxResult;
import com.xzzn.common.enums.BusinessType;
import com.xzzn.ems.domain.EmsMqttTopicConfig;
import com.xzzn.ems.service.IEmsMqttTopicConfigService;
import com.xzzn.common.utils.poi.ExcelUtil;
import com.xzzn.common.core.page.TableDataInfo;
/**
* 站点topic配置Controller
*
* @author xzzn
* @date 2025-11-06
*/
@RestController
@RequestMapping("/ems/mqttConfig")
public class EmsMqttTopicConfigController extends BaseController
{
@Autowired
private IEmsMqttTopicConfigService emsMqttTopicConfigService;
/**
* 查询站点topic配置列表
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(EmsMqttTopicConfig emsMqttTopicConfig)
{
startPage();
List<EmsMqttTopicConfig> list = emsMqttTopicConfigService.selectEmsMqttTopicConfigList(emsMqttTopicConfig);
return getDataTable(list);
}
/**
* 导出站点topic配置列表
*/
@PreAuthorize("@ss.hasPermi('system:config:export')")
@Log(title = "站点topic配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsMqttTopicConfig emsMqttTopicConfig)
{
List<EmsMqttTopicConfig> list = emsMqttTopicConfigService.selectEmsMqttTopicConfigList(emsMqttTopicConfig);
ExcelUtil<EmsMqttTopicConfig> util = new ExcelUtil<EmsMqttTopicConfig>(EmsMqttTopicConfig.class);
util.exportExcel(response, list, "站点topic配置数据");
}
/**
* 获取站点topic配置详细信息
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(emsMqttTopicConfigService.selectEmsMqttTopicConfigById(id));
}
/**
* 新增站点topic配置
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "站点topic配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsMqttTopicConfig emsMqttTopicConfig)
{
emsMqttTopicConfig.setCreateBy(getUsername());
return toAjax(emsMqttTopicConfigService.insertEmsMqttTopicConfig(emsMqttTopicConfig));
}
/**
* 修改站点topic配置
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "站点topic配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsMqttTopicConfig emsMqttTopicConfig)
{
emsMqttTopicConfig.setUpdateBy(getUsername());
return toAjax(emsMqttTopicConfigService.updateEmsMqttTopicConfig(emsMqttTopicConfig));
}
/**
* 删除站点topic配置
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "站点topic配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(emsMqttTopicConfigService.deleteEmsMqttTopicConfigByIds(ids));
}
}

View File

@ -9,7 +9,7 @@ import com.xzzn.common.annotation.Excel;
* 站点topic配置对象 ems_mqtt_topic_config
*
* @author xzzn
* @date 2025-10-21
* @date 2025-11-06
*/
public class EmsMqttTopicConfig extends BaseEntity
{
@ -18,14 +18,22 @@ public class EmsMqttTopicConfig extends BaseEntity
/** 主键 */
private Long id;
/** 站点id */
@Excel(name = "站点id")
private String siteId;
/** 订阅topic */
@Excel(name = "订阅topic")
private String mqttTopic;
/** topic描述 */
@Excel(name = "topic描述")
private String topicName;
/** 对应方法 */
@Excel(name = "对应方法")
private String method;
/** 站点id */
@Excel(name = "站点id")
private String siteId;
public void setId(Long id)
{
this.id = id;
@ -36,16 +44,6 @@ public class EmsMqttTopicConfig extends BaseEntity
return id;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public String getSiteId()
{
return siteId;
}
public void setMqttTopic(String mqttTopic)
{
this.mqttTopic = mqttTopic;
@ -56,12 +54,44 @@ public class EmsMqttTopicConfig extends BaseEntity
return mqttTopic;
}
public void setTopicName(String topicName)
{
this.topicName = topicName;
}
public String getTopicName()
{
return topicName;
}
public void setMethod(String method)
{
this.method = method;
}
public String getMethod()
{
return method;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public String getSiteId()
{
return siteId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("siteId", getSiteId())
.append("mqttTopic", getMqttTopic())
.append("topicName", getTopicName())
.append("method", getMethod())
.append("siteId", getSiteId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

View File

@ -0,0 +1,61 @@
package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsMqttTopicConfig;
/**
* 站点topic配置Mapper接口
*
* @author xzzn
* @date 2025-11-06
*/
public interface EmsMqttTopicConfigMapper
{
/**
* 查询站点topic配置
*
* @param id 站点topic配置主键
* @return 站点topic配置
*/
public EmsMqttTopicConfig selectEmsMqttTopicConfigById(Long id);
/**
* 查询站点topic配置列表
*
* @param emsMqttTopicConfig 站点topic配置
* @return 站点topic配置集合
*/
public List<EmsMqttTopicConfig> selectEmsMqttTopicConfigList(EmsMqttTopicConfig emsMqttTopicConfig);
/**
* 新增站点topic配置
*
* @param emsMqttTopicConfig 站点topic配置
* @return 结果
*/
public int insertEmsMqttTopicConfig(EmsMqttTopicConfig emsMqttTopicConfig);
/**
* 修改站点topic配置
*
* @param emsMqttTopicConfig 站点topic配置
* @return 结果
*/
public int updateEmsMqttTopicConfig(EmsMqttTopicConfig emsMqttTopicConfig);
/**
* 删除站点topic配置
*
* @param id 站点topic配置主键
* @return 结果
*/
public int deleteEmsMqttTopicConfigById(Long id);
/**
* 批量删除站点topic配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmsMqttTopicConfigByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsMqttTopicConfig;
/**
* 站点topic配置Service接口
*
* @author xzzn
* @date 2025-11-06
*/
public interface IEmsMqttTopicConfigService
{
/**
* 查询站点topic配置
*
* @param id 站点topic配置主键
* @return 站点topic配置
*/
public EmsMqttTopicConfig selectEmsMqttTopicConfigById(Long id);
/**
* 查询站点topic配置列表
*
* @param emsMqttTopicConfig 站点topic配置
* @return 站点topic配置集合
*/
public List<EmsMqttTopicConfig> selectEmsMqttTopicConfigList(EmsMqttTopicConfig emsMqttTopicConfig);
/**
* 新增站点topic配置
*
* @param emsMqttTopicConfig 站点topic配置
* @return 结果
*/
public int insertEmsMqttTopicConfig(EmsMqttTopicConfig emsMqttTopicConfig);
/**
* 修改站点topic配置
*
* @param emsMqttTopicConfig 站点topic配置
* @return 结果
*/
public int updateEmsMqttTopicConfig(EmsMqttTopicConfig emsMqttTopicConfig);
/**
* 批量删除站点topic配置
*
* @param ids 需要删除的站点topic配置主键集合
* @return 结果
*/
public int deleteEmsMqttTopicConfigByIds(Long[] ids);
/**
* 删除站点topic配置信息
*
* @param id 站点topic配置主键
* @return 结果
*/
public int deleteEmsMqttTopicConfigById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.xzzn.ems.service.impl;
import java.util.List;
import com.xzzn.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsMqttTopicConfigMapper;
import com.xzzn.ems.domain.EmsMqttTopicConfig;
import com.xzzn.ems.service.IEmsMqttTopicConfigService;
/**
* 站点topic配置Service业务层处理
*
* @author xzzn
* @date 2025-11-06
*/
@Service
public class EmsMqttTopicConfigServiceImpl implements IEmsMqttTopicConfigService
{
@Autowired
private EmsMqttTopicConfigMapper emsMqttTopicConfigMapper;
/**
* 查询站点topic配置
*
* @param id 站点topic配置主键
* @return 站点topic配置
*/
@Override
public EmsMqttTopicConfig selectEmsMqttTopicConfigById(Long id)
{
return emsMqttTopicConfigMapper.selectEmsMqttTopicConfigById(id);
}
/**
* 查询站点topic配置列表
*
* @param emsMqttTopicConfig 站点topic配置
* @return 站点topic配置
*/
@Override
public List<EmsMqttTopicConfig> selectEmsMqttTopicConfigList(EmsMqttTopicConfig emsMqttTopicConfig)
{
return emsMqttTopicConfigMapper.selectEmsMqttTopicConfigList(emsMqttTopicConfig);
}
/**
* 新增站点topic配置
*
* @param emsMqttTopicConfig 站点topic配置
* @return 结果
*/
@Override
public int insertEmsMqttTopicConfig(EmsMqttTopicConfig emsMqttTopicConfig)
{
emsMqttTopicConfig.setCreateTime(DateUtils.getNowDate());
return emsMqttTopicConfigMapper.insertEmsMqttTopicConfig(emsMqttTopicConfig);
}
/**
* 修改站点topic配置
*
* @param emsMqttTopicConfig 站点topic配置
* @return 结果
*/
@Override
public int updateEmsMqttTopicConfig(EmsMqttTopicConfig emsMqttTopicConfig)
{
emsMqttTopicConfig.setUpdateTime(DateUtils.getNowDate());
return emsMqttTopicConfigMapper.updateEmsMqttTopicConfig(emsMqttTopicConfig);
}
/**
* 批量删除站点topic配置
*
* @param ids 需要删除的站点topic配置主键
* @return 结果
*/
@Override
public int deleteEmsMqttTopicConfigByIds(Long[] ids)
{
return emsMqttTopicConfigMapper.deleteEmsMqttTopicConfigByIds(ids);
}
/**
* 删除站点topic配置信息
*
* @param id 站点topic配置主键
* @return 结果
*/
@Override
public int deleteEmsMqttTopicConfigById(Long id)
{
return emsMqttTopicConfigMapper.deleteEmsMqttTopicConfigById(id);
}
}

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.xzzn.ems.mapper.EmsMqttTopicConfigMapper">
<resultMap type="EmsMqttTopicConfig" id="EmsMqttTopicConfigResult">
<result property="id" column="id" />
<result property="mqttTopic" column="mqtt_topic" />
<result property="topicName" column="topic_name" />
<result property="method" column="method" />
<result property="siteId" column="siteId" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectEmsMqttTopicConfigVo">
select id, mqtt_topic, topic_name, method, siteId, create_by, create_time, update_by, update_time from ems_mqtt_topic_config
</sql>
<select id="selectEmsMqttTopicConfigList" parameterType="EmsMqttTopicConfig" resultMap="EmsMqttTopicConfigResult">
<include refid="selectEmsMqttTopicConfigVo"/>
<where>
<if test="mqttTopic != null and mqttTopic != ''"> and mqtt_topic like concat('%', #{mqttTopic}, '%')</if>
<if test="topicName != null and topicName != ''"> and topic_name like concat('%', #{topicName}, '%')</if>
<if test="method != null and method != ''"> and method = #{method}</if>
<if test="siteId != null and siteId != ''"> and siteId = #{siteId}</if>
</where>
</select>
<select id="selectEmsMqttTopicConfigById" parameterType="Long" resultMap="EmsMqttTopicConfigResult">
<include refid="selectEmsMqttTopicConfigVo"/>
where id = #{id}
</select>
<insert id="insertEmsMqttTopicConfig" parameterType="EmsMqttTopicConfig" useGeneratedKeys="true" keyProperty="id">
insert into ems_mqtt_topic_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mqttTopic != null">mqtt_topic,</if>
<if test="topicName != null">topic_name,</if>
<if test="method != null">method,</if>
<if test="siteId != null">siteId,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mqttTopic != null">#{mqttTopic},</if>
<if test="topicName != null">#{topicName},</if>
<if test="method != null">#{method},</if>
<if test="siteId != null">#{siteId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEmsMqttTopicConfig" parameterType="EmsMqttTopicConfig">
update ems_mqtt_topic_config
<trim prefix="SET" suffixOverrides=",">
<if test="mqttTopic != null">mqtt_topic = #{mqttTopic},</if>
<if test="topicName != null">topic_name = #{topicName},</if>
<if test="method != null">method = #{method},</if>
<if test="siteId != null">siteId = #{siteId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmsMqttTopicConfigById" parameterType="Long">
delete from ems_mqtt_topic_config where id = #{id}
</delete>
<delete id="deleteEmsMqttTopicConfigByIds" parameterType="String">
delete from ems_mqtt_topic_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>