From 4a0c56352223553481e1122665964546a39cddf5 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 30 七月 2024 16:13:42 +0800
Subject: [PATCH] 代码提交 依赖整理 bug解决

---
 ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlGoodsMaterialsServiceImpl.java |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlGoodsMaterialsServiceImpl.java b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlGoodsMaterialsServiceImpl.java
index a14dfbe..2a36c7a 100644
--- a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlGoodsMaterialsServiceImpl.java
+++ b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlGoodsMaterialsServiceImpl.java
@@ -52,7 +52,9 @@
             SlGoodsMaterials slGoodsMaterials=new  SlGoodsMaterials();
             slGoodsMaterials.setGoodsMaterialsName(slGoodsMaterialsDTO.getGoodsMaterialsName());
             slGoodsMaterials.setIsConsume(slGoodsMaterialsDTO.getIsConsume());
+            slGoodsMaterials.setGoodsMaterialsNo(slGoodsMaterialsDTO.getGoodsMaterialsNo());
             slGoodsMaterials.setRepertory(slGoodsMaterialsDTO.getRepertory());
+            this.save(slGoodsMaterials);
         }else{
             SlGoodsMaterials byId = this.getById(slGoodsMaterialsDTO.getId());
             if (slGoodsMaterialsDTO.getGoodsMaterialsName()!=null){
@@ -60,7 +62,18 @@
             }
             if (slGoodsMaterialsDTO.getRepertory()!=null){
                 byId.setRepertory(slGoodsMaterialsDTO.getRepertory());
+                LambdaQueryWrapper<ManagementGoodsMaterials> wrapper3= Wrappers.lambdaQuery();
+                wrapper3.eq(ManagementGoodsMaterials::getGoodsMaterialsId,byId.getId());
+                wrapper3.eq( ManagementGoodsMaterials::getDelFlag,0);
+                wrapper3.orderByDesc(ManagementGoodsMaterials::getCreateTime);
+                List<ManagementGoodsMaterials> page1 = managementGoodsMaterialsService.list(wrapper3);
+                for (ManagementGoodsMaterials pg:page1){
+                    pg.setRepertory(slGoodsMaterialsDTO.getRepertory());
+                    managementGoodsMaterialsService.updateById(pg);
+                }
+
             }
+            byId.setGoodsMaterialsNo(slGoodsMaterialsDTO.getGoodsMaterialsNo());
             if (slGoodsMaterialsDTO.getIsConsume()!=null){
                 byId.setIsConsume(slGoodsMaterialsDTO.getIsConsume());
             }
@@ -72,7 +85,9 @@
     public PageDTO<SlGoodsMaterialsVO> getGoodSmaterialsList(SlGoodsMaterialsQuery slGoodsMaterialsQuery) {
         Page<SlGoodsMaterials> page = new Page<>(slGoodsMaterialsQuery.getPageCurr(), slGoodsMaterialsQuery.getPageSize());
         LambdaQueryWrapper< SlGoodsMaterials> wrapper= Wrappers.lambdaQuery();
-        wrapper.eq(SlGoodsMaterials::getGoodsMaterialsName,slGoodsMaterialsQuery.getGoodsMaterialsName());
+        if (slGoodsMaterialsQuery.getGoodsMaterialsName()!=null&& !slGoodsMaterialsQuery.getGoodsMaterialsName().isEmpty()){
+            wrapper.like(SlGoodsMaterials::getGoodsMaterialsName,slGoodsMaterialsQuery.getGoodsMaterialsName());
+        }
         if (slGoodsMaterialsQuery.getIsConsume()!=0){
             wrapper.eq(SlGoodsMaterials::getIsConsume,slGoodsMaterialsQuery.getIsConsume());
         }
@@ -92,7 +107,7 @@
                 .collect(Collectors.toSet());
 
         LambdaQueryWrapper< SlGoodsMaterials> wrapper1 =Wrappers.lambdaQuery();
-        if (storeManagementGoodSmaterialsQuery.getIsConsume()!=0){
+        if (storeManagementGoodSmaterialsQuery.getIsConsume()!=null&&storeManagementGoodSmaterialsQuery.getIsConsume()!=0){
             wrapper1.eq(SlGoodsMaterials::getIsConsume,storeManagementGoodSmaterialsQuery.getIsConsume());
         }
         if (storeManagementGoodSmaterialsQuery.getGoodsMaterialsName()!=null){
@@ -108,10 +123,10 @@
         Page<ManagementGoodsMaterials> page = new Page<>(storeManagementGoodSmaterialsQuery.getPageCurr(), storeManagementGoodSmaterialsQuery.getPageSize());
         LambdaQueryWrapper< ManagementGoodsMaterials> wrapper= Wrappers.lambdaQuery();
 
-        if (slVolumeProductionIdList.size()>0){
+        if (!slVolumeProductionIdList.isEmpty()){
             wrapper.in(ManagementGoodsMaterials::getManagementId,slVolumeProductionIdList);
         }
-        if (SlGoodsMaterialsList.size()>0){
+        if (!SlGoodsMaterialsList.isEmpty()){
             wrapper.in(ManagementGoodsMaterials::getGoodsMaterialsId,SlGoodsMaterialsList);
         }
         wrapper.eq( ManagementGoodsMaterials::getDelFlag,0);

--
Gitblit v1.7.1