fix 实体继承处理

This commit is contained in:
2024-03-14 18:30:27 +08:00
parent d3a94a4d28
commit 944d9c2291
2 changed files with 24 additions and 16 deletions

View File

@@ -9,24 +9,38 @@ namespace Dlhis.Entity.Basic.Entity;
/// 餐补记录
/// </summary>
[SugarTable(TableName = "MealSupplementRecord", TableDescription = "餐补记录")]
public class MealSupplementRecordEntity : SugarBaseEntity
public class MealSupplementRecordEntity : MealSupplementRequestRecordEntity
{
/// <summary>
/// 唯一号
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "唯一号", UniqueGroupNameList = new[] { "idx_MealSupplementRecord_UniqueId" })]
public string UniqueId { get; set; }
public override string UniqueId { get; set; }
/// <summary>
/// 工号
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "工号")]
public string Code { get; set; }
[SugarColumn(IsNullable = false, ColumnDescription = "工号", IndexGroupNameList = new[] { "idx_MealSupplementRecord_Code" })]
public override string Code { get; set; }
/// <summary>
/// 餐补状态
/// </summary>
[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; }
/// <summary>
/// 考勤日期
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "考勤日期")]
[SugarColumn(ColumnDataType = "date", IsNullable = false, ColumnDescription = "考勤日期")]
public DateTime Date { get; set; }
/// <summary>
@@ -41,9 +55,6 @@ public class MealSupplementRecordEntity : SugarBaseEntity
[SugarColumn(IsNullable = false, ColumnDescription = "厂区")]
public string Factory { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
@@ -51,10 +62,4 @@ public class MealSupplementRecordEntity : SugarBaseEntity
/// </summary>
[SugarColumn(IsNullable = false, ColumnDescription = "餐补")]
public decimal Amount { get; set; }
/// <summary>
/// 餐补状态
/// </summary>
[SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
public MealSupplementStatusEnumtype Status { get; set; }
}

View File

@@ -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<MealSupplementReceiveReuqest> reuqests)
{
await _dbContext.InsertAsync(reuqests.Adapt<List<MealSupplementRequestRecordEntity>>());
await _eventBus.PublishAsync(new MealSupplementMessage { Items = reuqests });
}
}