/// <summary> /// 获取系统日志列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <LogInfo> Get(getLogList request) { return(SysManager.getLogList(request)); }
/// <summary> /// 获取系统日志列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <LogInfo> getLogList(getLogList request) { using (var db = DbFactory.Open()) { var builder = db.From <LogInfo>(); if (adcd.IndexOf("0000000000000") > 0) //省级用户 { } else if (adcd.IndexOf("00000000000") > 0) //市级用户 { builder.Where(x => x.adcd.StartsWith(adcd.Substring(0, 4))); } else if (adcd.IndexOf("000000000") > 0) //县级用户 { builder.Where(x => x.adcd.StartsWith(adcd.Substring(0, 6))); } else if (adcd.IndexOf("000000") > 0) //乡镇用户 { builder.Where(x => x.adcd.StartsWith(adcd.Substring(0, 9))); } else { builder.Where(x => x.UserName == UserName); } if (!string.IsNullOrEmpty(request.OperationType.ToString()) && request.OperationType.ToString() != "None") { builder.And(x => x.OperationType == request.OperationType); } if (request.startTime != null) { builder.And(x => x.tm >= request.startTime.Value); } if (request.stopTime != null) { builder.And(x => x.tm <= request.stopTime.Value.AddDays(1)); } if (!string.IsNullOrEmpty(request.Sort)) { if (request.Order == "desc") { builder.OrderByFieldsDescending(request.Sort); } else { builder.OrderByFields(request.Sort); } } else { builder.OrderByDescending(x => x.tm); } var count = db.Count(builder); var PageSize = request.PageSize == 0 ? 15 : request.PageSize; var PageIndex = request.PageIndex == 0 ? 0 : (request.PageIndex) * PageSize; builder.Limit(PageIndex, PageSize); var list = db.Select(builder); return(new BsTableDataSource <LogInfo>() { total = count, rows = list }); } }