|  |  |  | @ -9,6 +9,7 @@ using Volo.Abp; | 
			
		
	
		
			
				
					|  |  |  |  | using Volo.Abp.Domain.Repositories.MongoDB; | 
			
		
	
		
			
				
					|  |  |  |  | using Volo.Abp.MongoDB; | 
			
		
	
		
			
				
					|  |  |  |  | using Volo.CmsKit.Tags; | 
			
		
	
		
			
				
					|  |  |  |  | using Tag = Volo.CmsKit.Tags.Tag; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | namespace Volo.CmsKit.MongoDB.Tags; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -52,4 +53,30 @@ public class MongoEntityTagRepository : MongoDbRepository<ICmsKitMongoDbContext, | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         return await AsyncExecuter.ToListAsync(blogPostQueryable, GetCancellationToken(cancellationToken)); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public async Task<List<string>> GetEntityIdsFilteredByTagNameAsync( | 
			
		
	
		
			
				
					|  |  |  |  |         [NotNull] string tagName, | 
			
		
	
		
			
				
					|  |  |  |  |         [NotNull] string entityType, | 
			
		
	
		
			
				
					|  |  |  |  |         [CanBeNull] Guid? tenantId=null, | 
			
		
	
		
			
				
					|  |  |  |  |         CancellationToken cancellationToken = default) | 
			
		
	
		
			
				
					|  |  |  |  |     { | 
			
		
	
		
			
				
					|  |  |  |  |         var dbContext = await GetDbContextAsync(); | 
			
		
	
		
			
				
					|  |  |  |  |         var entityTagQueryable = await GetMongoQueryableAsync(GetCancellationToken(cancellationToken)); | 
			
		
	
		
			
				
					|  |  |  |  |         var tagQueryable = dbContext.Tags.AsQueryable(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         var resultQueryable = entityTagQueryable | 
			
		
	
		
			
				
					|  |  |  |  |                                 .Join( | 
			
		
	
		
			
				
					|  |  |  |  |                                     tagQueryable, | 
			
		
	
		
			
				
					|  |  |  |  |                                     o => o.TagId, | 
			
		
	
		
			
				
					|  |  |  |  |                                     i => i.Id, | 
			
		
	
		
			
				
					|  |  |  |  |                                     (entityTag, tag) => new { entityTag, tag }) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .Where(x => x.tag.EntityType == entityType | 
			
		
	
		
			
				
					|  |  |  |  |                                     && x.entityTag.TenantId == tenantId | 
			
		
	
		
			
				
					|  |  |  |  |                                     && x.tag.TenantId == tenantId | 
			
		
	
		
			
				
					|  |  |  |  |                                     && x.tag.IsDeleted == false | 
			
		
	
		
			
				
					|  |  |  |  |                                 ) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .Select(s => s.entityTag.EntityId); | 
			
		
	
		
			
				
					|  |  |  |  |   | 
			
		
	
		
			
				
					|  |  |  |  |         return await AsyncExecuter.ToListAsync(resultQueryable, GetCancellationToken(cancellationToken)); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |