公司账号维护bug

optimize
wanghaomei 1 year ago
parent 5e8f187958
commit ce4c45e26b

@ -109,9 +109,10 @@ namespace Myshipping.Core.Service
[HttpGet("/DjyWebsiteAccountConfig/PageTenant")] [HttpGet("/DjyWebsiteAccountConfig/PageTenant")]
public async Task<dynamic> PageTenant([FromQuery] QueryDjyWebsiteAccountConfigInput input) public async Task<dynamic> PageTenant([FromQuery] QueryDjyWebsiteAccountConfigInput input)
{ {
var entities = await _rep.AsQueryable() var entities = await _rep.AsQueryable().Filter(null, true)
.Where(m => m.TenantId == UserManager.TENANT_ID)
.Where(m => m.IsTenant) .Where(m => m.IsTenant)
.Where(m => m.CreatedUserId == UserManager.UserId) .Where(m => !m.IsDeleted)
.WhereIF(!string.IsNullOrWhiteSpace(input.TypeCode), u => u.TypeCode == input.TypeCode) .WhereIF(!string.IsNullOrWhiteSpace(input.TypeCode), u => u.TypeCode == input.TypeCode)
.WhereIF(!string.IsNullOrWhiteSpace(input.Account), u => u.Account.Contains(input.Account.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Account), u => u.Account.Contains(input.Account.Trim()))
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
@ -179,12 +180,14 @@ namespace Myshipping.Core.Service
/// <returns></returns> /// <returns></returns>
public async Task<DjyWebsiteAccountConfig> GetAccountConfig(string TypeCode, long UserId) public async Task<DjyWebsiteAccountConfig> GetAccountConfig(string TypeCode, long UserId)
{ {
if (string.IsNullOrWhiteSpace(TypeCode)||UserId==0) { if (string.IsNullOrWhiteSpace(TypeCode) || UserId == 0)
{
throw Oops.Bah("请传入正确参数!"); throw Oops.Bah("请传入正确参数!");
} }
DjyWebsiteAccountConfig accountConfig = new DjyWebsiteAccountConfig(); DjyWebsiteAccountConfig accountConfig = new DjyWebsiteAccountConfig();
accountConfig = await _rep.FirstOrDefaultAsync(x => x.TypeCode == TypeCode && x.CreatedUserId == UserId); accountConfig = await _rep.FirstOrDefaultAsync(x => x.TypeCode == TypeCode && x.CreatedUserId == UserId);
if (accountConfig==null) { if (accountConfig == null)
{
accountConfig = await _rep.AsQueryable().InnerJoin<SysUser>((d, t) => d.TenantId == t.TenantId).Where((d, t) => d.TypeCode == TypeCode && t.Id == UserId && d.IsTenant == true).FirstAsync(); accountConfig = await _rep.AsQueryable().InnerJoin<SysUser>((d, t) => d.TenantId == t.TenantId).Where((d, t) => d.TypeCode == TypeCode && t.Id == UserId && d.IsTenant == true).FirstAsync();
} }
return accountConfig; return accountConfig;

Loading…
Cancel
Save