refactor: 完善枚举系统与状态类型转换,新增枚举管理接口
1. 为所有枚举添加Description特性用于中文描述 2. 移除实体类中冗余的状态字段注释与定义 3. 将所有枚举状态参数改为int类型转换,统一数据交互格式 4. 新增系统管理枚举查询接口与实现,支持获取所有枚举元数据 5. 调整宠物服务模板状态更新接口参数类型
This commit is contained in:
@ -314,7 +314,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
.ToListAsync();
|
||||
|
||||
var userMedals = await Context.Queryable<UserMedal>()
|
||||
.Where(um => um.UserId == userId && um.Status == UserMedalStatusEnum.Awarded)
|
||||
.Where(um => um.UserId == userId && um.Status == (int)UserMedalStatusEnum.Awarded)
|
||||
.ToListAsync();
|
||||
|
||||
var userMedalDict = userMedals.ToDictionary(um => um.MedalId, um => um.AwardedAt);
|
||||
@ -341,7 +341,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
|
||||
var result = await Context.Queryable<UserMedal>()
|
||||
.InnerJoin<Medal>((um, m) => um.MedalId == m.Id)
|
||||
.Where((um, m) => um.UserId == userId && um.Status == UserMedalStatusEnum.Awarded)
|
||||
.Where((um, m) => um.UserId == userId && um.Status == (int)UserMedalStatusEnum.Awarded)
|
||||
.OrderByDescending((um, m) => um.AwardedAt)
|
||||
.Select((um, m) => new WxUserMedalOutput
|
||||
{
|
||||
@ -391,7 +391,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
}
|
||||
|
||||
var existingUserMedal = await Context.Queryable<UserMedal>()
|
||||
.Where(um => um.UserId == userId && um.MedalId == (int)input.MedalId && um.Status == UserMedalStatusEnum.Awarded)
|
||||
.Where(um => um.UserId == userId && um.MedalId == (int)input.MedalId && um.Status == (int)UserMedalStatusEnum.Awarded)
|
||||
.FirstAsync();
|
||||
|
||||
if (existingUserMedal != null)
|
||||
@ -405,7 +405,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
MedalId = (int)input.MedalId,
|
||||
AwardedAt = DateTime.Now,
|
||||
Type = (UserMedalTypeEnum)medal.Type,
|
||||
Status = UserMedalStatusEnum.Awarded,
|
||||
Status = (int)UserMedalStatusEnum.Awarded,
|
||||
CreatedBy = "System",
|
||||
UpdatedBy = "System",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
||||
Reference in New Issue
Block a user