diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_Plan.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_Plan.Dto.Base.cs index cbb73078..a057c2c9 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_Plan.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_Plan.Dto.Base.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2025/2/27 14:07:52 SimonHsiao 初版 +*V0.01 2025/2/27 14:48:56 SimonHsiao 初版 * * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ @@ -31,13 +31,13 @@ public class Ghre_PlanBase /// /// 类别 /// - public int? PlanType { get; set; } + [Display(Name = "PlanType"), Description("类别"), MaxLength(32, ErrorMessage = "类别 不能超过 32 个字符")] + public string PlanType { get; set; } /// /// 部门ID /// - [Display(Name = "DeptId"), Description("部门ID"), MaxLength(10, ErrorMessage = "部门ID 不能超过 10 个字符")] - public string DeptId { get; set; } + public int? DeptId { get; set; } /// /// 课程ID diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_Plan.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_Plan.cs index 833e4325..060a866a 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_Plan.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_Plan.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2025/2/27 14:07:52 SimonHsiao 初版 +*V0.01 2025/2/27 14:48:56 SimonHsiao 初版 * * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ @@ -32,13 +32,13 @@ public class Ghre_Plan : BasePoco /// /// 类别 /// - public int? PlanType { get; set; } + [Display(Name = "PlanType"), Description("类别"), MaxLength(32, ErrorMessage = "类别 不能超过 32 个字符")] + public string PlanType { get; set; } /// /// 部门ID /// - [Display(Name = "DeptId"), Description("部门ID"), MaxLength(10, ErrorMessage = "部门ID 不能超过 10 个字符")] - public string DeptId { get; set; } + public int? DeptId { get; set; } /// /// 课程ID diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_Plan.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_Plan.Dto.View.cs index 93fa212f..9fff5dba 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_Plan.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_Plan.Dto.View.cs @@ -31,4 +31,10 @@ public class Ghre_PlanDto : Ghre_Plan /// 修改信息 /// public string UpdateDataInfo { get; set; } + public string StaffNames { get; set; } + public string CourseName { get; set; } + public string DeptName { get; set; } + public string SchoolName { get; set; } + + } diff --git a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs index 91a793c6..bf82dc5b 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs @@ -16,12 +16,38 @@ public class Ghre_PlanServices : BaseServices x.DeptId).Distinct().ToList(); + var courseIds = DT_TableDataT1.Select(x => x.CourseId).Distinct().ToList(); + var schoolIds = DT_TableDataT1.Select(x => x.SchoolId).Distinct().ToList(); + var staffIds = new List(); + for (int i = 0; i < DT_TableDataT1.Count; i++) { - var DT_TableDataT1 = result.result.DT_TableDataT1[i]; + if (DT_TableDataT1[i].StaffIds.IsNotEmptyOrNull()) + staffIds.AddRange(JsonHelper.JsonToObj>(DT_TableDataT1[i].StaffIds)); + DT_TableDataT1[i].PlanType = await GetParaLabel("TrainingCategory", DT_TableDataT1[i].PlanType); + DT_TableDataT1[i].PlanType = await GetParaLabel("TrainingCategory", DT_TableDataT1[i].PlanType); + } + staffIds = staffIds.Distinct().ToList(); + var staffs = await Db.Queryable().Where(x => staffIds.Contains(x.StaffID)).ToListAsync(); + var depts = await Db.Queryable().Where(x => deptIds.Contains(x.DeptID)).ToListAsync(); + var courses = await Db.Queryable().Where(x => courseIds.Contains(x.Id)).ToListAsync(); + var schools = await Db.Queryable().Where(x => schoolIds.Contains(x.Id)).ToListAsync(); + + + for (int i = 0; i < DT_TableDataT1.Count; i++) + { + if (DT_TableDataT1[i].StaffIds.IsNotEmptyOrNull()) + { + var staffIds1 = JsonHelper.JsonToObj>(DT_TableDataT1[i].StaffIds); + if (staffIds1.Any()) + DT_TableDataT1[i].StaffNames = string.Join("、", staffs.Where(x => staffIds1.Contains(x.StaffID)).Select(x => x.StaffName)); + } - DT_TableDataT1.PlanType = await GetParaLabel("TrainingCategory", result.result.DT_TableDataT1[i].PlanType); + DT_TableDataT1[i].CourseName = courses.Where(x => x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).First(); + DT_TableDataT1[i].DeptName = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptName).First(); + DT_TableDataT1[i].SchoolName = courses.Where(x => x.Id == DT_TableDataT1[i].SchoolId).Select(x => x.CourseName).First(); } return result; }