Bläddra i källkod

创建 table sim_sim_msg 相关。

tom 5 månader sedan
förälder
incheckning
d7ee387403

+ 42 - 0
pla-sim/01_SQL/02_table/sim_sim_msg.sql

@@ -0,0 +1,42 @@
+/*
+ Navicat Premium Dump SQL
+
+ Source Server         : qdhome.iot321.top
+ Source Server Type    : MySQL
+ Source Server Version : 50740 (5.7.40-log)
+ Source Host           : qdhome.iot321.top:33003
+ Source Schema         : pla-chem-sim-dev-1
+
+ Target Server Type    : MySQL
+ Target Server Version : 50740 (5.7.40-log)
+ File Encoding         : 65001
+
+ Date: 11/12/2024 02:31:16
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for sim_sim_msg
+-- ----------------------------
+DROP TABLE IF EXISTS `sim_sim_msg`;
+CREATE TABLE `sim_sim_msg`  (
+  `sim_msg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '模拟器报文ID',
+  `sim_id` bigint(20) NOT NULL COMMENT '模拟器ID',
+  `state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '状态 0初始值 1成功 2失败',
+  `priority` int(8) NULL DEFAULT NULL COMMENT '优先级',
+  `send_msg` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '发送报文',
+  `send_time` datetime NULL DEFAULT NULL COMMENT '发送时间',
+  `receive_msg` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '接收报文',
+  `receive_time` datetime NULL DEFAULT NULL COMMENT '接收时间',
+  `retry_count` int(8) NULL DEFAULT 0 COMMENT '重试次数',
+  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
+  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
+  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
+  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`sim_msg_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sim-模拟器报文表' ROW_FORMAT = DYNAMIC;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 98 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/SimMsgController.java

@@ -0,0 +1,98 @@
+package com.ruoyi.sim.controller;
+
+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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.sim.domain.SimMsg;
+import com.ruoyi.sim.service.ISimMsgService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 模拟器报文Controller
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+@RestController
+@RequestMapping("/sim/sim_msg")
+public class SimMsgController extends BaseController {
+    @Autowired
+    private ISimMsgService simMsgService;
+
+    /**
+     * 查询模拟器报文列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim_msg:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(SimMsg simMsg) {
+        startPage();
+        List<SimMsg> list = simMsgService.selectSimMsgList(simMsg);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出模拟器报文列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim_msg:export')")
+    @Log(title = "模拟器报文", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, SimMsg simMsg) {
+        List<SimMsg> list = simMsgService.selectSimMsgList(simMsg);
+        ExcelUtil<SimMsg> util = new ExcelUtil<SimMsg>(SimMsg.class);
+        util.exportExcel(response, list, "模拟器报文数据");
+    }
+
+    /**
+     * 获取模拟器报文详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim_msg:query')")
+    @GetMapping(value = "/{simMsgId}")
+    public AjaxResult getInfo(@PathVariable("simMsgId") Long simMsgId) {
+        return success(simMsgService.selectSimMsgBySimMsgId(simMsgId));
+    }
+
+    /**
+     * 新增模拟器报文
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim_msg:add')")
+    @Log(title = "模拟器报文", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SimMsg simMsg) {
+        return toAjax(simMsgService.insertSimMsg(simMsg));
+    }
+
+    /**
+     * 修改模拟器报文
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim_msg:edit')")
+    @Log(title = "模拟器报文", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SimMsg simMsg) {
+        return toAjax(simMsgService.updateSimMsg(simMsg));
+    }
+
+    /**
+     * 删除模拟器报文
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim_msg:remove')")
+    @Log(title = "模拟器报文", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{simMsgIds}")
+    public AjaxResult remove(@PathVariable Long[] simMsgIds) {
+        return toAjax(simMsgService.deleteSimMsgBySimMsgIds(simMsgIds));
+    }
+}

+ 166 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/SimMsg.java

@@ -0,0 +1,166 @@
+package com.ruoyi.sim.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 模拟器报文对象 sim_sim_msg
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+public class SimMsg extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 模拟器报文ID
+     */
+    private Long simMsgId;
+
+    /**
+     * 模拟器ID
+     */
+    @Excel(name = "模拟器ID")
+    private Long simId;
+
+    /**
+     * 状态 0初始值 1成功 2失败
+     */
+    @Excel(name = "状态 0初始值 1成功 2失败")
+    private String state;
+
+    /**
+     * 优先级
+     */
+    @Excel(name = "优先级")
+    private Integer priority;
+
+    /**
+     * 发送报文
+     */
+    @Excel(name = "发送报文")
+    private String sendMsg;
+
+    /**
+     * 发送时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date sendTime;
+
+    /**
+     * 接收报文
+     */
+    @Excel(name = "接收报文")
+    private String receiveMsg;
+
+    /**
+     * 接收时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "接收时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date receiveTime;
+
+    /**
+     * 重试次数
+     */
+    @Excel(name = "重试次数")
+    private Integer retryCount;
+
+    public void setSimMsgId(Long simMsgId) {
+        this.simMsgId = simMsgId;
+    }
+
+    public Long getSimMsgId() {
+        return simMsgId;
+    }
+
+    public void setSimId(Long simId) {
+        this.simId = simId;
+    }
+
+    public Long getSimId() {
+        return simId;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setPriority(Integer priority) {
+        this.priority = priority;
+    }
+
+    public Integer getPriority() {
+        return priority;
+    }
+
+    public void setSendMsg(String sendMsg) {
+        this.sendMsg = sendMsg;
+    }
+
+    public String getSendMsg() {
+        return sendMsg;
+    }
+
+    public void setSendTime(Date sendTime) {
+        this.sendTime = sendTime;
+    }
+
+    public Date getSendTime() {
+        return sendTime;
+    }
+
+    public void setReceiveMsg(String receiveMsg) {
+        this.receiveMsg = receiveMsg;
+    }
+
+    public String getReceiveMsg() {
+        return receiveMsg;
+    }
+
+    public void setReceiveTime(Date receiveTime) {
+        this.receiveTime = receiveTime;
+    }
+
+    public Date getReceiveTime() {
+        return receiveTime;
+    }
+
+    public void setRetryCount(Integer retryCount) {
+        this.retryCount = retryCount;
+    }
+
+    public Integer getRetryCount() {
+        return retryCount;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("simMsgId", getSimMsgId())
+                .append("simId", getSimId())
+                .append("state", getState())
+                .append("priority", getPriority())
+                .append("sendMsg", getSendMsg())
+                .append("sendTime", getSendTime())
+                .append("receiveMsg", getReceiveMsg())
+                .append("receiveTime", getReceiveTime())
+                .append("retryCount", getRetryCount())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
+    }
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/mapper/SimMsgMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.SimMsg;
+
+/**
+ * 模拟器报文Mapper接口
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+public interface SimMsgMapper {
+    /**
+     * 查询模拟器报文
+     *
+     * @param simMsgId 模拟器报文主键
+     * @return 模拟器报文
+     */
+    public SimMsg selectSimMsgBySimMsgId(Long simMsgId);
+
+    /**
+     * 查询模拟器报文列表
+     *
+     * @param simMsg 模拟器报文
+     * @return 模拟器报文集合
+     */
+    public List<SimMsg> selectSimMsgList(SimMsg simMsg);
+
+    /**
+     * 新增模拟器报文
+     *
+     * @param simMsg 模拟器报文
+     * @return 结果
+     */
+    public int insertSimMsg(SimMsg simMsg);
+
+    /**
+     * 修改模拟器报文
+     *
+     * @param simMsg 模拟器报文
+     * @return 结果
+     */
+    public int updateSimMsg(SimMsg simMsg);
+
+    /**
+     * 删除模拟器报文
+     *
+     * @param simMsgId 模拟器报文主键
+     * @return 结果
+     */
+    public int deleteSimMsgBySimMsgId(Long simMsgId);
+
+    /**
+     * 批量删除模拟器报文
+     *
+     * @param simMsgIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSimMsgBySimMsgIds(Long[] simMsgIds);
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/ISimMsgService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.service;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.SimMsg;
+
+/**
+ * 模拟器报文Service接口
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+public interface ISimMsgService {
+    /**
+     * 查询模拟器报文
+     *
+     * @param simMsgId 模拟器报文主键
+     * @return 模拟器报文
+     */
+    public SimMsg selectSimMsgBySimMsgId(Long simMsgId);
+
+    /**
+     * 查询模拟器报文列表
+     *
+     * @param simMsg 模拟器报文
+     * @return 模拟器报文集合
+     */
+    public List<SimMsg> selectSimMsgList(SimMsg simMsg);
+
+    /**
+     * 新增模拟器报文
+     *
+     * @param simMsg 模拟器报文
+     * @return 结果
+     */
+    public int insertSimMsg(SimMsg simMsg);
+
+    /**
+     * 修改模拟器报文
+     *
+     * @param simMsg 模拟器报文
+     * @return 结果
+     */
+    public int updateSimMsg(SimMsg simMsg);
+
+    /**
+     * 批量删除模拟器报文
+     *
+     * @param simMsgIds 需要删除的模拟器报文主键集合
+     * @return 结果
+     */
+    public int deleteSimMsgBySimMsgIds(Long[] simMsgIds);
+
+    /**
+     * 删除模拟器报文信息
+     *
+     * @param simMsgId 模拟器报文主键
+     * @return 结果
+     */
+    public int deleteSimMsgBySimMsgId(Long simMsgId);
+}

+ 90 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimMsgServiceImpl.java

@@ -0,0 +1,90 @@
+package com.ruoyi.sim.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.sim.mapper.SimMsgMapper;
+import com.ruoyi.sim.domain.SimMsg;
+import com.ruoyi.sim.service.ISimMsgService;
+
+/**
+ * 模拟器报文Service业务层处理
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+@Service
+public class SimMsgServiceImpl implements ISimMsgService {
+    @Autowired
+    private SimMsgMapper simMsgMapper;
+
+    /**
+     * 查询模拟器报文
+     *
+     * @param simMsgId 模拟器报文主键
+     * @return 模拟器报文
+     */
+    @Override
+    public SimMsg selectSimMsgBySimMsgId(Long simMsgId) {
+        return simMsgMapper.selectSimMsgBySimMsgId(simMsgId);
+    }
+
+    /**
+     * 查询模拟器报文列表
+     *
+     * @param simMsg 模拟器报文
+     * @return 模拟器报文
+     */
+    @Override
+    public List<SimMsg> selectSimMsgList(SimMsg simMsg) {
+        return simMsgMapper.selectSimMsgList(simMsg);
+    }
+
+    /**
+     * 新增模拟器报文
+     *
+     * @param simMsg 模拟器报文
+     * @return 结果
+     */
+    @Override
+    public int insertSimMsg(SimMsg simMsg) {
+        simMsg.setCreateTime(DateUtils.getNowDate());
+        return simMsgMapper.insertSimMsg(simMsg);
+    }
+
+    /**
+     * 修改模拟器报文
+     *
+     * @param simMsg 模拟器报文
+     * @return 结果
+     */
+    @Override
+    public int updateSimMsg(SimMsg simMsg) {
+        simMsg.setUpdateTime(DateUtils.getNowDate());
+        return simMsgMapper.updateSimMsg(simMsg);
+    }
+
+    /**
+     * 批量删除模拟器报文
+     *
+     * @param simMsgIds 需要删除的模拟器报文主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSimMsgBySimMsgIds(Long[] simMsgIds) {
+        return simMsgMapper.deleteSimMsgBySimMsgIds(simMsgIds);
+    }
+
+    /**
+     * 删除模拟器报文信息
+     *
+     * @param simMsgId 模拟器报文主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSimMsgBySimMsgId(Long simMsgId) {
+        return simMsgMapper.deleteSimMsgBySimMsgId(simMsgId);
+    }
+}

+ 127 - 0
ruoyi-sim/src/main/resources/mapper/sim/SimMsg.xml

@@ -0,0 +1,127 @@
+<?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.ruoyi.sim.mapper.SimMsgMapper">
+
+    <resultMap type="SimMsg" id="SimMsgResult">
+        <result property="simMsgId" column="sim_msg_id"/>
+        <result property="simId" column="sim_id"/>
+        <result property="state" column="state"/>
+        <result property="priority" column="priority"/>
+        <result property="sendMsg" column="send_msg"/>
+        <result property="sendTime" column="send_time"/>
+        <result property="receiveMsg" column="receive_msg"/>
+        <result property="receiveTime" column="receive_time"/>
+        <result property="retryCount" column="retry_count"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
+    <sql id="selectSimMsgVo">
+        select sim_msg_id,
+               sim_id,
+               state,
+               priority,
+               send_msg,
+               send_time,
+               receive_msg,
+               receive_time,
+               retry_count,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from sim_sim_msg
+    </sql>
+
+    <select id="selectSimMsgList" parameterType="SimMsg" resultMap="SimMsgResult">
+        <include refid="selectSimMsgVo"/>
+        <where>
+            <if test="simId != null ">and sim_id = #{simId}</if>
+            <if test="state != null  and state != ''">and state = #{state}</if>
+            <if test="priority != null ">and priority = #{priority}</if>
+            <if test="sendMsg != null  and sendMsg != ''">and send_msg = #{sendMsg}</if>
+            <if test="sendTime != null ">and send_time = #{sendTime}</if>
+            <if test="receiveMsg != null  and receiveMsg != ''">and receive_msg = #{receiveMsg}</if>
+            <if test="receiveTime != null ">and receive_time = #{receiveTime}</if>
+            <if test="retryCount != null ">and retry_count = #{retryCount}</if>
+        </where>
+    </select>
+
+    <select id="selectSimMsgBySimMsgId" parameterType="Long" resultMap="SimMsgResult">
+        <include refid="selectSimMsgVo"/>
+        where sim_msg_id = #{simMsgId}
+    </select>
+
+    <insert id="insertSimMsg" parameterType="SimMsg" useGeneratedKeys="true" keyProperty="simMsgId">
+        insert into sim_sim_msg
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="simId != null">sim_id,</if>
+            <if test="state != null and state != ''">state,</if>
+            <if test="priority != null">priority,</if>
+            <if test="sendMsg != null">send_msg,</if>
+            <if test="sendTime != null">send_time,</if>
+            <if test="receiveMsg != null">receive_msg,</if>
+            <if test="receiveTime != null">receive_time,</if>
+            <if test="retryCount != null">retry_count,</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>
+            <if test="remark != null">remark,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="simId != null">#{simId},</if>
+            <if test="state != null and state != ''">#{state},</if>
+            <if test="priority != null">#{priority},</if>
+            <if test="sendMsg != null">#{sendMsg},</if>
+            <if test="sendTime != null">#{sendTime},</if>
+            <if test="receiveMsg != null">#{receiveMsg},</if>
+            <if test="receiveTime != null">#{receiveTime},</if>
+            <if test="retryCount != null">#{retryCount},</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>
+            <if test="remark != null">#{remark},</if>
+        </trim>
+    </insert>
+
+    <update id="updateSimMsg" parameterType="SimMsg">
+        update sim_sim_msg
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="simId != null">sim_id = #{simId},</if>
+            <if test="state != null and state != ''">state = #{state},</if>
+            <if test="priority != null">priority = #{priority},</if>
+            <if test="sendMsg != null">send_msg = #{sendMsg},</if>
+            <if test="sendTime != null">send_time = #{sendTime},</if>
+            <if test="receiveMsg != null">receive_msg = #{receiveMsg},</if>
+            <if test="receiveTime != null">receive_time = #{receiveTime},</if>
+            <if test="retryCount != null">retry_count = #{retryCount},</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>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where sim_msg_id = #{simMsgId}
+    </update>
+
+    <delete id="deleteSimMsgBySimMsgId" parameterType="Long">
+        delete
+        from sim_sim_msg
+        where sim_msg_id = #{simMsgId}
+    </delete>
+
+    <delete id="deleteSimMsgBySimMsgIds" parameterType="String">
+        delete from sim_sim_msg where sim_msg_id in
+        <foreach item="simMsgId" collection="array" open="(" separator="," close=")">
+            #{simMsgId}
+        </foreach>
+    </delete>
+</mapper>