From 3ec8bb1ceb56bbe46c152379257200c816acaea0 Mon Sep 17 00:00:00 2001 From: whycxzp <perryhsu@163.com> Date: 星期五, 26 八月 2022 11:46:11 +0800 Subject: [PATCH] 产品更新,关联关系迁移;规范命名问题 --- src/main/java/com/whyc/service/WorksheetLinkService.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/whyc/service/WorksheetLinkService.java b/src/main/java/com/whyc/service/WorksheetLinkService.java index dc08c90..305baab 100644 --- a/src/main/java/com/whyc/service/WorksheetLinkService.java +++ b/src/main/java/com/whyc/service/WorksheetLinkService.java @@ -145,11 +145,27 @@ String parentCode = productApproving.getParentCode(); String customCode = productApproving.getCustomCode(); ProductHistory latestProduct = phService.getLatestVersion(parentCode, customCode); + ProductHistory enabledProduct = phService.getEnabledByParentCodeAndCustomCode(parentCode, customCode); int currentVersion = 0; if (latestProduct != null) { currentVersion = latestProduct.getVersion(); } Integer nextVersion = currentVersion + 1; + //浜у搧鐗╂枡鍏崇郴杩佺Щ + //鏌ヨ鐢熸晥鐗堟湰鐨勫叧鑱斿叧绯� + List<MaterialProductHistory> mpList = mphService.getListByParentCodeAndCustomCodeAndVersion(parentCode, customCode, enabledProduct.getVersion()); + if(latestProduct.getVersion().intValue() == enabledProduct.getVersion()){ + //鏈�鏂扮増鏈敓鏁�,鍏宠仈鍏崇郴鐗堟湰杩炵潃鐨� + mphService.updateVersionBatch(mpList); + }else{ + //鏃х増鏈敓鏁�,鍏宠仈鍏崇郴鐗堟湰涓嶈繛鐫� + mpList.forEach(mp->{ + mp.setSVersion(nextVersion); + mp.setEVersion(nextVersion); + }); + mphService.insertBatch(mpList); + } + //灏嗕骇鍝佹枃浠跺鍒惰嚦姝e紡璺緞 //鏂囦欢杞Щ,鏈窡瀛愪欢鎸傞挬鐨勬墍鏈夊浘绾稿浘鐗囪浆绉诲埌浜у搧鐗堟湰涓�:doc_file/product/{浜у搧鍨嬪彿}/standard鎴栬�厈customCode}}/{version}/ //璺熷瓙浠舵寕閽╃殑杞Щ鍒板瓙浠跺浘绾镐笅:doc_file/material/ -- Gitblit v1.9.1