Beispiel #1
0
        //1.1 邮件日志列表
        public List <EmailLogResponse> List(EmailLogQueryRequest request)
        {
            List <EmailLogResponse> list = new List <EmailLogResponse>();

            try
            {
                StringBuilder join = new StringBuilder();
                if (request.Account.IsNotEmpty())
                {
                    request.Account = $"%{request.Account}%";
                    join.Append(" and account like @Account");
                }
                if (request.CreateStart.HasValue)
                {
                    join.Append(" and createtime >= @CreateStart");
                }
                if (request.CreateEnd.HasValue)
                {
                    request.CreateEnd = request.CreateEnd.Value.AddDays(1).AddSeconds(-1);
                    join.Append("  and createtime<=@CreateEnd");
                }
                var sql        = $@"select * from t_sys_emaillog where isdelete=0 {join.ToString()} order by createtime desc";
                int totalCount = 0;
                list            = _dbContext.Page <EmailLogResponse>(sql, out totalCount, request.PageIndex, request.PageSize, request);
                request.Records = totalCount;
            }
            catch (Exception ex)
            {
                LogUtils.LogError("EmailLogService.List", ex);
            }
            return(list);
        }
        public ContentResult emailloglist(EmailLogQueryRequest request)
        {
            var data = _emailLogService.List(request);
            var res  = new ResultDto <EmailLogResponse>
            {
                page    = request.PageIndex,
                total   = request.Total,
                records = request.Records,
                rows    = data
            };

            return(Content(res.Serialize()));
        }