From 944d9c2291b5355da8940268c7a794fc87608203 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 14 Mar 2024 18:30:27 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AE=9E=E4=BD=93=E7=BB=A7=E6=89=BF?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/MealSupplementRecordEntity.cs | 33 +++++++++++-------- .../Implements/MealSupplementService.cs | 7 ++-- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Src/Dlhis.Entity/Basic/Entity/MealSupplementRecordEntity.cs b/Src/Dlhis.Entity/Basic/Entity/MealSupplementRecordEntity.cs index 94e5fa7e..8a993992 100644 --- a/Src/Dlhis.Entity/Basic/Entity/MealSupplementRecordEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/MealSupplementRecordEntity.cs @@ -9,24 +9,38 @@ namespace Dlhis.Entity.Basic.Entity; /// 餐补记录 /// [SugarTable(TableName = "MealSupplementRecord", TableDescription = "餐补记录")] -public class MealSupplementRecordEntity : SugarBaseEntity +public class MealSupplementRecordEntity : MealSupplementRequestRecordEntity { /// /// 唯一号 /// [SugarColumn(IsNullable = false, ColumnDescription = "唯一号", UniqueGroupNameList = new[] { "idx_MealSupplementRecord_UniqueId" })] - public string UniqueId { get; set; } + public override string UniqueId { get; set; } /// /// 工号 /// - [SugarColumn(IsNullable = false, ColumnDescription = "工号")] - public string Code { get; set; } + [SugarColumn(IsNullable = false, ColumnDescription = "工号", IndexGroupNameList = new[] { "idx_MealSupplementRecord_Code" })] + public override string Code { get; set; } + + /// + /// 餐补状态 + /// + [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + public MealSupplementStatusEnumtype Status { get; set; } +} + +[SugarTable(TableName = "MealSupplementRequestRecord", TableDescription = "餐补请求记录")] +public class MealSupplementRequestRecordEntity : SugarBaseEntity +{ + public virtual string UniqueId { get; set; } + + public virtual string Code { get; set; } /// /// 考勤日期 /// - [SugarColumn(IsNullable = false, ColumnDescription = "考勤日期")] + [SugarColumn(ColumnDataType = "date", IsNullable = false, ColumnDescription = "考勤日期")] public DateTime Date { get; set; } /// @@ -41,9 +55,6 @@ public class MealSupplementRecordEntity : SugarBaseEntity [SugarColumn(IsNullable = false, ColumnDescription = "厂区")] public string Factory { get; set; } - /// - /// 备注 - /// public string Remark { get; set; } /// @@ -51,10 +62,4 @@ public class MealSupplementRecordEntity : SugarBaseEntity /// [SugarColumn(IsNullable = false, ColumnDescription = "餐补")] public decimal Amount { get; set; } - - /// - /// 餐补状态 - /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] - public MealSupplementStatusEnumtype Status { get; set; } } diff --git a/Src/Dlhis.External/MealSupplement/Services/Implements/MealSupplementService.cs b/Src/Dlhis.External/MealSupplement/Services/Implements/MealSupplementService.cs index 9f0a22ca..701b9430 100644 --- a/Src/Dlhis.External/MealSupplement/Services/Implements/MealSupplementService.cs +++ b/Src/Dlhis.External/MealSupplement/Services/Implements/MealSupplementService.cs @@ -1,7 +1,9 @@ -using Dlhis.External.MealSupplement.Channel; +using Dlhis.Entity.Basic.Entity; +using Dlhis.External.MealSupplement.Channel; using Dlhis.External.MealSupplement.Request; using Kurisu.AspNetCore.EventBus.Abstractions; using Kurisu.SqlSugar.Services; +using Mapster; namespace Dlhis.External.MealSupplement.Services.Implements; @@ -10,7 +12,7 @@ public class MealSupplementService : IMealSupplementService private readonly IEventBus _eventBus; private readonly IDbContext _dbContext; - public MealSupplementService(IEventBus eventBus , IDbContext dbContext) + public MealSupplementService(IEventBus eventBus, IDbContext dbContext) { _eventBus = eventBus; _dbContext = dbContext; @@ -18,6 +20,7 @@ public class MealSupplementService : IMealSupplementService public async Task DoSupplementsAsync(List reuqests) { + await _dbContext.InsertAsync(reuqests.Adapt>()); await _eventBus.PublishAsync(new MealSupplementMessage { Items = reuqests }); } }