用户缓存修改

usertest
cjy 4 months ago
parent e15040b372
commit 50466cd3d4

@ -53,8 +53,9 @@ public static class SqlSugarSetup
{
dbList.Add(item);
}
var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList);
var _serviceProvider = services.GetService<IServiceProvider>();
ICacheService myCache = new SqlSugarCsRedisCache(_serviceProvider);
var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList, myCache);
foreach (var item in dbList)
{

@ -1,4 +1,5 @@
using DS.Module.Core;
using Amazon.Runtime.Internal.Util;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
@ -113,7 +114,7 @@ namespace DS.Module.SqlSugar
#region 加载配置文件 + ReturnConnectionConfig
public static List<ConnectionConfig> ReturnConnectionConfig(List<DbConfig> dbList)
public static List<ConnectionConfig> ReturnConnectionConfig(List<DbConfig> dbList,ICacheService cache)
{
var connectConfigList = new List<ConnectionConfig>();
@ -140,6 +141,7 @@ namespace DS.Module.SqlSugar
// 自定义特性
ConfigureExternalServices = new ConfigureExternalServices()
{
DataInfoCacheService = cache
}
});
}

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
namespace DS.Module.SqlSugar;
@ -55,8 +56,9 @@ public static class SqlsugarInstall
{
dbList.Add(item);
}
var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList);
var _serviceProvider =services.GetService<IServiceProvider>();
ICacheService myCache = new SqlSugarCsRedisCache(_serviceProvider);
var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList, myCache);
//foreach (var item in dbList)
//{
@ -106,6 +108,8 @@ public static class SqlsugarInstall
foreach (var c in connectConfigList)
{
var dbProvider = db.GetConnectionScope((string)c.ConfigId);
// var user = services.GetService<IUser>();
//单例参数配置,所有上下文生效
dbProvider.Ado.CommandTimeOut = 30;

@ -86,8 +86,8 @@ public class ClientCommonService : IClientCommonService
var data = await db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && ids.Contains(a.Id))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToListAsync();
return await Task.FromResult(DataResult<List<UserSelectRes>>.Success(data));
}
@ -115,8 +115,9 @@ public class ClientCommonService : IClientCommonService
Label = a.PinYinCode,
Value = a.Id,
})
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.Take(20).ToListAsync();
.ToListAsync();
return DataResult<List<ApiSelectViewModel>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
@ -984,8 +985,8 @@ public class ClientCommonService : IClientCommonService
var list = db.Queryable<SysUser>().Where(x => x.Status == StatusEnum.Enable.ToEnumInt() && x.IsSale == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<SaleSelectListRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
if (list.Count > 0)
{
@ -1629,8 +1630,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsOperator == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1645,8 +1646,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsVouchingClerk == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1660,8 +1661,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsSale == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1676,8 +1677,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsCustom == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1692,8 +1693,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsFinancialStaff == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1708,8 +1709,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsCustomerService == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1724,8 +1725,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsDriver == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
@ -1739,8 +1740,8 @@ public class ClientCommonService : IClientCommonService
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsDispatcher == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select<UserSelectRes>()
.WithCache(SqlSugarCacheConst.User)
.Take(20)
.WithCache(SqlSugarCacheConst.User)
.ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}

@ -935,6 +935,7 @@ public class CommonService : ICommonService
Label = a.UserName,
Value = a.Id,
})
.Take(20)
.WithCache(SqlSugarCacheConst.User).ToList();
return DataResult<List<ApiSelectViewModel>>.Success("获取数据成功!", list);
}

@ -37,6 +37,7 @@ builder.Host
builder.Services.AddAppWebInstal();
builder.Services.AddCorsInstall();
builder.Services.AddUserModuleInstall(); //用户服务
builder.Services.AddRedisModuleInstall();//redis
builder.Services.AddSqlSugarInstall();
builder.Services.AddSwaggerInstall();
builder.Services.AddJwtInstall();
@ -44,7 +45,6 @@ builder.Services.AddSaasDbInstall();//分库服务
builder.Services.AddMultiLanguageInstall();//多语言服务
builder.Services.AddExcelModuleInstall();//Excel服务
builder.Services.AddPrintModuleInstall();//Print服务
builder.Services.AddRedisModuleInstall();//redis
// builder.Services.AddEndpointsApiExplorer();
// builder.Services.AddSwaggerGen();

@ -96,7 +96,7 @@
"Environment": "TEST"
},
"RedisInfo": {
"RedisConfig": "rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com:36379,password=,defaultDatabase=15"
"RedisConfig": "127.0.0.1:6379,password=,defaultDatabase=15"
},
"BCCompare": {
"Url": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare"

Loading…
Cancel
Save