7 Commity 1cb7c61ef8 ... 18829abe62

Autor SHA1 Wiadomość Data
  tom 18829abe62 添加DebugFault相关支持。 1 tydzień temu
  tom a8809c24c7 实验室现场数据库备份。 1 tydzień temu
  tom 42abd38de2 备份阿里云47数据库。 1 tydzień temu
  tom 39e4d38e3d 备份阿里云47数据库。 1 tydzień temu
  tom 45c0682e22 debug清除所有在线模拟器所有故障。 2 tygodni temu
  tom 8dad315b94 debug通过simNum清除一台模拟器所有故障。基本实现。 2 tygodni temu
  tom b8d0f58e58 收到报文进行CRC16校验。 2 tygodni temu

Plik diff jest za duży
+ 698 - 18
pla-sim/01_SQL/03_dev_backup/pla-chem-sim-dev-1.sql


Plik diff jest za duży
+ 4730 - 0
pla-sim/01_SQL/09_fhxy_lab_backup/pla-chem-sim-dev-1.sql


+ 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));
+    }
+}

+ 10 - 4
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/HardwareCommDebugController.java

@@ -54,10 +54,16 @@ public class HardwareCommDebugController extends BaseController {
         return success(commSendService.debugClearOneFault(simNum, bindHardwareMsg));
     }
 
-    @GetMapping(value = "/debugClearAllFault/{simNum}")
-    @ApiOperation("debug清除所有故障")
-    public AjaxResult debugClearAllFault(@PathVariable("simNum") final String simNum) {
-        return success(commSendService.debugClearAllFault(simNum));
+    @GetMapping(value = "/debugClearAllFaultViaSimNum/{simNum}")
+    @ApiOperation("debug通过simNum清除一台模拟器所有故障")
+    public AjaxResult debugClearAllFaultBySimNum(@PathVariable("simNum") final String simNum) {
+        return commSendService.debugClearAllFaultBySimNum(simNum);
+    }
+
+    @GetMapping(value = "/debugClearAllOnlineSimAllFault/")
+    @ApiOperation("debug清除所有在线模拟器所有故障")
+    public AjaxResult debugClearAllOnlineSimAllFault() {
+        return commSendService.debugClearAllOnlineSimAllFault();
     }
 
     @GetMapping(value = "/debugWriteOneFault/{simNum}/{bindHardwareMsg}")

+ 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();
+    }
+}

+ 28 - 8
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/SimMsg.java

@@ -95,6 +95,16 @@ public class SimMsg extends BaseEntity {
     @Excel(name = "重试次数")
     private Integer retryCount = 0;
 
+    /**
+     * default value false.
+     */
+    private Boolean ok = false;
+
+    /**
+     * default ""
+     */
+    private String errorMsg = "";
+
     public void setSimMsgId(Long simMsgId) {
         this.simMsgId = simMsgId;
     }
@@ -191,6 +201,22 @@ public class SimMsg extends BaseEntity {
         return retryCount;
     }
 
+    public Boolean getOk() {
+        return ok;
+    }
+
+    public void setOk(Boolean ok) {
+        this.ok = ok;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -206,6 +232,8 @@ public class SimMsg extends BaseEntity {
                 .append("receiveMsg", getReceiveMsg())
                 .append("receiveTime", getReceiveTime())
                 .append("retryCount", getRetryCount())
+                .append("ok", getOk())
+                .append("errorMsg", getErrorMsg())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())
@@ -226,12 +254,4 @@ public class SimMsg extends BaseEntity {
     public void retryCountPlus1() {
         setRetryCount(getRetryCount() + 1);
     }
-
-    public boolean isOk() {
-        return !StringUtils.isBlank(getReceiveMsg());
-    }
-
-    public boolean isNotOk() {
-        return !isOk();
-    }
 }

+ 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);
+}

+ 30 - 10
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommBuildService.java

@@ -16,7 +16,7 @@ public class CommBuildService {
     private static final Logger l = LoggerFactory.getLogger(CommBuildService.class);
     /**
      * CRC-16(Modbus)
-     *
+     * <p>
      * https://www.23bei.com/tool/59.html
      */
     public static boolean CRC_16_MODBUS = true;
@@ -71,19 +71,19 @@ public class CommBuildService {
         SimMsg smS = new SimMsg();
         smS.setSimId(idService.nextId());
         if (StringUtils.isEmpty(simNum) || StringUtils.isEmpty(cmd) || StringUtils.isEmpty(cmdId) || StringUtils.isEmpty(data)) {
-            throw new IllegalArgumentException("buildSendMsg isEmpty");
+            throw new IllegalArgumentException("buildSendMsg error 01");
         }
         if (simNum.length() != LENGTH_2) {
-            throw new IllegalArgumentException("buildSendMsg length error");
+            throw new IllegalArgumentException("buildSendMsg error 02");
         }
         if (cmd.length() != LENGTH_2) {
-            throw new IllegalArgumentException("buildSendMsg length error");
+            throw new IllegalArgumentException("buildSendMsg error 03");
         }
         if (cmdId.length() != LENGTH_2) {
-            throw new IllegalArgumentException("buildSendMsg length error");
+            throw new IllegalArgumentException("buildSendMsg error 04");
         }
         if (data.length() != LENGTH_8) {
-            throw new IllegalArgumentException("buildSendMsg length error");
+            throw new IllegalArgumentException("buildSendMsg error 05");
         }
         StringBuffer m = new StringBuffer();
         m.append(PREFIX);
@@ -92,20 +92,21 @@ public class CommBuildService {
         m.append(cmd);
         m.append(cmdId);
         m.append(data);
+        // 追加CRC校验
         if (CRC_16_MODBUS) {
             String crcContent = m.toString();
             byte[] sendByteContent = CommSendService.hexStrToByteArrs(crcContent);
-            l.info("sendByteContent = {}", CommSendService.bytesToHexV2(sendByteContent));
+            // l.info("sendByteContent = {}", CommSendService.bytesToHexV2(sendByteContent));
             byte[] sendByteCrc = CRC16Modbus.calculateCRC(sendByteContent);
-            l.info("sendByteCrc = {}", CommSendService.bytesToHexV2(sendByteCrc));
+            // l.info("sendByteCrc = {}", CommSendService.bytesToHexV2(sendByteCrc));
             String crc = CommSendService.bytesToHexV2(sendByteCrc);
-            l.debug("crc: {}", crc.toUpperCase());
+            // l.debug("crc: {}", crc.toUpperCase());
             m.append(crc.toUpperCase());
         }
         m.append(SUFFIX);
         final String mFinal = m.toString();
         if (mFinal.length() != LENGTH_24) {
-            throw new IllegalArgumentException("buildSendMsg length error");
+            throw new IllegalArgumentException("buildSendMsg error 06");
         }
         smS.setSendMsg(mFinal);
         return smS;
@@ -118,22 +119,41 @@ public class CommBuildService {
      * @return
      */
     public boolean checkReceiveMsg(String receiveMsg) {
+        // 不能是empty
         if (StringUtils.isEmpty(receiveMsg)) {
             return false;
         }
+        // 长度
         if (receiveMsg.length() != LENGTH_24) {
             return false;
         }
+        // 数据方向
         final String orn = StringUtils.substring(receiveMsg, 4, 6);
         if (!ORN_RECEIVE.equals(orn)) {
             return false;
         }
+        // 前缀
         if (!StringUtils.startsWith(receiveMsg, PREFIX)) {
             return false;
         }
+        // 后缀
         if (!StringUtils.endsWith(receiveMsg, SUFFIX)) {
             return false;
         }
+        // 计算CRC16
+        if (false) {
+            String crcContent = receiveMsg.substring(0, 18);
+            l.debug("crcContent: {}", crcContent.toUpperCase());
+            byte[] receiveByteContent = CommSendService.hexStrToByteArrs(crcContent);
+            byte[] receiveByteCrc = CRC16Modbus.calculateCRC(receiveByteContent);
+            String crc = CommSendService.bytesToHexV2(receiveByteCrc);
+            l.debug("crc: {}", crc.toUpperCase());
+//            if (!receiveMsg.substring(19, 22).equals(crc.toUpperCase())) {
+//                throw new IllegalArgumentException("checkReceiveMsg length error");
+//            }
+
+            // todo: 比对校验值,不正确。
+        }
         return true;
     }
 }

+ 3 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommConst.java

@@ -46,6 +46,9 @@ public interface CommConst {
      * 报文长度
      */
     int LENGTH_20 = 20;
+    /**
+     * 添加CRC后的报文长度
+     */
     int LENGTH_24 = 24;
 
     /**

+ 22 - 8
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommSendService.java

@@ -333,19 +333,36 @@ public class CommSendService {
         return send(sm, null, RETRY_COUNT_CLEAR_ONE_FAULT, SLEEP_LONG);
     }
 
+    public AjaxResult debugClearAllOnlineSimAllFault() {
+        simService.listAllOnline().forEach(s -> {
+            AjaxResult ar = debugClearAllFaultBySimNum(s.getSimNum());
+        });
+        return AjaxResult.success("清除成功,清除所有在线模拟器所有故障!");
+    }
+
     /**
      * debug清除所有故障
      *
      * @param simNum
      * @return
      */
-    public List<SimMsg> debugClearAllFault(final String simNum) {
+    public AjaxResult debugClearAllFaultBySimNum(final String simNum) {
+        Sim s = simService.uniqueBySimNum(simNum);
+        if (s == null) {
+            return AjaxResult.error("清除失败,对应simNum模拟器不存在!");
+        }
+        if (!Sim.State.ONLINE.equals(s.getSimState())) {
+            return AjaxResult.error("清除失败,模拟器尚未在线!");
+        }
         List<SimMsg> list = new ArrayList<>();
-        String simType = simService.uniqueBySimNum(simNum).getSimType();
-        for (String b : getGZBWBySimType(simType)) {
-            list.add(debugClearOneFault(simNum, b));
+        for (String b : getGZBWBySimType(s.getSimType())) {
+            SimMsg sm = debugClearOneFault(simNum, b);
+            list.add(sm);
+            if (sm != null && !sm.getOk()) {
+
+            }
         }
-        return list;
+        return AjaxResult.success("清除成功,清除当前模拟器所有故障!");
     }
 
     /**
@@ -449,9 +466,6 @@ public class CommSendService {
         // 下发故障
         SimMsg smA1 = commBuildService.buildSendMsgWriteFault(s.getSimNum(), f.getBindHardwareMsg());
         SimMsg smA2 = send(smA1, s, RETRY_COUNT_WRITE_ONE_FAULT, SLEEP_LONG);
-        if (smA2.isOk()) {
-
-        }
     }
 
     /**

+ 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);
+    }
+}

+ 16 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/FaultService.java

@@ -275,6 +275,22 @@ public class FaultService {
         return AjaxResult.success(list2);
     }
 
+    /**
+     * todo: 修改成数据库查询。
+     * @param simType
+     * @param faultType
+     * @return
+     */
+    public List<Fault> listEnableByTypeZZZZ(final String simType, final String faultType) {
+        List<Fault> list1 = new ArrayList<>();
+        Fault q = new Fault();
+        q.setSimType(simType);
+        q.setFaultState(Fault.State.ENABLE);
+        q.setFaultType(faultType);
+        list1.addAll(selectFaultList(q));
+        return list1;
+    }
+
 
     /**
      * 根据模拟器型号,查询故障列表tree。

+ 1 - 1
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamService.java

@@ -354,7 +354,7 @@ public class RealExamService {
         }
         // 检查 sim_id 是否正确存在
         {
-            if (!simService.exist(re.getSimId())) {
+            if (!simService.existBySimId(re.getSimId())) {
                 return AjaxResult.error("对应模拟器Id不存在!");
             }
         }

+ 25 - 4
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimService.java

@@ -89,21 +89,32 @@ public class SimService {
 
     // -------------------------------- tom add  --------------------------------
 
-    public boolean exist(Long simId) {
+    public boolean existBySimId(final Long simId) {
         if (simId == null) {
             return false;
         }
         if (simId == 0) {
             return false;
         }
-        Sim sim = selectSimBySimId(simId);
-        if (sim == null) {
+        Sim s = selectSimBySimId(simId);
+        if (s == null) {
+            return false;
+        }
+        return true;
+    }
+
+    public boolean existBySimNum(final String simNum) {
+        if (StringUtils.isEmpty(simNum)) {
+            return false;
+        }
+        Sim s = uniqueBySimNum(simNum);
+        if (s == null) {
             return false;
         }
         return true;
     }
 
-    public Sim uniqueBySimNum(String simNum) {
+    public Sim uniqueBySimNum(final String simNum) {
         Sim q = new Sim();
         q.setSimNum(simNum);
         List<Sim> simList = simMapper.selectSimList(q);
@@ -136,6 +147,16 @@ public class SimService {
         return list;
     }
 
+    public List<Sim> listAllOnline() {
+        List<Sim> list = new ArrayList<>();
+        listAll()
+                .stream()
+                .filter(Objects::nonNull)
+                .filter(s -> Sim.State.ONLINE.equals(s.getSimState()))
+                .forEach(list::add);
+        return list;
+    }
+
     public List<Sim> listAllEnableBySimType(String simType) {
         List<Sim> list = new ArrayList<>();
         listAll()

+ 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>

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików