From 420fc99fd32eb6d19ef9f83fecf06ae234f7d31f Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期五, 16 五月 2025 15:20:38 +0800
Subject: [PATCH] art: 设备管理-设备处置 借用归还 删除接口

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java    |   21 ++++++++++++++++-----
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java |    1 +
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java
index 0c438eb..b9fbed6 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java
@@ -1,6 +1,5 @@
 package org.jeecg.modules.eam.controller;
 
-import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
@@ -8,6 +7,7 @@
 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.modules.eam.constant.BusinessCodeConst;
 import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum;
@@ -17,11 +17,10 @@
 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;
+import java.util.List;
 
 /**
  * @Description: 璁惧鍊熷嚭褰掕繕
@@ -75,6 +74,7 @@
         String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.LEAN_OUT_CODE_RULE);
         request.setCode(codeSeq);
         request.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_SUBMIT.name());
+        request.setDelFlag(CommonConstant.DEL_FLAG_0);
         boolean b = eamEquipmentLeanOutService.addLeanOut(request);
         if (!b) {
             return Result.error("娣诲姞澶辫触锛�");
@@ -112,7 +112,11 @@
     @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-閫氳繃id鍒犻櫎", notes = "璁惧鍊熷嚭褰掕繕-閫氳繃id鍒犻櫎")
     @DeleteMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        eamEquipmentLeanOutService.removeById(id);
+        EamEquipmentLeanOut entity = eamEquipmentLeanOutService.getById(id);
+        if (entity != null) {
+            entity.setDelFlag(CommonConstant.DEL_FLAG_1);
+            eamEquipmentLeanOutService.updateById(entity);
+        }
         return Result.OK("鍒犻櫎鎴愬姛!");
     }
 
@@ -126,7 +130,14 @@
     @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-鎵归噺鍒犻櫎", notes = "璁惧鍊熷嚭褰掕繕-鎵归噺鍒犻櫎")
     @DeleteMapping(value = "/deleteBatch")
     public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        this.eamEquipmentLeanOutService.removeByIds(Arrays.asList(ids.split(",")));
+        List<String> list = Arrays.asList(ids.split(","));
+        list.forEach(id -> {
+            EamEquipmentLeanOut entity = eamEquipmentLeanOutService.getById(id);
+            if (entity != null) {
+                entity.setDelFlag(CommonConstant.DEL_FLAG_1);
+                eamEquipmentLeanOutService.updateById(entity);
+            }
+        });
         return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�");
     }
 
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java
index c122711..be7c6ea 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java
@@ -47,6 +47,7 @@
     @Override
     public IPage<EamEquipmentLeanOut> queryPageList(Page<EamEquipmentLeanOut> page, EamEquipmentLeanOutQuery query) {
         QueryWrapper<EamEquipmentLeanOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("wmo.del_flag", CommonConstant.DEL_FLAG_0);
         //鐢ㄦ埛鏁版嵁鏉冮檺
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         if (sysUser == null) {

--
Gitblit v1.9.3