You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using Microsoft.Extensions.Logging;
|
|
using SlnMesnac.Model.domain;
|
|
using SlnMesnac.Repository.service.@base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace SlnMesnac.Repository.service.Impl
|
|
{
|
|
public class BaseStaffServiceImpl : BaseServiceImpl<BaseStaffInfo>, IBaseStaffService
|
|
{
|
|
private ILogger<BaseStaffServiceImpl> _logger;
|
|
public BaseStaffServiceImpl(Repository<BaseStaffInfo> repository, ILogger<BaseStaffServiceImpl> logger) : base(repository)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public BaseStaffInfo GetMonitorByTeamCode(string teamCode)
|
|
{
|
|
BaseStaffInfo staffInfo = null;
|
|
try
|
|
{
|
|
staffInfo = base._rep.AsQueryable().Where(x => x.TeamCode == teamCode).Where(x => x.StaffType == "1").First();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError($"查找班组的班长信息异常:{ex.Message}");
|
|
}
|
|
return staffInfo;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 通过卡号获取员工信息
|
|
/// </summary>
|
|
/// <param name="cardId"></param>
|
|
/// <returns></returns>
|
|
public BaseStaffInfo GetStaffInfoByCardId(string cardId)
|
|
{
|
|
BaseStaffInfo staffInfo = null;
|
|
try
|
|
{
|
|
staffInfo = base._rep.GetFirst(x => x.CardId == cardId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError($"根据卡号获取员工信息异常:{ex.Message}");
|
|
}
|
|
return staffInfo;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有的员工信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<BaseStaffInfo> GetStaffInfos()
|
|
{
|
|
List<BaseStaffInfo> staffInfos = null;
|
|
try
|
|
{
|
|
staffInfos = base._rep.GetList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError($"获取员工信息异常:{ex.Message}");
|
|
}
|
|
return staffInfos;
|
|
}
|
|
|
|
|
|
}
|
|
}
|