From 9f0add00d40fc00e039b92b2fb3469394b1a24f5 Mon Sep 17 00:00:00 2001 From: yanjinhui <3306209981@qq.com> Date: 星期五, 28 三月 2025 14:28:59 +0800 Subject: [PATCH] 111 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs | 87 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 77 insertions(+), 10 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs" index e1c56c0..799b2f0 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs" @@ -7,6 +7,7 @@ using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.BaseServices; +using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_ITelescopicService; using WIDESEAWCS_Model.Models; @@ -15,20 +16,86 @@ public class LoginhsyService : ServiceBase<Dt_Loginhsy, IRepository<Dt_Loginhsy>>, ILoginhsyService { public IRepository<Dt_Loginhsy> Repository => BaseDal; + private readonly IRepository<Sys_User> _user; public LoginhsyService(IRepository<Dt_Loginhsy> BaseDal) : base(BaseDal) { - - } - //public override PageGridData<Dt_Loginhsy> GetPageData(PageDataOptions options) - //{ - // OrderByParameters = new Dictionary<string, SqlSugar.OrderByType> { - // { - // nameof(Dt_Loginhsy.CreateDate),SqlSugar.OrderByType.Desc//鎸夋椂闂撮檷搴忔帓鍒� - // } }; - // return base.GetPageData(options); - //} + } + + public WebResponseContent LoginRecord(PaginationDTO pagination) + { + try + { + int totalCount = 0; + + var sys = _user.Db.Queryable<Sys_User>(); + var main = Db.Queryable<Dt_Loginhsy>(); + + var query = sys.InnerJoin<Dt_Loginhsy>((a, b) => a.UserName == b.UserName); + if (!string.IsNullOrEmpty(pagination.searchKeyword)) + { + query = query.Where((a, b) => + a.UserTrueName.Contains(pagination.searchKeyword) || + a.Userteam.Contains(pagination.searchKeyword) || + b.OpCenten.Contains(pagination.searchKeyword) + ); + } + if (pagination.startDate.HasValue && pagination.endDate.HasValue) + { + query = query.Where((a, b) => b.LoginTiem >= pagination.startDate.Value && b.LoginTiem <= pagination.endDate.Value);//鐧诲叆鏃堕棿 + } + var result=query + .Select((a, b) => new + { + a.User_Id, + a.UserTrueName, + a.Userteam, + a.HeadImageUrl, + b.LoginTiem, + b.OutTiem, + b.OpCenten, + }).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); + return new WebResponseContent + { + Status = true, + Data = new + { + TotalCount = totalCount,//鎬绘暟 + PageIndex = pagination.pageIndex,//椤垫暟 + PageSize = pagination.pageSize,//涓�椤靛灏戜釜鏁版嵁 + Items = result + } + }; + } + catch (Exception ex) + { + + return new WebResponseContent { Status = true, Message = "閿欒" + ex }; + } + } + + + + public WebResponseContent OutLoginTime(int id) + { + try + { + var log = BaseDal.QueryFirst(x => x.ID == id); + if (log==null) + { + return new WebResponseContent { Status = false, Message = "澶辫触" }; + } + log.OutTiem = DateTime.Now; + BaseDal.UpdateData(log); + return new WebResponseContent { Status = true, Data = log.OutTiem }; + } + catch (Exception ex) + { + + return new WebResponseContent { Status = false, Message = "閿欒淇℃伅"+ex }; + } + } } } -- Gitblit v1.9.3