tom 5 месяцев назад
Родитель
Сommit
023607d995

+ 20 - 16
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/FaultController.java

@@ -7,9 +7,16 @@ import com.ruoyi.sim.domain.vo.FaultTree;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+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;
@@ -23,7 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
  * 故障Controller
  *
  * @author tom
- * @date 2024-12-13
+ * @date 2024-12-15
  */
 @RestController
 @RequestMapping("/sim/fault")
@@ -45,9 +52,9 @@ public class FaultController extends BaseController {
     /**
      * 导出故障列表
      */
-    @PreAuthorize("@ss.hasPermi('sim:fault:export')")
+    // @PreAuthorize("@ss.hasPermi('sim:fault:export')")
     @Log(title = "故障", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
+    // @PostMapping("/export")
     public void export(HttpServletResponse response, Fault fault) {
         List<Fault> list = faultService.selectFaultList(fault);
         ExcelUtil<Fault> util = new ExcelUtil<Fault>(Fault.class);
@@ -66,9 +73,9 @@ public class FaultController extends BaseController {
     /**
      * 新增故障
      */
-    @PreAuthorize("@ss.hasPermi('sim:fault:add')")
+    // @PreAuthorize("@ss.hasPermi('sim:fault:add')")
     @Log(title = "故障", businessType = BusinessType.INSERT)
-    @PostMapping
+    // @PostMapping
     public AjaxResult add(@RequestBody Fault fault) {
         return toAjax(faultService.insertFault(fault));
     }
@@ -76,9 +83,9 @@ public class FaultController extends BaseController {
     /**
      * 修改故障
      */
-    @PreAuthorize("@ss.hasPermi('sim:fault:edit')")
+    // @PreAuthorize("@ss.hasPermi('sim:fault:edit')")
     @Log(title = "故障", businessType = BusinessType.UPDATE)
-    @PutMapping
+    // @PutMapping
     public AjaxResult edit(@RequestBody Fault fault) {
         return toAjax(faultService.updateFault(fault));
     }
@@ -86,9 +93,9 @@ public class FaultController extends BaseController {
     /**
      * 删除故障
      */
-    @PreAuthorize("@ss.hasPermi('sim:fault:remove')")
+    // @PreAuthorize("@ss.hasPermi('sim:fault:remove')")
     @Log(title = "故障", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{faultIds}")
+    // @DeleteMapping("/{faultIds}")
     public AjaxResult remove(@PathVariable String[] faultIds) {
         return toAjax(faultService.deleteFaultByFaultIds(faultIds));
     }
@@ -96,12 +103,9 @@ public class FaultController extends BaseController {
     // -------------------------------- tom add  --------------------------------
     private static final Logger logger = LoggerFactory.getLogger(FaultController.class);
 
-    /**
-     * 查询故障列表
-     */
-    // @PreAuthorize("@ss.hasPermi('sim:fault:list')")
+    // @PreAuthorize("@ss.hasPermi('sim:fault:listAllTreeViaSimType')")
     @GetMapping("/listAllTreeViaSimType/{simType}")
-    @ApiOperation("通过模拟器类型,查询故障列表")
+    @ApiOperation("通过模拟器类型,查询故障列表。")
     public TableDataInfo listAllTreeViaSimType(@PathVariable(value = "simType") String simType) {
         Fault fault = new Fault();
         fault.setSimType(simType);

+ 18 - 3
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/Fault.java

@@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * 故障对象 sim_fault
  *
  * @author tom
- * @date 2024-12-13
+ * @date 2024-12-15
  */
 public class Fault extends BaseEntity {
     private static final long serialVersionUID = 1L;
@@ -49,12 +49,18 @@ public class Fault extends BaseEntity {
     private String conflictFaultId;
 
     /**
-     * 是否是更换件 1:是 0:不是
+     * 是否是更换件 1:是 0:不是
      */
-    @Excel(name = "是否是更换件 1:是 0:不是")
+    @Excel(name = "是否是更换件 1:是 0:不是")
     private String replacePart;
 
     /**
+     * 更换件名称
+     */
+    @Excel(name = "更换件名称")
+    private String replaceName;
+
+    /**
      * 名称
      */
     @Excel(name = "名称")
@@ -120,6 +126,14 @@ public class Fault extends BaseEntity {
         return replacePart;
     }
 
+    public void setReplaceName(String replaceName) {
+        this.replaceName = replaceName;
+    }
+
+    public String getReplaceName() {
+        return replaceName;
+    }
+
     public void setName(String name) {
         this.name = name;
     }
@@ -153,6 +167,7 @@ public class Fault extends BaseEntity {
                 .append("faultType", getFaultType())
                 .append("conflictFaultId", getConflictFaultId())
                 .append("replacePart", getReplacePart())
+                .append("replaceName", getReplaceName())
                 .append("name", getName())
                 .append("simMsg", getSimMsg())
                 .append("orderNum", getOrderNum())

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

@@ -9,7 +9,7 @@ import com.ruoyi.sim.domain.vo.FaultTree;
  * 故障Service接口
  *
  * @author tom
- * @date 2024-12-13
+ * @date 2024-12-15
  */
 public interface IFaultService {
     /**

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

@@ -19,7 +19,7 @@ import com.ruoyi.sim.service.IFaultService;
  * 故障Service业务层处理
  *
  * @author tom
- * @date 2024-12-13
+ * @date 2024-12-15
  */
 @Service
 public class FaultServiceImpl implements IFaultService {

+ 8 - 0
ruoyi-sim/src/main/resources/mapper/sim/FaultMapper.xml

@@ -11,6 +11,7 @@
         <result property="faultType" column="fault_type"/>
         <result property="conflictFaultId" column="conflict_fault_id"/>
         <result property="replacePart" column="replace_part"/>
+        <result property="replaceName" column="replace_name"/>
         <result property="name" column="name"/>
         <result property="simMsg" column="sim_msg"/>
         <result property="orderNum" column="order_num"/>
@@ -28,6 +29,7 @@
                fault_type,
                conflict_fault_id,
                replace_part,
+               replace_name,
                name,
                sim_msg,
                order_num,
@@ -48,6 +50,9 @@
             <if test="conflictFaultId != null  and conflictFaultId != ''">and conflict_fault_id = #{conflictFaultId}
             </if>
             <if test="replacePart != null  and replacePart != ''">and replace_part = #{replacePart}</if>
+            <if test="replaceName != null  and replaceName != ''">and replace_name like concat('%', #{replaceName},
+                '%')
+            </if>
             <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
             <if test="simMsg != null  and simMsg != ''">and sim_msg = #{simMsg}</if>
             <if test="orderNum != null ">and order_num = #{orderNum}</if>
@@ -68,6 +73,7 @@
             <if test="faultType != null">fault_type,</if>
             <if test="conflictFaultId != null">conflict_fault_id,</if>
             <if test="replacePart != null">replace_part,</if>
+            <if test="replaceName != null">replace_name,</if>
             <if test="name != null">name,</if>
             <if test="simMsg != null">sim_msg,</if>
             <if test="orderNum != null">order_num,</if>
@@ -84,6 +90,7 @@
             <if test="faultType != null">#{faultType},</if>
             <if test="conflictFaultId != null">#{conflictFaultId},</if>
             <if test="replacePart != null">#{replacePart},</if>
+            <if test="replaceName != null">#{replaceName},</if>
             <if test="name != null">#{name},</if>
             <if test="simMsg != null">#{simMsg},</if>
             <if test="orderNum != null">#{orderNum},</if>
@@ -103,6 +110,7 @@
             <if test="faultType != null">fault_type = #{faultType},</if>
             <if test="conflictFaultId != null">conflict_fault_id = #{conflictFaultId},</if>
             <if test="replacePart != null">replace_part = #{replacePart},</if>
+            <if test="replaceName != null">replace_name = #{replaceName},</if>
             <if test="name != null">name = #{name},</if>
             <if test="simMsg != null">sim_msg = #{simMsg},</if>
             <if test="orderNum != null">order_num = #{orderNum},</if>