fix 优化null字段问题

This commit is contained in:
2024-11-14 16:42:36 +08:00
parent a07ab8330e
commit 2c6ac44782
3 changed files with 14 additions and 11 deletions

View File

@@ -1,4 +1,6 @@
using Dlhis.Middle.Entities;
using Dlhis.Middle.Services;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
namespace Dlhis.Middle.BackgroundServices;
@@ -23,6 +25,14 @@ public class HealthCheckBackgroundService : BackgroundService
if (!_init)
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetService<IDbContext>();
db.Client.DbMaintenance.CreateDatabase();
db.Client.CodeFirst.InitTables<LocalBalanceRecordEntity, LocalGainfoEntity, LocalGainfoMealEntity, LocalBusinessPlaceEntity>();
db.Client.CodeFirst.InitTables<LocalBusinessShiftEntity, LocalDeviceRegistryEntity, LocalDeviceEntity, LocalBusinessPlaceShiftRelationshipEntity, LocalBusinessShiftMealRelationshipEntity>();
db.Client.CodeFirst.InitTables<LocalCanteenSettingEntity, LocalDepartmentEntity>();
var factories = scope.ServiceProvider.GetService<ISettingService>().GetFactories();
var ds = scope.ServiceProvider.GetService<IDataDownloadService>();
await ds.InitAsync(factories);