From d5402789d8b0b1dc33282099f7096939732f3303 Mon Sep 17 00:00:00 2001 From: ck_yeun9 Date: Sat, 3 May 2025 14:10:34 +0800 Subject: [PATCH] add photoUrl field for employee detail controller. --- .../Employee/EmployeeService.cs | 14 ++++++++++++-- .../Employee/Dto/Employee/ReadEmployeeOutputDto.cs | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs b/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs index cc78f4b..b97e954 100644 --- a/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs +++ b/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs @@ -42,6 +42,7 @@ namespace EOM.TSHotelManagement.Application /// 构造函数 /// /// + /// /// /// /// @@ -50,13 +51,18 @@ namespace EOM.TSHotelManagement.Application /// /// /// - public class EmployeeService(GenericRepository workerRepository, GenericRepository educationRepository, GenericRepository nationRepository, GenericRepository deptRepository, GenericRepository positionRepository, GenericRepository passportTypeRepository, IDataProtectionProvider dataProtectionProvider, JWTHelper jWTHelper, MailHelper mailHelper) : IEmployeeService + public class EmployeeService(GenericRepository workerRepository, GenericRepository photoRepository, GenericRepository educationRepository, GenericRepository nationRepository, GenericRepository deptRepository, GenericRepository positionRepository, GenericRepository passportTypeRepository, IDataProtectionProvider dataProtectionProvider, JWTHelper jWTHelper, MailHelper mailHelper) : IEmployeeService { /// /// 员工信息 /// private readonly GenericRepository workerRepository = workerRepository; + /// + /// 员工照片 + /// + private readonly GenericRepository photoRepository = photoRepository; + /// /// 学历类型 /// @@ -78,7 +84,7 @@ namespace EOM.TSHotelManagement.Application private readonly GenericRepository positionRepository = positionRepository; /// - /// 职务 + /// 证件 /// private readonly GenericRepository passportTypeRepository = passportTypeRepository; @@ -388,6 +394,10 @@ namespace EOM.TSHotelManagement.Application var source = EntityMapper.Map(w); + var employeePhoto = photoRepository.GetSingle(a => a.EmployeeId.Equals(source.EmployeeId)); + if (employeePhoto != null && !string.IsNullOrEmpty(employeePhoto.PhotoPath)) + source.PhotoUrl = employeePhoto.PhotoPath ?? string.Empty; + return new SingleOutputDto { Source = source }; } diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs index c7e60b4..2a2ddd0 100644 --- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs +++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs @@ -28,5 +28,6 @@ namespace EOM.TSHotelManagement.Common.Contract public int IsEnable { get; set; } public string Password { get; set; } public string EmailAddress { get; set; } + public string PhotoUrl { get; set; } } } -- Gitee