wet 2 years ago
commit ada9aba84d

@ -52,20 +52,7 @@ namespace Myshipping.Application
public async Task<dynamic> Page([FromQuery] QueryBookingGoodsStatusConfigInput input)
{
//初次使用没有数据,进行初始化
if (_rep.AsQueryable().Count(x => x.CreatedUserId == UserManager.UserId) == 0)
{
var dicData = await _cache.GetAllDictData();
var listGoodsStatus = dicData.Where(x => x.TypeCode == "booking_goods_status").ToList();
listGoodsStatus.ForEach(async itm =>
{
await _rep.InsertAsync(new BookingGoodsStatusConfig()
{
StatusName = itm.Value,
Sort = itm.Sort,
SystemCode = itm.Code
});
});
}
InitGoodsStatusConfig();
var entities = await _rep.AsQueryable()
.Where(m => m.CreatedUserId == UserManager.UserId)
@ -136,5 +123,26 @@ namespace Myshipping.Application
return await _rep.FirstOrDefaultAsync(u => u.Id == id);
}
/// <summary>
/// 初始化当前用户的货物状态配置
/// </summary>
[NonAction]
public async void InitGoodsStatusConfig()
{
if (_rep.AsQueryable().Count(x => x.CreatedUserId == UserManager.UserId) == 0)
{
var dicData = await _cache.GetAllDictData();
var listGoodsStatus = dicData.Where(x => x.TypeCode == "booking_goods_status").ToList();
listGoodsStatus.ForEach(async itm =>
{
await _rep.InsertAsync(new BookingGoodsStatusConfig()
{
StatusName = itm.Value,
Sort = itm.Sort,
SystemCode = itm.Code
});
});
}
}
}
}

@ -11,5 +11,6 @@ namespace Myshipping.Application
Task<long> Save(SaveBookingGoodsStatusConfigInput input);
Task Delete(long id);
Task<BookingGoodsStatusConfig> Get(long id);
void InitGoodsStatusConfig();
}
}
Loading…
Cancel
Save