using Infrastructure.Attribute; using Microsoft.AspNetCore.Http; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Infrastructure; using ARW.Model; using ARW.Repository; using ARW.Repository.Business.Custom.CustomerLoginLogs; using ARW.Service.Business.IBusinessService.Custom.CustomerLoginLogs; using ARW.Model.Dto.Business.Custom.CustomerLoginLogs; using ARW.Model.Models.Business.Custom.CustomerLoginLogs; using ARW.Model.Vo.Business.Custom.CustomerLoginLogs; using ARW.Model.Models.Business.Custom.Customers; namespace ARW.Service.Business.BusinessService.Custom.CustomerLoginLogs { /// /// 客户登录日志接口实现类 /// /// @author lwh /// @date 2023-11-21 /// [AppService(ServiceType = typeof(ICustomerLoginLogService), ServiceLifetime = LifeTime.Transient)] public class CustomerLoginLogServiceImpl : BaseService, ICustomerLoginLogService { private readonly CustomerLoginLogRepository _CustomerLoginLogRepository; public CustomerLoginLogServiceImpl(CustomerLoginLogRepository CustomerLoginLogRepository) { this._CustomerLoginLogRepository = CustomerLoginLogRepository; } #region 业务逻辑代码 /// /// 查询客户登录日志分页列表 /// public async Task> GetCustomerLoginLogList(CustomerLoginLogQueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create(); predicate = predicate.AndIF(parm.CustomerGuid != 0, s => s.CustomerGuid == parm.CustomerGuid); var query = _CustomerLoginLogRepository .Queryable() .LeftJoin((s, c) => s.CustomerGuid == c.CustomerGuid) .Where(predicate.ToExpression()) .OrderBy(s => s.Create_time, OrderByType.Desc) .Select((s, c) => new CustomerLoginLogVo { CustomerLoginLogId = s.CustomerLoginLogId, CustomerLoginLogGuid = s.CustomerLoginLogGuid, CustomerGuid = s.CustomerGuid, CreateTime = s.Create_time, CustomerNickName = c.CustomerNickname }); return await query.ToPageAsync(parm); } /// /// 添加或修改客户登录日志 /// public async Task AddOrUpdateCustomerLoginLog(CustomerLoginLog model) { if (model.CustomerLoginLogId != 0) { var response = await _CustomerLoginLogRepository.UpdateAsync(model); return "修改成功!"; } else { var response = await _CustomerLoginLogRepository.InsertReturnSnowflakeIdAsync(model); return "添加成功!"; } } #region Excel处理 #endregion #endregion } }