Parcourir la source

Merge branch 'master' of http://git.fwt.com/Hotline/hotline

Dun.Jason il y a 2 ans
Parent
commit
9372797261

+ 1 - 1
src/Hotline.Application/Handlers/CallCenter/Transient/TransientOuterNotificationHandler.cs

@@ -34,7 +34,7 @@ namespace Hotline.Application.Handlers.CallCenter.Transient
                     ToNo = notification.Outer.To,
                     Trunk = notification.Outer.Trunk,
                     UserId = workModel.UserId,
-                    UserName = workModel.Name,
+                    UserName = workModel.UserName,
                     PhoneIsp = isp
                 };
                 callModel.Modified();

+ 1 - 1
src/Hotline.CacheManager/StartupExtensions.cs

@@ -19,7 +19,7 @@ namespace Hotline.CacheManager
                     .WithUpdateMode(CacheUpdateMode.Up)
                     .WithMicrosoftMemoryCacheHandle()
                     .And
-                    .WithRedisConfiguration("redis", options.ConnectionString)
+                    .WithRedisConfiguration("redis", options.ConnectionString, 1)
                 //    .WithRedisConfiguration("redis", d =>
                 //{
                 //    d.WithDatabase(0).WithEndpoint("redis.fengwo.com", 6380);

+ 24 - 0
src/Hotline.Repository.SqlSugar/BaseRepository.cs

@@ -150,6 +150,30 @@ namespace Hotline.Repository.SqlSugar
             return (total.Value, items);
         }
 
+        public async Task<List<TEntity>> QueryExtAsync(
+            Expression<Func<TEntity, bool>> predicate, 
+            Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>>? includes = null, 
+            Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>>? orderByCreator = null,
+            params (bool isWhere, Expression<Func<TEntity, bool>> expression)[] whereIfs)
+        {
+            var query = Db.Queryable<TEntity>().Where(predicate);
+            if (includes is not null)
+                query = includes(query);
+            
+            if(whereIfs.Any())
+            {
+                foreach (var whereIf in whereIfs)
+                {
+                    query = query.WhereIF(whereIf.isWhere, whereIf.expression);
+                }
+            }
+
+            if (orderByCreator is not null)
+                query = orderByCreator(query);
+
+            return await query.ToListAsync();
+        }
+
         public async Task<List<TEntity>> QueryExtAsync(Expression<Func<TEntity, bool>> predicate, Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>> includes)
         {
             var query = Db.Queryable<TEntity>().Where(predicate);

+ 1 - 1
src/Hotline/CallCenter/Tels/TelDomainService.cs

@@ -50,7 +50,7 @@ public class TelDomainService : ITelDomainService, IScopeDependency
         if (!isResting)
         {
             await _deviceManager.TelRestAsync(currentWork.TelNo, cancellationToken);
-            await _telRestRepository.AddAsync(new TelRest(currentWork.TelId, currentWork.TelNo, currentWork.UserId, currentWork.Name),
+            await _telRestRepository.AddAsync(new TelRest(currentWork.TelId, currentWork.TelNo, currentWork.UserId, currentWork.UserName),
                 cancellationToken);
         }
     }

+ 2 - 2
src/Hotline/Users/Work.cs

@@ -32,7 +32,7 @@ public class Work : CreationModificationEntity
     /// <summary>
     /// 姓名(冗余)
     /// </summary>
-    public string Name { get; init; }
+    public string UserName { get; init; }
 
     /// <summary>
     /// 工作时长(单位:秒)
@@ -55,7 +55,7 @@ public class Work : CreationModificationEntity
     {
         StartTime = DateTime.Now;
         UserId = userId;
-        Name = name;
+        UserName = name;
         TelId = telId;
         TelNo = telNo;
     }

+ 6 - 0
src/XF.Domain.Repository/IRepositorySqlSugar.cs

@@ -19,6 +19,12 @@ namespace XF.Domain.Repository
             int pageSize,
             params (bool isWhere, Expression<Func<TEntity, bool>> expression)[] whereIfs);
         
+        Task<List<TEntity>> QueryExtAsync(
+            Expression<Func<TEntity, bool>> predicate,
+            Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>>? includes = null,
+            Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>>? orderByCreator = null,
+            params (bool isWhere, Expression<Func<TEntity, bool>> expression)[] whereIfs);
+
         Task<List<TEntity>> QueryExtAsync(
             Expression<Func<TEntity, bool>> predicate,
             Func<ISugarQueryable<TEntity>, ISugarQueryable<TEntity>> includes);