|
|
|
@ -109,9 +109,10 @@ namespace Myshipping.Core.Service
|
|
|
|
|
[HttpGet("/DjyWebsiteAccountConfig/PageTenant")]
|
|
|
|
|
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.CreatedUserId == UserManager.UserId)
|
|
|
|
|
.Where(m => !m.IsDeleted)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TypeCode), u => u.TypeCode == input.TypeCode)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Account), u => u.Account.Contains(input.Account.Trim()))
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
@ -179,13 +180,15 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DjyWebsiteAccountConfig> GetAccountConfig(string TypeCode, long UserId)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(TypeCode)||UserId==0) {
|
|
|
|
|
if (string.IsNullOrWhiteSpace(TypeCode) || UserId == 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入正确参数!");
|
|
|
|
|
}
|
|
|
|
|
DjyWebsiteAccountConfig accountConfig = new DjyWebsiteAccountConfig();
|
|
|
|
|
accountConfig = await _rep.FirstOrDefaultAsync(x => x.TypeCode == TypeCode && x.CreatedUserId == UserId);
|
|
|
|
|
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();
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
return accountConfig;
|
|
|
|
|
}
|
|
|
|
|