From f6fa169b501a886cecf6561ad2f4676e7f0d1b9a Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 19 三月 2025 14:53:47 +0800
Subject: [PATCH] art: 设备管理-故障原因维护 功能添加

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentFaultReasonController.java    |  161 ++++++++++++++++++++++++++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentFaultReasonMapper.java            |   17 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java |   19 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentFaultReasonMapper.xml         |    5 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java         |   14 ++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java                      |    2 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentFaultReason.java                  |   65 +++++++++++++
 7 files changed, 283 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
index 849a90a..d19aa5e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
@@ -5,4 +5,6 @@
     String PRECISION_PARAMETERS_RULE = "PrecisionParametersRule";
     //宸ヨ壓鍙傛暟缂栫爜瑙勫垯
     String PROCESS_PARAMETERS_RULE = "ProcessParametersRule";
+    //璁惧鏁呴殰鍘熷洜缂栫爜瑙勫垯
+    String EQUIPMENT_FAULT_REASON_RULE = "EquipmentFaultReasonRule";
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentFaultReasonController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentFaultReasonController.java
new file mode 100644
index 0000000..65fb78d
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentFaultReasonController.java
@@ -0,0 +1,161 @@
+package org.jeecg.modules.eam.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.eam.constant.BusinessCodeConst;
+import org.jeecg.modules.eam.entity.EamEquipmentFaultReason;
+import org.jeecg.modules.eam.service.IEamEquipmentFaultReasonService;
+import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+ /**
+ * @Description: 璁惧鏁呴殰鍘熷洜缁存姢
+ * @Author: jeecg-boot
+ * @Date:   2025-03-19
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags="璁惧鏁呴殰鍘熷洜缁存姢")
+@RestController
+@RequestMapping("/eam/equipmentFaultReason")
+public class EamEquipmentFaultReasonController extends JeecgController<EamEquipmentFaultReason, IEamEquipmentFaultReasonService> {
+	@Autowired
+	private IEamEquipmentFaultReasonService eamEquipmentFaultReasonService;
+
+	@Autowired
+	private ISysBusinessCodeRuleService businessCodeRuleService;
+	/**
+	 * 鍒嗛〉鍒楄〃鏌ヨ
+	 *
+	 * @param eamEquipmentFaultReason
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "璁惧鏁呴殰鍘熷洜缁存姢-鍒嗛〉鍒楄〃鏌ヨ")
+	@ApiOperation(value="璁惧鏁呴殰鍘熷洜缁存姢-鍒嗛〉鍒楄〃鏌ヨ", notes="璁惧鏁呴殰鍘熷洜缁存姢-鍒嗛〉鍒楄〃鏌ヨ")
+	@GetMapping(value = "/list")
+	public Result<?> queryPageList(EamEquipmentFaultReason eamEquipmentFaultReason,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<EamEquipmentFaultReason> queryWrapper = QueryGenerator.initQueryWrapper(eamEquipmentFaultReason, req.getParameterMap());
+		queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
+		Page<EamEquipmentFaultReason> page = new Page<EamEquipmentFaultReason>(pageNo, pageSize);
+		IPage<EamEquipmentFaultReason> pageList = eamEquipmentFaultReasonService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 * 娣诲姞
+	 *
+	 * @param eamEquipmentFaultReason
+	 * @return
+	 */
+	@AutoLog(value = "璁惧鏁呴殰鍘熷洜缁存姢-娣诲姞")
+	@ApiOperation(value="璁惧鏁呴殰鍘熷洜缁存姢-娣诲姞", notes="璁惧鏁呴殰鍘熷洜缁存姢-娣诲姞")
+	@PostMapping(value = "/add")
+	public Result<?> add(@RequestBody EamEquipmentFaultReason eamEquipmentFaultReason) {
+		String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.EQUIPMENT_FAULT_REASON_RULE);
+		eamEquipmentFaultReason.setFaultCode(codeSeq);
+		eamEquipmentFaultReason.setDelFlag(CommonConstant.DEL_FLAG_0);
+		eamEquipmentFaultReasonService.save(eamEquipmentFaultReason);
+		return Result.OK("娣诲姞鎴愬姛锛�");
+	}
+	
+	/**
+	 * 缂栬緫
+	 *
+	 * @param eamEquipmentFaultReason
+	 * @return
+	 */
+	@AutoLog(value = "璁惧鏁呴殰鍘熷洜缁存姢-缂栬緫")
+	@ApiOperation(value="璁惧鏁呴殰鍘熷洜缁存姢-缂栬緫", notes="璁惧鏁呴殰鍘熷洜缁存姢-缂栬緫")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<?> edit(@RequestBody EamEquipmentFaultReason eamEquipmentFaultReason) {
+		eamEquipmentFaultReasonService.updateById(eamEquipmentFaultReason);
+		return Result.OK("缂栬緫鎴愬姛!");
+	}
+	
+	/**
+	 * 閫氳繃id鍒犻櫎
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "璁惧鏁呴殰鍘熷洜缁存姢-閫氳繃id鍒犻櫎")
+	@ApiOperation(value="璁惧鏁呴殰鍘熷洜缁存姢-閫氳繃id鍒犻櫎", notes="璁惧鏁呴殰鍘熷洜缁存姢-閫氳繃id鍒犻櫎")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		eamEquipmentFaultReasonService.removeById(id);
+		return Result.OK("鍒犻櫎鎴愬姛!");
+	}
+	
+	/**
+	 * 鎵归噺鍒犻櫎
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "璁惧鏁呴殰鍘熷洜缁存姢-鎵归噺鍒犻櫎")
+	@ApiOperation(value="璁惧鏁呴殰鍘熷洜缁存姢-鎵归噺鍒犻櫎", notes="璁惧鏁呴殰鍘熷洜缁存姢-鎵归噺鍒犻櫎")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.eamEquipmentFaultReasonService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�");
+	}
+	
+	/**
+	 * 閫氳繃id鏌ヨ
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "璁惧鏁呴殰鍘熷洜缁存姢-閫氳繃id鏌ヨ")
+	@ApiOperation(value="璁惧鏁呴殰鍘熷洜缁存姢-閫氳繃id鏌ヨ", notes="璁惧鏁呴殰鍘熷洜缁存姢-閫氳繃id鏌ヨ")
+	@GetMapping(value = "/queryById")
+	public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
+		EamEquipmentFaultReason eamEquipmentFaultReason = eamEquipmentFaultReasonService.getById(id);
+		return Result.OK(eamEquipmentFaultReason);
+	}
+
+  /**
+   * 瀵煎嚭excel
+   *
+   * @param request
+   * @param eamEquipmentFaultReason
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, EamEquipmentFaultReason eamEquipmentFaultReason) {
+      return super.exportXls(request, eamEquipmentFaultReason, EamEquipmentFaultReason.class, "璁惧鏁呴殰鍘熷洜缁存姢");
+  }
+
+  /**
+   * 閫氳繃excel瀵煎叆鏁版嵁
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      return super.importExcel(request, response, EamEquipmentFaultReason.class);
+  }
+
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentFaultReason.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentFaultReason.java
new file mode 100644
index 0000000..a4a4b98
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentFaultReason.java
@@ -0,0 +1,65 @@
+package org.jeecg.modules.eam.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+import java.util.Date;
+/**
+ * @Description: 璁惧鏁呴殰鍘熷洜缁存姢
+ * @Author: jeecg-boot
+ * @Date:   2025-03-19
+ * @Version: V1.0
+ */
+@Data
+@TableName("eam_equipment_fault_reason")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="eam_equipment_fault_reason瀵硅薄", description="璁惧鏁呴殰鍘熷洜缁存姢")
+public class EamEquipmentFaultReason implements Serializable {
+    
+	/**涓婚敭*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "涓婚敭")
+	private java.lang.String id;
+	/**鍒涘缓浜�*/
+    @ApiModelProperty(value = "鍒涘缓浜�")
+	private java.lang.String createBy;
+	/**鍒涘缓鏃堕棿*/
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+	private java.util.Date createTime;
+	/**鏇存柊浜�*/
+    @ApiModelProperty(value = "鏇存柊浜�")
+	private java.lang.String updateBy;
+	/**鏇存柊鏃堕棿*/
+    @ApiModelProperty(value = "鏇存柊鏃堕棿")
+	private java.util.Date updateTime;
+	/**鍒犻櫎鏍囪*/
+    @ApiModelProperty(value = "鍒犻櫎鏍囪")
+	private java.lang.Integer delFlag;
+	/**鏁呴殰缂栫爜*/
+	@Excel(name = "鏁呴殰缂栫爜", width = 25)
+    @ApiModelProperty(value = "鏁呴殰缂栫爜")
+	private java.lang.String faultCode;
+	/**鏁呴殰绠�绉�*/
+	@Excel(name = "鏁呴殰绠�绉�", width = 25)
+    @ApiModelProperty(value = "鏁呴殰绠�绉�")
+	private java.lang.String faultName;
+	/**鏁呴殰鎻忚堪*/
+	@Excel(name = "鏁呴殰鎻忚堪", width = 50)
+    @ApiModelProperty(value = "鏁呴殰鎻忚堪")
+	private java.lang.String faultDescription;
+	/**鏁呴殰鍒嗙被*/
+	@Excel(name = "鏁呴殰鍒嗙被", width = 15, dicCode = "fault_reason_category")
+    @ApiModelProperty(value = "鏁呴殰鍒嗙被")
+	@Dict(dicCode = "fault_reason_category")
+	private java.lang.String faultCategory;
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentFaultReasonMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentFaultReasonMapper.java
new file mode 100644
index 0000000..ffee336
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentFaultReasonMapper.java
@@ -0,0 +1,17 @@
+package org.jeecg.modules.eam.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.eam.entity.EamEquipmentFaultReason;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 璁惧鏁呴殰鍘熷洜缁存姢
+ * @Author: jeecg-boot
+ * @Date:   2025-03-19
+ * @Version: V1.0
+ */
+public interface EamEquipmentFaultReasonMapper extends BaseMapper<EamEquipmentFaultReason> {
+
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentFaultReasonMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentFaultReasonMapper.xml
new file mode 100644
index 0000000..cc31487
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentFaultReasonMapper.xml
@@ -0,0 +1,5 @@
+<?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="org.jeecg.modules.eam.mapper.EamEquipmentFaultReasonMapper">
+
+</mapper>
\ No newline at end of file
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java
new file mode 100644
index 0000000..dd64905
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentFaultReasonService.java
@@ -0,0 +1,14 @@
+package org.jeecg.modules.eam.service;
+
+import org.jeecg.modules.eam.entity.EamEquipmentFaultReason;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 璁惧鏁呴殰鍘熷洜缁存姢
+ * @Author: jeecg-boot
+ * @Date:   2025-03-19
+ * @Version: V1.0
+ */
+public interface IEamEquipmentFaultReasonService extends IService<EamEquipmentFaultReason> {
+
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java
new file mode 100644
index 0000000..bccb006
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentFaultReasonServiceImpl.java
@@ -0,0 +1,19 @@
+package org.jeecg.modules.eam.service.impl;
+
+import org.jeecg.modules.eam.entity.EamEquipmentFaultReason;
+import org.jeecg.modules.eam.mapper.EamEquipmentFaultReasonMapper;
+import org.jeecg.modules.eam.service.IEamEquipmentFaultReasonService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 璁惧鏁呴殰鍘熷洜缁存姢
+ * @Author: jeecg-boot
+ * @Date:   2025-03-19
+ * @Version: V1.0
+ */
+@Service
+public class EamEquipmentFaultReasonServiceImpl extends ServiceImpl<EamEquipmentFaultReasonMapper, EamEquipmentFaultReason> implements IEamEquipmentFaultReasonService {
+
+}

--
Gitblit v1.9.3