From 254a64e2a3b773e6f743c179916db2c8c31ff140 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 18 八月 2025 19:17:17 +0800
Subject: [PATCH] 处理其他文件在固化后消失的问题
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java | 96 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 88 insertions(+), 8 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java
index f8f4b51..2e9380f 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java
+++ b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import java.util.Optional;
/**
* 绋嬪簭鑺傜偣
@@ -72,7 +73,7 @@
* @return
*/
public List<NcNodeVO> lazyList(Long parentId) {
-// 鍒ゆ柇鐐瑰嚮鎼滅储浣嗘槸娌℃湁鏌ヨ鏉′欢鐨勬儏鍐�
+ // 鍒ゆ柇鐐瑰嚮鎼滅储浣嗘槸娌℃湁鏌ヨ鏉′欢鐨勬儏鍐�
if (Func.isEmpty(parentId)) {
parentId = 0L;
}
@@ -100,7 +101,6 @@
public List<NcNodeVO> searchList(NcNodeQueryVO queryVO) {
//1.鏍规嵁鍏宠繘瀛楀拰鑺傜偣绫诲瀷鏌ヨ鍒濆鍒楄〃,鏌ヨ鐨勫師濮嬪垪琛紝闇�瑕乭asChild瀛楁锛屾墍浠ヤ娇鐢╩apper.xml
List<NcNodeVO> oriList = this.getBaseMapper().searchList(queryVO);
- //List<NcNode> list = this.lambdaQuery().eq(NcNode::getNodeType, queryVO.getNodeType()).like(NcNode::getName, queryVO.getName()).list();
if ("10".equals(queryVO.getNodeType())) {
//鎼滅储鐨勬牴绾у埆锛岀洿鎺ヨ繑鍥�
return oriList;
@@ -158,7 +158,9 @@
* @return 绋嬪簭鎶ュ寘鍚嶇殑鑺傜偣
*/
public NcNode getProgramPackageByName(String programName) {
- List<NcNode> pkgs = this.lambdaQuery().eq(NcNode::getName, programName).eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE).list();
+ List<NcNode> pkgs = this.lambdaQuery().eq(NcNode::getName, programName)
+ .eq(NcNode::getIsLastEdition,1)
+ .eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE).list();
if(pkgs.isEmpty()){
return null;
}else{
@@ -180,13 +182,17 @@
}
/**
- * 鑾峰彇鈥滅▼搴忓寘鍚嶁�濈殑鏈�鏂扮増鏈�
+ * 鑾峰彇鈥滅▼搴忓寘鍚嶁�濊瘯鍒囩殑鏈�鏂扮増鏈�
* @param name 鑺傜偣鍚嶇О
* @return 鏈�鏂扮増鏈▼搴忔姤鍚嶈妭鐐�
*/
- public NcNode getLastEditionProgramPackage(String name){
+ public NcNode getLastEditionTryingProgramPackage(String name){
+ //.or(NcNode::getIsCured,0)
List<NcNode> pkgList = lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE)
- .eq(NcNode::getName, name).eq(NcNode::getIsLastEdition,1).orderByDesc(NcNode::getCreateTime).list();
+ .eq(NcNode::getName, name).and(i->{
+ i.eq(NcNode::getIsCured, 0).or().isNull(NcNode::getIsCured);
+ }).likeRight(NcNode::getParentIds,"0,1,")
+ .eq(NcNode::getIsLastEdition,1).orderByDesc(NcNode::getCreateTime).list();
if(pkgList.isEmpty()){
return null;
@@ -218,7 +224,7 @@
*/
public List<NcNode> getNodeHistory(NcNode pkgNode) {
return this.lambdaQuery().eq(NcNode::getParentId,pkgNode.getParentId())
- .eq(NcNode::getName,pkgNode.getName()).list();
+ .eq(NcNode::getName,pkgNode.getName()).list();//.ne(NcNode::getId,pkgNode.getId())
}
/**
@@ -238,7 +244,7 @@
*/
public NcNode getLastEditionCuredProgramPackage(String programPkgName) {
List<NcNode> nodes = lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE)
- .eq(NcNode::getName, programPkgName).eq(NcNode::getIsCured,1)
+ .eq(NcNode::getName, programPkgName).likeRight(NcNode::getParentIds,"0,2,").eq(NcNode::getIsCured,1)
.eq(NcNode::getIsLastEdition,1).list();
if(nodes.isEmpty()){
@@ -247,4 +253,78 @@
return nodes.get(0);
}
}
+
+ /**
+ * 鑾峰彇鏈�鏂扮増鏈殑 鍋忕鑺傜偣
+ * @param programPkgName 绋嬪簭鍖呭悕
+ * @return 鍋忕鐨勭▼搴忚妭鐐�
+ */
+ public NcNode getLastEditionDeviationProgramPackage(String programPkgName) {
+ List<NcNode> nodes = lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE)
+ .eq(NcNode::getName, programPkgName).likeRight(NcNode::getParentIds,"0,3,")
+ .eq(NcNode::getIsLastEdition,1).list();
+
+ if(nodes.isEmpty()){
+ return null;
+ }else {
+ return nodes.get(0);
+ }
+ }
+
+ /**
+ * 鏍规嵁娴佺▼瀹炰緥id鑾峰彇node鑺傜偣锛岄兘鏄▼搴忓寘鑺傜偣
+ * @param processInstanceId 娴佺▼瀹炰緥id
+ * @return 瀵瑰簲棰濈郴娆镐絾閭�
+ */
+ public NcNode getByProcessInstanceId(String processInstanceId) {
+ Optional<NcNode> nodeOpt = this.lambdaQuery().eq(NcNode::getProcessInstanceId,processInstanceId).oneOpt();
+ return nodeOpt.orElse(null);
+ }
+
+ /**
+ * 鐗╃悊鍒犻櫎鑺傜偣id涓嬬殑瀛愯妭鐐癸紙鎬ц兘鑰冭檻锛屽惁鍒欐暟鎹お澶氾級
+ * @param nodeId 鑺傜偣id
+ */
+ public void deleteSubNodes(Long nodeId) {
+ this.baseMapper.deleteSubNodes(nodeId);
+ }
+
+ /**
+ * 鑾峰彇绋嬪簭鍖呬笅鎵�鏈夊眰搴忔枃浠惰妭鐐�
+ * @param packageNodeId 绋嬪簭鍖呭悕 鑺傜偣id
+ * @return 鍖呬笅灞炵殑绋嬪簭鏂囦欢
+ */
+ public List<NcNode> getProgramFilesByPackageId(Long packageNodeId) {
+ return this.lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_FILE)
+ .eq(NcNode::getParentId,packageNodeId).eq(NcNode::getIsLastEdition,1).list();
+ }
+
+ /**
+ * 鍗囩骇鐗堟湰鍙凤紙+1锛�
+ * @param nodeId 鑺傜偣id
+ */
+ @Transactional
+ public void upgradeVersionNumber(Long nodeId) {
+ NcNode node = this.getById(nodeId);
+ node.upgradeVersionNumber();
+ this.updateById(node);
+
+ }
+
+ /**
+ * 閿佸畾鑺傜偣
+ * @param id 绋嬪簭鍖呰妭鐐筰d
+ */
+ @Transactional
+ public void lock(Long id) {
+ NcNode node = this.getById(id);
+ node.lock();
+ this.updateById(node);
+ }
+ @Transactional
+ public void unlock(Long id) {
+ NcNode node = this.getById(id);
+ node.unlock();
+ this.updateById(node);
+ }
}
--
Gitblit v1.9.3