|  | @@ -237,7 +237,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 | 
	
		
			
				|  |  |              plan.setPlanOfOrgName(app.getPlanCreateOrgName());
 | 
	
		
			
				|  |  |              //验证名称是否重复
 | 
	
		
			
				|  |  |              QueryWrapper<AppPlan> qw = new QueryWrapper<>();
 | 
	
		
			
				|  |  | -            qw.lambda().eq(AppPlan::getPlanName, app.getPlanName());
 | 
	
		
			
				|  |  | +            qw.lambda().eq(AppPlan::getPlanName, app.getPlanName()).eq(AppPlan::getDeleted,0);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              Long size = baseMapper.selectCount(qw);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -425,7 +425,8 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 | 
	
		
			
				|  |  |          AppPlan appPlan = baseMapper.selectById(id);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          AppPlanVo appPlanVo = convertToAppPlanVo(appPlan);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        SysOrg org = orgService.selectSysOrgById(appPlan.getPlanCreateOrgId(), SecurityConstants.INNER);
 | 
	
		
			
				|  |  | +        appPlanVo.setPlanCreateOrgType(org.getType());
 | 
	
		
			
				|  |  |          QueryWrapper<AppPlanToRole> apr = new QueryWrapper<>();
 | 
	
		
			
				|  |  |          apr.lambda().eq(AppPlanToRole::getPlanId, id);
 | 
	
		
			
				|  |  |          List<AppPlanToRole> appPlanToRoles = appPlanToRoleMapper.selectList(apr);
 | 
	
	
		
			
				|  | @@ -477,6 +478,36 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 | 
	
		
			
				|  |  |          if (num > 0) {
 | 
	
		
			
				|  |  |              throw new RuntimeException("计划已生成任务,不能删除!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        //查找子计划
 | 
	
		
			
				|  |  | +        List<AppPlan> childrens = baseMapper.selectList(new LambdaQueryWrapper<AppPlan>().eq(AppPlan::getParentId,id));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //删除子计划
 | 
	
		
			
				|  |  | +        for (AppPlan ap :
 | 
	
		
			
				|  |  | +                childrens) {
 | 
	
		
			
				|  |  | +            Long nums = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", ap.getId()));
 | 
	
		
			
				|  |  | +            if (nums > 0) {
 | 
	
		
			
				|  |  | +                throw new RuntimeException("子计划已生成任务,不能删除!");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //删除对应的角色关系
 | 
	
		
			
				|  |  | +            QueryWrapper<AppPlanToRole> qw = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +            qw.lambda().eq(AppPlanToRole::getPlanId, ap.getId());
 | 
	
		
			
				|  |  | +            appPlanToRoleMapper.delete(qw);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //删除对应的要点关系
 | 
	
		
			
				|  |  | +            QueryWrapper<AppPlanToPoint> aw = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +            aw.lambda().eq(AppPlanToPoint::getPlanId, ap.getId());
 | 
	
		
			
				|  |  | +            appPlanToItemMapper.delete(aw);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //删除机构关系
 | 
	
		
			
				|  |  | +            QueryWrapper<AppPlanToExecOrg> apo = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +            apo.lambda().eq(AppPlanToExecOrg::getPlanId, ap.getId());
 | 
	
		
			
				|  |  | +            appPlanToExecOrgMapper.delete(apo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //删除本尊
 | 
	
		
			
				|  |  | +            baseMapper.deleteById(ap.getId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //删除对应的角色关系
 | 
	
		
			
				|  |  |          QueryWrapper<AppPlanToRole> qw = new QueryWrapper<>();
 | 
	
	
		
			
				|  | @@ -513,6 +544,8 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 | 
	
		
			
				|  |  |          plan.setPlanType(app.getPlanType());
 | 
	
		
			
				|  |  |          plan.setNotResumptionOnRest(app.getNotResumptionOnRest());
 | 
	
		
			
				|  |  |          plan.setExecOrgType(app.getExecOrgType());
 | 
	
		
			
				|  |  | +        plan.setDistributePlanStatus(app.getDistributePlanStatus());
 | 
	
		
			
				|  |  | +        plan.setCount(app.getCount());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return plan;
 | 
	
		
			
				|  |  |      }
 |