refactor: 完善枚举系统与状态类型转换,新增枚举管理接口
1. 为所有枚举添加Description特性用于中文描述 2. 移除实体类中冗余的状态字段注释与定义 3. 将所有枚举状态参数改为int类型转换,统一数据交互格式 4. 新增系统管理枚举查询接口与实现,支持获取所有枚举元数据 5. 调整宠物服务模板状态更新接口参数类型
This commit is contained in:
@ -101,7 +101,7 @@ public class PointsService(
|
||||
RelatedId = input.RelatedId,
|
||||
Description = input.Description,
|
||||
Type = PointsFlowTypeEnum.Income,
|
||||
Status = PointsRecordStatusEnum.Success,
|
||||
Status = (int)PointsRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
CreatedBy = input.OperatorName ?? user.Name ?? input.UserId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -164,7 +164,7 @@ public class PointsService(
|
||||
RelatedId = input.RelatedId,
|
||||
Description = input.Description,
|
||||
Type = PointsFlowTypeEnum.Expense,
|
||||
Status = PointsRecordStatusEnum.Success,
|
||||
Status = (int)PointsRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
CreatedBy = input.OperatorName ?? user.Name ?? input.UserId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -218,12 +218,12 @@ public class PointsService(
|
||||
|
||||
// 查询累计收入(Income 类型)
|
||||
var totalIncome = await Context.Queryable<PointsRecord>()
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Income && r.Status == PointsRecordStatusEnum.Success)
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Income && r.Status == (int)PointsRecordStatusEnum.Success)
|
||||
.SumAsync(r => r.ChangeAmount);
|
||||
|
||||
// 查询累计支出(Expense 类型,取绝对值)
|
||||
var totalExpense = await Context.Queryable<PointsRecord>()
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Expense && r.Status == PointsRecordStatusEnum.Success)
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Expense && r.Status == (int)PointsRecordStatusEnum.Success)
|
||||
.SumAsync(r => r.ChangeAmount);
|
||||
|
||||
return new PointsSummaryOutput
|
||||
|
||||
Reference in New Issue
Block a user