Browse Source

套系藏品上下架1.3

sjx 2 years ago
parent
commit
ee5f4ba82c

+ 7 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PostCollectionsSystemController.java

@@ -24,6 +24,8 @@ import com.ruoyi.system.service.IPostCollectionsSystemService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
 
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
+
 /**
  * 藏品套系Controller
  *
@@ -160,17 +162,17 @@ public class PostCollectionsSystemController extends BaseController
     @PostMapping("/status/{status}")
     public AjaxResult changeStatus(@RequestBody List<Long> id, @PathVariable String status){
         List<PostCollectionsSystem> postCollectionsSystemList = postCollectionsSystemService.listByIds(id);
-
         postCollectionsSystemList = postCollectionsSystemList.stream().map(
                 (item) ->{
                     item.setStatus(status);
-                    //更改藏品的状态
-                    CollectionStatusJudgment.JudgmentStatus(id,status);
+                    item.setUpdateBy(getUsername());
+                    item.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
                     return item;
                 }
         ).collect(Collectors.toList());
-
-       return toAjax(postCollectionsSystemService.updateBatchById(postCollectionsSystemList));
+        //更改藏品的状态
+        CollectionStatusJudgment.JudgmentStatus(id,status);
+        return toAjax(postCollectionsSystemService.updateBatchById(postCollectionsSystemList));
     }
 
 

+ 0 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PostCollectionsSystemServiceImpl.java

@@ -174,8 +174,6 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
         }
 
         postCollectionsMapper.deletePostCollectionsBySystemIds(ids);
-
-
         return postCollectionsSystemMapper.deletePostCollectionsSystemByIds(ids);
     }
 
@@ -271,11 +269,6 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
 
     @Override
     public int updateBatchById(List<PostCollectionsSystem> postCollectionsSystemList) {
-        for (int i = 0; i < postCollectionsSystemList.size(); i++) {
-            //补充字段
-            postCollectionsSystemList.get(i). setUpdateBy(getUsername());
-            postCollectionsSystemList.get(i).setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
-        }
         return postCollectionsSystemMapper.updateBatchById(postCollectionsSystemList);
     }
 }

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/system/utils/CollectionStatusJudgment.java

@@ -122,10 +122,10 @@ public class CollectionStatusJudgment {
                                 postCollectionsList.get(j).getCollectionsNumber() == 0) {
                             postCollectionsList.get(j).setStatus("1");//售尽
                         }
-                        }
+                    }
                     postCollectionsMapper.updatePostCollectionsStatus1(postCollectionsList.get(j));
                 }
-                }
+            }
         }
     }
 }