From 7d96251e65c7f7ffc035865e195787e9a8462050 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 03 六月 2024 14:02:09 +0800
Subject: [PATCH] 最新版本

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveTemplServiceImpl.java |   20 ++++++++++++++++++--
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/ApproveTemplCloudController.java         |   11 +++++++++++
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/ApproveTemplService.java          |    1 +
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/ApproveTemplCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/ApproveTemplCloudController.java
index 7d82a68..76addf2 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/ApproveTemplCloudController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/ApproveTemplCloudController.java
@@ -12,6 +12,7 @@
 import com.doumee.service.business.ApproveTemplService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -85,6 +86,16 @@
         ExcelExporter.build(ApproveTempl.class).export(approveTemplService.findPage(pageWrap).getRecords(), "瀹℃壒妯$増淇℃伅琛�", response);
     }
 
+    @ApiOperation("鏍规嵁Type鏌ヨ")
+    @GetMapping("/{type}")
+    @CloudRequiredPermission("business:approvetempl:query")
+    public ApiResponse<ApproveTempl> findByType(@PathVariable Integer type,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+        ApproveTempl templ =new ApproveTempl();
+        templ.setIsdeleted(Constants.ZERO);
+        templ.setType(type);
+        return ApiResponse.success(approveTemplService.findOne(templ));
+    }
+
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @CloudRequiredPermission("business:approvetempl:query")
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/ApproveTemplService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/ApproveTemplService.java
index 662e9c0..46095fb 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/ApproveTemplService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/ApproveTemplService.java
@@ -97,4 +97,5 @@
     long count(ApproveTempl approveTempl);
 
     int save(ApproveTempl approveTempl);
+
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveTemplServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveTemplServiceImpl.java
index b940e2e..83bbb7b 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveTemplServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveTemplServiceImpl.java
@@ -11,6 +11,7 @@
 import com.doumee.dao.business.ApproveTemplMapper;
 import com.doumee.dao.business.MemberMapper;
 import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.vo.ApproveParamDataVO;
 import com.doumee.service.business.ApproveTemplService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -24,6 +25,8 @@
 
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * 瀹℃壒妯$増淇℃伅琛⊿ervice瀹炵幇
@@ -67,6 +70,7 @@
             template.setName(Constants.ApproveTmplType.getName(model.getType()));
             approveTemplMapper.insert(template);
         }
+        int level = 0;
         if(model.getParamList()!=null && model.getParamList().size()>0){
             for(ApproveParam param : model.getParamList()){
                 param.setCreateDate(date);
@@ -74,11 +78,14 @@
                 param.setEditDate(date);
                 param.setEditor(loginUserInfo.getId());
                 param.setIsdeleted(Constants.ZERO);
+//                param.setLevel(level);
+                param.setMemberType(Constants.formatIntegerNum(param.getMemberType()));
                 param.setTemplId(template.getId());
                 param.setType(Constants.formatIntegerNum(param.getType()));
                 param.setAddrParam(Constants.formatIntegerNum(param.getAddrParam()));
                 param.setDriverParam(Constants.formatIntegerNum(param.getDriverParam()));
                 param.setApproveType(Constants.formatIntegerNum(param.getApproveType()));
+                level ++ ;
             }
             //鍏堟竻闄ゅ師鏉ユ墍鏈夌殑灏遍櫔閰嶇疆
             approveParamMapper.delete(new UpdateWrapper<ApproveParam>().lambda()
@@ -86,7 +93,7 @@
             //鎵归噺鎻掑叆鏂扮殑閰嶇疆
             approveParamMapper.insertBatchSomeColumn(model.getParamList());
         }
-        return model.getId();
+        return 1;
     }
 
     @Override
@@ -144,7 +151,16 @@
     @Override
     public ApproveTempl findOne(ApproveTempl approveTempl) {
         QueryWrapper<ApproveTempl> wrapper = new QueryWrapper<>(approveTempl);
-        return approveTemplMapper.selectOne(wrapper);
+        ApproveTempl model =  approveTemplMapper.selectOne(wrapper.lambda().last("limit 1"));
+        if(model!=null){
+            List<ApproveParam> approveParamList = approveParamMapper.selectList(new QueryWrapper<ApproveParam>()
+                    .lambda().eq(ApproveParam::getIsdeleted,Constants.ZERO)
+                    .eq(ApproveParam::getTemplId,model.getId())
+                    .orderByAsc(ApproveParam::getLevel)
+            );
+            model.setParamList(approveParamList);
+        }
+        return model;
     }
 
     @Override

--
Gitblit v1.9.3