牛尾培训计划优化

master
xiaochanghai 1 month ago
parent 11aa96c377
commit bd097bca78
  1. 1
      Tiobon.Core.Model/View/Ghre/Ghre_Plan.Dto.View.cs
  2. 7
      Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs
  3. 10
      Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs

@ -33,6 +33,7 @@ public class Ghre_PlanDto : Ghre_Plan
public string UpdateDataInfo { get; set; } public string UpdateDataInfo { get; set; }
public string StaffNames { get; set; } public string StaffNames { get; set; }
public string CourseName { get; set; } public string CourseName { get; set; }
public string DeptNo { get; set; }
public string DeptName { get; set; } public string DeptName { get; set; }
public string SchoolName { get; set; } public string SchoolName { get; set; }

@ -88,7 +88,11 @@ public class Ghre_PlanServices : BaseServices<Ghre_Plan, Ghre_PlanDto, InsertGhr
if (DT_TableDataT1[i].CourseId.IsNotEmptyOrNull() && DT_TableDataT1[i].CourseName.IsNullOrEmpty()) if (DT_TableDataT1[i].CourseId.IsNotEmptyOrNull() && DT_TableDataT1[i].CourseName.IsNullOrEmpty())
DT_TableDataT1[i].CourseName = courses.Where(x => x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).FirstOrDefault(); DT_TableDataT1[i].CourseName = courses.Where(x => x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).FirstOrDefault();
if (DT_TableDataT1[i].DeptId.IsNotEmptyOrNull()) if (DT_TableDataT1[i].DeptId.IsNotEmptyOrNull())
{
DT_TableDataT1[i].DeptName = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptName).FirstOrDefault(); DT_TableDataT1[i].DeptName = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptName).FirstOrDefault();
DT_TableDataT1[i].DeptNo = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptNo).FirstOrDefault();
}
if (DT_TableDataT1[i].SchoolId.IsNotEmptyOrNull()) if (DT_TableDataT1[i].SchoolId.IsNotEmptyOrNull())
DT_TableDataT1[i].SchoolName = schools.Where(x => x.Id == DT_TableDataT1[i].SchoolId).Select(x => x.SchoolName).FirstOrDefault(); DT_TableDataT1[i].SchoolName = schools.Where(x => x.Id == DT_TableDataT1[i].SchoolId).Select(x => x.SchoolName).FirstOrDefault();
@ -648,7 +652,8 @@ public class Ghre_PlanServices : BaseServices<Ghre_Plan, Ghre_PlanDto, InsertGhr
} }
} }
}else }
else
dict.Add(x.field, null); dict.Add(x.field, null);
} }
} }

@ -64,7 +64,11 @@ FROM Ghre_Request A
// x.CourseName = courses.Where(o => x.CourseId == o.Id).FirstOrDefault()?.CourseName; // x.CourseName = courses.Where(o => x.CourseId == o.Id).FirstOrDefault()?.CourseName;
if (x.DeptId != null) if (x.DeptId != null)
{
x.DeptName = depts.Where(o => x.DeptId == o.DeptID).FirstOrDefault()?.DeptName; x.DeptName = depts.Where(o => x.DeptId == o.DeptID).FirstOrDefault()?.DeptName;
x.DeptNo = depts.Where(o => x.DeptId == o.DeptID).FirstOrDefault()?.DeptNo;
}
if (x.SponsorId != null) if (x.SponsorId != null)
x.SponsorName = staffs.Where(o => x.SponsorId == o.StaffID).FirstOrDefault()?.StaffName; x.SponsorName = staffs.Where(o => x.SponsorId == o.StaffID).FirstOrDefault()?.StaffName;
@ -737,8 +741,8 @@ INSERT INTO [120.26.205.42].[GhrUshio].[dbo].Ghre_GHR50Plan (PlanID,
CourseName, -- CourseName, --
TrainDays, -- TrainDays, --
TrainStaffId, -- TrainStaffId, --
TrainNum -- TrainNum, --
) InorOut )
SELECT A.Id, SELECT A.Id,
1, 1,
A.CreateBy, A.CreateBy,
@ -757,7 +761,7 @@ INSERT INTO [120.26.205.42].[GhrUshio].[dbo].Ghre_GHR50Plan (PlanID,
FROM OPENJSON(A.StaffIds) WITH (TrainStaffId INT '$') AS JsonData FROM OPENJSON(A.StaffIds) WITH (TrainStaffId INT '$') AS JsonData
INNER JOIN Ghra_Staff S ON JsonData.TrainStaffId = S.StaffID INNER JOIN Ghra_Staff S ON JsonData.TrainStaffId = S.StaffID
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS StaffNames, FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS StaffNames,
A.TrainNum A.TrainNum,A.InorOut
FROM Ghre_Plan A FROM Ghre_Plan A
LEFT JOIN [120.26.205.42].[GhrUshio].[dbo].Ghre_GHR50Plan B LEFT JOIN [120.26.205.42].[GhrUshio].[dbo].Ghre_GHR50Plan B
ON B.PlanID = A.Id ON B.PlanID = A.Id

Loading…
Cancel
Save