public IActionResult List(RoleRequestPayload payload) { var response = ResponseModelFactory.CreateResultInstance; using (_dbContext) { var query = _dbContext.SystemRole.AsQueryable(); if (!string.IsNullOrEmpty(payload.Kw)) { query = query.Where(x => x.RoleName.Contains(payload.Kw.Trim())); } if (payload.IsDeleted > CommonEnum.IsDeleted.All) { query = query.Where(x => (CommonEnum.IsDeleted)x.IsDeleted == payload.IsDeleted); } var list = query.Paged(payload.CurrentPage, payload.PageSize).ToList(); var totalCount = query.Count(); var data = list.Select(_mapper.Map <SystemRole, RoleJsonModel>); response.SetData(list, totalCount); ToLog.AddLog("查询", "成功:查询:系统角色管理列表数据", _dbContext); return(Ok(response)); } }
List(RoleRequestPayload payload) { var response = ResponseModelFactory.CreateResultInstance; await using (_dbContext) { var query = _dbContext.DncRole.AsQueryable(); if (!string.IsNullOrEmpty(payload.Kw)) { query = query.Where(x => x.Name.Contains(payload.Kw.Trim()) || x.Code.Contains(payload.Kw.Trim())); } if (payload.IsDeleted > CommonEnum.IsDeleted.All) { query = query.Where(x => x.IsDeleted == payload.IsDeleted); } if (payload.Status > CommonEnum.Status.All) { query = query.Where(x => x.Status == payload.Status); } var list = await query.Paged(payload.CurrentPage, payload.PageSize).ToListAsync(); var totalCount = await query.CountAsync(); var data = list.Select(_mapper.Map <DncRole, RoleJsonModel>); response.SetData(data, totalCount); return(Ok(response)); } }
public IActionResult List(RoleRequestPayload payload) { var response = ResponseModelFactory.CreateResultInstance; using (_dbContext) { var query = from a in _dbContext.PersonalDiary where a.IsDeleted == 0 select new { PersonalDiaryUuid = a.PersonalDiaryUuid, Id = a.Id, Headline = a.Headline, Content = a.Content, WriteTime = a.WriteTime, Accessory = a.Accessory, EstablishName = a.EstablishName, EstablishTime = a.EstablishTime, IsDeleted = a.IsDeleted, }; if (!string.IsNullOrEmpty(payload.Kw)) { query = query.Where(x => x.Headline.Contains(payload.Kw.Trim()) || x.EstablishName.Contains(payload.Kw.Trim())); } //时间段查询 if (!string.IsNullOrEmpty(payload.kwstartime)) { query = query.Where(x => x.WriteTime.Contains(payload.kwstartime)); } //if (!string.IsNullOrEmpty(payload.kwendtime)) //{ // query = query.Where(x => Convert.ToDateTime(x.EstablishTime) <= Convert.ToDateTime(payload.kwendtime)); //} if (payload.FirstSort != null) { query = query.OrderBy(payload.FirstSort.Field, payload.FirstSort.Direct == "DESC"); } if (AuthContextService.CurrentUser.DisplayName != "超级管理员") { query = query.Where(x => x.EstablishName == AuthContextService.CurrentUser.DisplayName); } var list = query.Paged(payload.CurrentPage, payload.PageSize).ToList(); var totalCount = query.Count(); response.SetData(list, totalCount); return(Ok(response)); } }
public IActionResult List(RoleRequestPayload payload) { var response = ResponseModelFactory.CreateResultInstance; using (_dbContext) { var query = from a in _dbContext.DepartmentDeclare where a.IsDeleted == 0 select new { DepartmentDeclareUuid = a.DepartmentDeclareUuid, Id = a.Id, DeclareName = a.DeclareName, //姓名 DeclareDepartment = _dbContext.Department.FirstOrDefault(x => x.DepartmentUuid == Guid.Parse(a.DeclareDepartment)).Name.ToString(), //部门 DeclareTime = a.DeclareTime, //时间 BonusPoint = a.BonusPoint, //加分项 PlusScore = a.PlusScore, //加分值 PlusContent = a.PlusContent, //加分内容 Deduction = a.Deduction, //减分项 DeductionScore = a.DeductionScore, //减分值 DeductionContent = a.DeductionContent, //加分内容 Remark = a.Remark, //备注 EstablishName = a.EstablishName, //添加人 AuditOpinion = a.AuditOpinion, //审核意见 AuditStatus = a.AuditStatus, //审核状态 IsDeleted = a.IsDeleted, //是否删除 }; //姓名查询 if (!string.IsNullOrEmpty(payload.Kw)) { query = query.Where(x => x.DeclareName.Contains(payload.Kw.Trim())); } //时间查询 if (!string.IsNullOrEmpty(payload.kwendtime)) { query = query.Where(x => x.DeclareTime.Contains(payload.kwendtime.Trim())); } //排序 if (payload.FirstSort != null) { query = query.OrderBy(payload.FirstSort.Field, payload.FirstSort.Direct == "DESC"); } var list = query.Paged(payload.CurrentPage, payload.PageSize).ToList(); var totalCount = query.Count(); response.SetData(list, totalCount); ToLog.AddLog("查询", "成功:查询:绩效申报信息数据", _dbContext); return(Ok(response)); } }
public IActionResult List(RoleRequestPayload payload) { var response = ResponseModelFactory.CreateResultInstance; using (_dbContext) { var query = _dbContext.SystemRole.Select(x => new { x.SystemRoleUuid, x.RoleName, x.AddTime, x.AddPeople, x.IsDeleted, x.Id, x.IsFixation, x.SchoolUuid, x.IsCreEdu, _disabled = IsDisabled(x.IsCreEdu.Value, x.IsFixation.Value), }); if (AuthContextService.CurrentUser.SchoolGuid != null) { query = query.Where(x => x.SchoolUuid == AuthContextService.CurrentUser.SchoolGuid); } if (!string.IsNullOrEmpty(payload.Kw)) { query = query.Where(x => x.RoleName.Contains(payload.Kw.Trim())); } if (payload.IsDeleted > CommonEnum.IsDeleted.All) { query = query.Where(x => (CommonEnum.IsDeleted)x.IsDeleted == payload.IsDeleted); } var list = query.Paged(payload.CurrentPage, payload.PageSize).ToList(); var totalCount = query.Count(); //var data = list.Select(_mapper.Map<SystemRole, RoleJsonModel>); response.SetData(list, totalCount); return(Ok(response)); } }