yangys
2025-08-14 a049dda2f63d59f5092994b44387fe0aa889d375
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java
@@ -73,7 +73,7 @@
    * @return
    */
   public List<NcNodeVO> lazyList(Long parentId) {
// 判断点击搜索但是没有查询条件的情况
      // 判断点击搜索但是没有查询条件的情况
      if (Func.isEmpty(parentId)) {
         parentId = 0L;
      }
@@ -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{
@@ -185,8 +187,11 @@
    * @return 最新版本程序报名节点
    */
   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::getIsCured,0).likeRight(NcNode::getParentIds,"0,1,")
         .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()){
@@ -239,7 +244,24 @@
    */
   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()){
         return null;
      }else {
         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()){
@@ -266,4 +288,26 @@
   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);
   }
}