Selaa lähdekoodia

添加DebugFault相关支持。

tom 1 viikko sitten
vanhempi
commit
18829abe62

+ 74 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/DebugFaultController.java

@@ -0,0 +1,74 @@
+package com.ruoyi.sim.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.sim.service.impl.DebugFaultService;
+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.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.sim.domain.DebugFault;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 调试故障Controller
+ *
+ * @author tom
+ * @date 2025-02-10
+ */
+@RestController
+@RequestMapping("/sim/debug-fault")
+public class DebugFaultController extends BaseController {
+    @Autowired
+    private DebugFaultService debugFaultService;
+
+    /**
+     * 查询调试故障列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(DebugFault debugFault) {
+        startPage();
+        List<DebugFault> list = debugFaultService.selectDebugFaultList(debugFault);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取调试故障详细信息
+     */
+    @GetMapping(value = "/{refId}")
+    public AjaxResult getInfo(@PathVariable("refId") Long refId) {
+        return success(debugFaultService.selectDebugFaultByRefId(refId));
+    }
+
+    /**
+     * 新增调试故障
+     */
+    @PostMapping
+    public AjaxResult add(@RequestBody DebugFault debugFault) {
+        return toAjax(debugFaultService.insertDebugFault(debugFault));
+    }
+
+    /**
+     * 修改调试故障
+     */
+    @PutMapping
+    public AjaxResult edit(@RequestBody DebugFault debugFault) {
+        return toAjax(debugFaultService.updateDebugFault(debugFault));
+    }
+
+    /**
+     * 删除调试故障
+     */
+    @DeleteMapping("/{refIds}")
+    public AjaxResult remove(@PathVariable Long[] refIds) {
+        return toAjax(debugFaultService.deleteDebugFaultByRefIds(refIds));
+    }
+}

+ 146 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/DebugFault.java

@@ -0,0 +1,146 @@
+package com.ruoyi.sim.domain;
+
+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_debug_fault
+ *
+ * @author tom
+ * @date 2025-02-10
+ */
+public class DebugFault extends BaseEntity {
+    
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 关联ID
+     */
+    private Long refId;
+
+    /**
+     * 模拟器ID
+     */
+    @Excel(name = "模拟器ID")
+    private Long simId;
+
+    /**
+     * 故障ID
+     */
+    @Excel(name = "故障ID")
+    private String faultId;
+
+    /**
+     * 选择状态:[7]-未知,[1]-选中,[0]-没有选中
+     */
+    @Excel(name = "选择状态:[7]-未知,[1]-选中,[0]-没有选中")
+    private String flag;
+
+    /**
+     * 故障ID关联状态:[0]-初始化,[1]-已经清除故障,[2]故障已经下发,[3]-轮询读取刷新电阻代表值,[4]-考试结束
+     */
+    @Excel(name = "故障ID关联状态:[0]-初始化,[1]-已经清除故障,[2]故障已经下发,[3]-轮询读取刷新电阻代表值,[4]-考试结束")
+    private String refState;
+
+    /**
+     * 答题正确:[0]-初始化,[1]-正确,[2]-错误
+     */
+    @Excel(name = "答题正确:[0]-初始化,[1]-正确,[2]-错误")
+    private String answerRight;
+
+    /**
+     * 模拟器出题值/电阻代表值
+     */
+    @Excel(name = "模拟器出题值/电阻代表值")
+    private String simFaultQuestionValue;
+
+    /**
+     * 模拟器答题值/电阻代表值
+     */
+    @Excel(name = "模拟器答题值/电阻代表值")
+    private String simFaultAnswerValue;
+
+    public void setRefId(Long refId) {
+        this.refId = refId;
+    }
+
+    public Long getRefId() {
+        return refId;
+    }
+
+    public void setSimId(Long simId) {
+        this.simId = simId;
+    }
+
+    public Long getSimId() {
+        return simId;
+    }
+
+    public void setFaultId(String faultId) {
+        this.faultId = faultId;
+    }
+
+    public String getFaultId() {
+        return faultId;
+    }
+
+    public void setFlag(String flag) {
+        this.flag = flag;
+    }
+
+    public String getFlag() {
+        return flag;
+    }
+
+    public void setRefState(String refState) {
+        this.refState = refState;
+    }
+
+    public String getRefState() {
+        return refState;
+    }
+
+    public void setAnswerRight(String answerRight) {
+        this.answerRight = answerRight;
+    }
+
+    public String getAnswerRight() {
+        return answerRight;
+    }
+
+    public void setSimFaultQuestionValue(String simFaultQuestionValue) {
+        this.simFaultQuestionValue = simFaultQuestionValue;
+    }
+
+    public String getSimFaultQuestionValue() {
+        return simFaultQuestionValue;
+    }
+
+    public void setSimFaultAnswerValue(String simFaultAnswerValue) {
+        this.simFaultAnswerValue = simFaultAnswerValue;
+    }
+
+    public String getSimFaultAnswerValue() {
+        return simFaultAnswerValue;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("refId", getRefId())
+                .append("simId", getSimId())
+                .append("faultId", getFaultId())
+                .append("flag", getFlag())
+                .append("refState", getRefState())
+                .append("answerRight", getAnswerRight())
+                .append("simFaultQuestionValue", getSimFaultQuestionValue())
+                .append("simFaultAnswerValue", getSimFaultAnswerValue())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

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

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.DebugFault;
+
+/**
+ * 调试故障Mapper接口
+ *
+ * @author tom
+ * @date 2025-02-10
+ */
+public interface DebugFaultMapper {
+    /**
+     * 查询调试故障
+     *
+     * @param refId 调试故障主键
+     * @return 调试故障
+     */
+    public DebugFault selectDebugFaultByRefId(Long refId);
+
+    /**
+     * 查询调试故障列表
+     *
+     * @param debugFault 调试故障
+     * @return 调试故障集合
+     */
+    public List<DebugFault> selectDebugFaultList(DebugFault debugFault);
+
+    /**
+     * 新增调试故障
+     *
+     * @param debugFault 调试故障
+     * @return 结果
+     */
+    public int insertDebugFault(DebugFault debugFault);
+
+    /**
+     * 修改调试故障
+     *
+     * @param debugFault 调试故障
+     * @return 结果
+     */
+    public int updateDebugFault(DebugFault debugFault);
+
+    /**
+     * 删除调试故障
+     *
+     * @param refId 调试故障主键
+     * @return 结果
+     */
+    public int deleteDebugFaultByRefId(Long refId);
+
+    /**
+     * 批量删除调试故障
+     *
+     * @param refIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteDebugFaultByRefIds(Long[] refIds);
+}

+ 83 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/DebugFaultService.java

@@ -0,0 +1,83 @@
+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.DebugFaultMapper;
+import com.ruoyi.sim.domain.DebugFault;
+
+/**
+ * 调试故障Service业务层处理
+ *
+ * @author tom
+ * @date 2025-02-10
+ */
+@Service
+public class DebugFaultService {
+    @Autowired
+    private DebugFaultMapper debugFaultMapper;
+
+    /**
+     * 查询调试故障
+     *
+     * @param refId 调试故障主键
+     * @return 调试故障
+     */
+    public DebugFault selectDebugFaultByRefId(Long refId) {
+        return debugFaultMapper.selectDebugFaultByRefId(refId);
+    }
+
+    /**
+     * 查询调试故障列表
+     *
+     * @param debugFault 调试故障
+     * @return 调试故障
+     */
+    public List<DebugFault> selectDebugFaultList(DebugFault debugFault) {
+        return debugFaultMapper.selectDebugFaultList(debugFault);
+    }
+
+    /**
+     * 新增调试故障
+     *
+     * @param debugFault 调试故障
+     * @return 结果
+     */
+    public int insertDebugFault(DebugFault debugFault) {
+        debugFault.setCreateTime(DateUtils.getNowDate());
+        return debugFaultMapper.insertDebugFault(debugFault);
+    }
+
+    /**
+     * 修改调试故障
+     *
+     * @param debugFault 调试故障
+     * @return 结果
+     */
+    public int updateDebugFault(DebugFault debugFault) {
+        debugFault.setUpdateTime(DateUtils.getNowDate());
+        return debugFaultMapper.updateDebugFault(debugFault);
+    }
+
+    /**
+     * 批量删除调试故障
+     *
+     * @param refIds 需要删除的调试故障主键
+     * @return 结果
+     */
+    public int deleteDebugFaultByRefIds(Long[] refIds) {
+        return debugFaultMapper.deleteDebugFaultByRefIds(refIds);
+    }
+
+    /**
+     * 删除调试故障信息
+     *
+     * @param refId 调试故障主键
+     * @return 结果
+     */
+    public int deleteDebugFaultByRefId(Long refId) {
+        return debugFaultMapper.deleteDebugFaultByRefId(refId);
+    }
+}

+ 125 - 0
ruoyi-sim/src/main/resources/mapper/sim/DebugFaultMapper.xml

@@ -0,0 +1,125 @@
+<?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.DebugFaultMapper">
+
+    <resultMap type="DebugFault" id="DebugFaultResult">
+        <result property="refId" column="ref_id"/>
+        <result property="simId" column="sim_id"/>
+        <result property="faultId" column="fault_id"/>
+        <result property="flag" column="flag"/>
+        <result property="refState" column="ref_state"/>
+        <result property="answerRight" column="answer_right"/>
+        <result property="simFaultQuestionValue" column="sim_fault_question_value"/>
+        <result property="simFaultAnswerValue" column="sim_fault_answer_value"/>
+        <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="selectDebugFaultVo">
+        select ref_id,
+               sim_id,
+               fault_id,
+               flag,
+               ref_state,
+               answer_right,
+               sim_fault_question_value,
+               sim_fault_answer_value,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from sim_debug_fault
+    </sql>
+
+    <select id="selectDebugFaultList" parameterType="DebugFault" resultMap="DebugFaultResult">
+        <include refid="selectDebugFaultVo"/>
+        <where>
+            <if test="simId != null ">and sim_id = #{simId}</if>
+            <if test="faultId != null  and faultId != ''">and fault_id = #{faultId}</if>
+            <if test="flag != null  and flag != ''">and flag = #{flag}</if>
+            <if test="refState != null  and refState != ''">and ref_state = #{refState}</if>
+            <if test="answerRight != null  and answerRight != ''">and answer_right = #{answerRight}</if>
+            <if test="simFaultQuestionValue != null  and simFaultQuestionValue != ''">and sim_fault_question_value =
+                #{simFaultQuestionValue}
+            </if>
+            <if test="simFaultAnswerValue != null  and simFaultAnswerValue != ''">and sim_fault_answer_value =
+                #{simFaultAnswerValue}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectDebugFaultByRefId" parameterType="Long" resultMap="DebugFaultResult">
+        <include refid="selectDebugFaultVo"/>
+        where ref_id = #{refId}
+    </select>
+
+    <insert id="insertDebugFault" parameterType="DebugFault">
+        <selectKey keyProperty="refId" order="AFTER" resultType="java.lang.Long">
+            select LAST_INSERT_ID()
+        </selectKey>
+        insert into sim_debug_fault
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="refId != null">ref_id,</if>
+            <if test="simId != null">sim_id,</if>
+            <if test="faultId != null and faultId != ''">fault_id,</if>
+            <if test="flag != null">flag,</if>
+            <if test="refState != null">ref_state,</if>
+            <if test="answerRight != null">answer_right,</if>
+            <if test="simFaultQuestionValue != null">sim_fault_question_value,</if>
+            <if test="simFaultAnswerValue != null">sim_fault_answer_value,</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="refId != null">#{refId},</if>
+            <if test="simId != null">#{simId},</if>
+            <if test="faultId != null and faultId != ''">#{faultId},</if>
+            <if test="flag != null">#{flag},</if>
+            <if test="refState != null">#{refState},</if>
+            <if test="answerRight != null">#{answerRight},</if>
+            <if test="simFaultQuestionValue != null">#{simFaultQuestionValue},</if>
+            <if test="simFaultAnswerValue != null">#{simFaultAnswerValue},</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="updateDebugFault" parameterType="DebugFault">
+        update sim_debug_fault
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="simId != null">sim_id = #{simId},</if>
+            <if test="faultId != null and faultId != ''">fault_id = #{faultId},</if>
+            <if test="flag != null">flag = #{flag},</if>
+            <if test="refState != null">ref_state = #{refState},</if>
+            <if test="answerRight != null">answer_right = #{answerRight},</if>
+            <if test="simFaultQuestionValue != null">sim_fault_question_value = #{simFaultQuestionValue},</if>
+            <if test="simFaultAnswerValue != null">sim_fault_answer_value = #{simFaultAnswerValue},</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 ref_id = #{refId}
+    </update>
+
+    <delete id="deleteDebugFaultByRefId" parameterType="Long">
+        delete
+        from sim_debug_fault
+        where ref_id = #{refId}
+    </delete>
+
+    <delete id="deleteDebugFaultByRefIds" parameterType="String">
+        delete from sim_debug_fault where ref_id in
+        <foreach item="refId" collection="array" open="(" separator="," close=")">
+            #{refId}
+        </foreach>
+    </delete>
+</mapper>