/// <summary> /// 查询列表 /// </summary> /// <param name="model"></param> /// <returns></returns> public FuncResult Select(SearchSysModuleModel model) { var query = from a in _context.SysModules where (model.ModuleLevel == 0 || a.Level == model.ModuleLevel) && (string.IsNullOrWhiteSpace(model.ModuleName) || a.ModuleName.Contains(model.ModuleName)) join b in _context.SysModules on a.ParentId equals b.Id into a_temp from a_ifnull in a_temp.DefaultIfEmpty() join c in _context.SysModules on a_ifnull.ParentId equals c.Id into b_temp from c_ifnul in b_temp.DefaultIfEmpty() orderby a.Creation_Date descending select new { moduleId = a.Id, moduleName = a.ModuleName, moduleLevel = ChineseCharacter(a.Level), firstModuleId = c_ifnul != null ? c_ifnul.Id : a_ifnull == null ? "" : a_ifnull.Id, firstModuleName = c_ifnul != null ? c_ifnul.ModuleName : a_ifnull == null ? "未选择" : a_ifnull.ModuleName, //firstModuleName = a_ifnull != null ? a_ifnull.ModuleName : c_ifnul == null ? "未选择" : c_ifnul.ModuleName, firstModuleLevel = c_ifnul != null?ChineseCharacter(c_ifnul.Level) : a_ifnull == null ? "" : ChineseCharacter(a_ifnull.Level), secondModuleId = c_ifnul == null ? "" : a_ifnull.Id, secondModuleName = c_ifnul == null ? "未选择" : a_ifnull.ModuleName, secondModuleLevel = c_ifnul == null ? "" : ChineseCharacter(a_ifnull.Level), Creation_Date = a.Creation_Date.ToString("yyyy-MM-dd HH:mm:ss") }; int total = query.Count(); // var data = query.Skip(model.limit * model.page).Take(model.limit); var data = query.Skip(model.limit * model.page);//.Take(model.limit).ToList(); return(new FuncResult() { IsSuccess = true, Content = new { data, total } }); }
public FuncResult Select([FromBody] SearchSysModuleModel model) { model.page--; if (model.page < 0) { model.page = 0; } return(sysmoduleService.Select(model)); }