From 5355f421c7471f8ee7f1103e30229e5dbab1ea5f Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 24 四月 2026 13:10:08 +0800
Subject: [PATCH] 标准库:查看新增和更新人信息2

---
 basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java                   |    5 +-
 basic-server/src/main/resources/mapper/StandardTreeMapper.xml                               |    4 +-
 basic-server/src/main/resources/mapper/StandardProductListMapper.xml                        |   15 +++++++
 basic-server/src/main/java/com/ruoyi/basic/vo/StandardProductListVO.java                    |   22 +++++++++++
 basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java            |    3 +
 basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java |   44 +++++++++++----------
 6 files changed, 68 insertions(+), 25 deletions(-)

diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
index 52cfe55..9be3c8c 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.basic.vo.StandardProductListVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -70,6 +71,8 @@
      * @param productLists
      */
     void saveBatchProductLists(@Param("productLists") List<StandardProductList> productLists);
+
+    List<StandardProductListVO> selectStandardProductList(@Param("standardMethodListId") Integer standardMethodListId, @Param("tree") String tree, @Param("isDrag") boolean isDrag);
 }
 
 
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
index 93068d4..e01d5d0 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
@@ -9,6 +9,7 @@
 import com.ruoyi.basic.pojo.StandardMethodList;
 import com.ruoyi.basic.pojo.StandardProductList;
 import com.ruoyi.basic.pojo.StandardTree;
+import com.ruoyi.basic.vo.StandardProductListVO;
 import com.ruoyi.basic.vo.StandardTreeVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -33,9 +34,9 @@
 
     List<StandardProductList> getStandardProductListBySample(String sampleType);
 
-    List<StandardProductList> selectStandardProductListByTree(@Param("tree") String tree, @Param("sample") String sample, @Param("model") String model, @Param("trees") String trees, @Param("laboratory") String laboratory);
+    List<StandardProductListVO> selectStandardProductListByTree(@Param("tree") String tree, @Param("sample") String sample, @Param("model") String model, @Param("trees") String trees, @Param("laboratory") String laboratory);
 
-    List<StandardProductList> selectStandardProductListByTree2(@Param("tree") String tree, @Param("sample") String sample, @Param("model") String model, @Param("trees") String trees, @Param("laboratory") String laboratory);
+    List<StandardProductListVO> selectStandardProductListByTree2(@Param("tree") String tree, @Param("sample") String sample, @Param("model") String model, @Param("trees") String trees, @Param("laboratory") String laboratory);
 
 
     List<SampleTypeDto> getStandardTree2();
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
index 51dd916..945a26a 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
@@ -6,6 +6,7 @@
 import com.baomidou.mybatisplus.core.toolkit.*;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.vo.StandardProductListVO;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.basic.dto.CopyStandardProductListDto;
@@ -259,7 +260,7 @@
         String[] trees = tree.split(" - ");
         // 鍒ゆ柇鏄惁鎷栨嫿
         boolean isDrag = false;
-        List<StandardProductList> list = new ArrayList<>();
+        List<StandardProductListVO> list = new ArrayList<>();
         if (trees.length == 3) {
             List<StandardTree> treeList = new ArrayList<>();
             StandardTree standardTree = new StandardTree();
@@ -296,10 +297,6 @@
                     .eq(StandardProductList::getStandardMethodListId, id)
                     .isNull(StandardProductList::getModel)
                     .like(StandardProductList::getTree, tree));
-            if (count == 0) {
-                isDrag = true;
-            }
-
             isDrag = true;
             List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
             if (treeList.size() == 0) {
@@ -323,23 +320,22 @@
         for (StandardProductList productList : list) {
             productList.setId(IdWorker.getId());
         }
-        List<StandardProductList> standardProductLists;
+        List<StandardProductListVO> standardProductLists;
 
-        if (isDrag) {
-            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
-                    .eq(StandardProductList::getStandardMethodListId, id)
-                    .like(StandardProductList::getTree, tree)
-                    .orderByAsc(StandardProductList::getSort));
-            // 鍒ゆ柇鏄惁鏈夋病鏈夊簭鍙风殑, 娌℃湁搴忓彿閲嶇疆
-            boolean b = standardProductLists.stream().anyMatch(standardProductList -> standardProductList.getSort() == null);
-        } else {
-            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
-                    .eq(StandardProductList::getStandardMethodListId, id)
-                    .like(StandardProductList::getTree, tree));
-        }
+//        if (isDrag) {
+//            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
+//                    .eq(StandardProductList::getStandardMethodListId, id)
+//                    .like(StandardProductList::getTree, tree)
+//                    .orderByAsc(StandardProductList::getSort));
+//        } else {
+//            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
+//                    .eq(StandardProductList::getStandardMethodListId, id)
+//                    .like(StandardProductList::getTree, tree));
+//        }
+        standardProductLists = standardProductListMapper.selectStandardProductList(id,tree,isDrag);
 
-        for (StandardProductList sp : standardProductLists) {
-            for (StandardProductList pl : list) {
+        for (StandardProductListVO sp : standardProductLists) {
+            for (StandardProductListVO pl : list) {
                 // 鍒ゆ柇鏉′欢鏄惁鍙湁涓�涓�, 鏈変竴涓殑璇濋粯璁ょ涓�涓�
                 String radiusList = pl.getRadiusList();
                 if (StringUtils.isNotBlank(radiusList) && !radiusList.equals("null") && !radiusList.equals("\"\"")) {
@@ -358,6 +354,12 @@
                     pl.setId(sp.getId());
                     // 娣诲姞鎺掑簭瀛楁
                     pl.setSort(sp.getSort());
+                    pl.setCreateUserName(sp.getCreateUserName());
+                    pl.setCreateTime(sp.getCreateTime());
+                    pl.setCreateUser(sp.getCreateUser());
+                    pl.setUpdateUserName(sp.getUpdateUserName());
+                    pl.setUpdateTime(sp.getUpdateTime());
+                    pl.setUpdateUser(sp.getUpdateUser());
                     if (sp.getState() != null && !sp.getState().equals("")) {
                         pl.setState(sp.getState());
                     } else {
@@ -428,7 +430,7 @@
 //            this.saveBatch(productLists);
         // 鎵归噺娣诲姞鏍囧噯
         if (CollectionUtils.isNotEmpty(productLists)) {
-            baseMapper.saveBatchProductLists(productLists);
+            this.saveOrUpdateBatch(productLists);
         }
 
 
diff --git a/basic-server/src/main/java/com/ruoyi/basic/vo/StandardProductListVO.java b/basic-server/src/main/java/com/ruoyi/basic/vo/StandardProductListVO.java
new file mode 100644
index 0000000..2e115f2
--- /dev/null
+++ b/basic-server/src/main/java/com/ruoyi/basic/vo/StandardProductListVO.java
@@ -0,0 +1,22 @@
+package com.ruoyi.basic.vo;
+
+import com.ruoyi.basic.pojo.StandardProductList;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class StandardProductListVO extends StandardProductList {
+
+    /**
+     * 鍒涘缓浜哄悕绉�
+     */
+    @ApiModelProperty("鍒涘缓浜哄悕绉�")
+    private String createUserName;
+
+    /**
+     * 鏇存柊浜哄悕绉�
+     */
+    @ApiModelProperty("鏇存柊浜哄悕绉�")
+    private String updateUserName;
+
+}
diff --git a/basic-server/src/main/resources/mapper/StandardProductListMapper.xml b/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
index 2f380a4..4482e24 100644
--- a/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -154,4 +154,19 @@
         from structure_test_object_part
         where part_no = #{partNo}
     </select>
+    <select id="selectStandardProductList" resultType="com.ruoyi.basic.vo.StandardProductListVO">
+        select
+            spl.*,
+            u1.name AS create_user_name,
+            u2.name AS update_user_name
+        from standard_product_list spl
+        left join user u1 on u1.id = spl.create_user
+        left join user u2 on u2.id = spl.update_user
+        where 1=1
+        and spl.standard_method_list_id = #{standardMethodListId}
+        and spl.tree like concat('%',#{tree},'%')
+        <if test="isDrag!=null and isDrag">
+            ORDER BY spl.sort
+        </if>
+    </select>
 </mapper>
diff --git a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
index 95a39f6..432cf08 100644
--- a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -171,7 +171,7 @@
         where sto.specimen_name = #{sampleType}
         group by sto.specimen_name
     </select>
-    <select id="selectStandardProductListByTree" resultType="com.ruoyi.basic.pojo.StandardProductList">
+    <select id="selectStandardProductListByTree" resultType="com.ruoyi.basic.vo.StandardProductListVO">
         select <include refid="selectStandardTree"/>
         from structure_item_parameter
         where (
@@ -186,7 +186,7 @@
         order by inspection_item_class, inspection_item, id asc
     </select>
 
-    <select id="selectStandardProductListByTree2" resultType="com.ruoyi.basic.pojo.StandardProductList">
+    <select id="selectStandardProductListByTree2" resultType="com.ruoyi.basic.vo.StandardProductListVO">
         select <include refid="selectStandardTree"/>
         from structure_item_parameter
         where sample LIKE CONCAT('%[', #{tree}, ']%')

--
Gitblit v1.9.3