public PagedList <EMPLOYEE> QueryEmpList(EmpInfoSearch search, PageView view) { int deptId = search.GroupID; List <int> deptIds = new List <int>(); //获取所有大区、区域、门店 if (deptId > 0) { deptIds.Add(deptId); var groups = _groupRepo.GetRecursiveAllByParentID(deptId); List <int> groupIds = groups.Select(m => m.ID).ToList(); if (groupIds.Count > 0) { deptIds.AddRange(groupIds); } } //else //{ // groupIds.Add(deptId); //} //var stores = _storeRepo.GetByGroupID(groupIds.ToArray()); //if (stores.Count > 0) //{ // var storeIds = stores.Select(m => m.ID).ToList(); // deptIds.AddRange(storeIds); //} return(_empRepo.QueryList(deptIds.ToArray(), search, view)); }
public ActionResult QueryEmpList(FormCollection form) { EmpInfoSearch search = new EmpInfoSearch(); search.EmpName = form["EMP_NAME"]; string sGroupId = form["SelectGroupId"]; if (string.IsNullOrEmpty(sGroupId)) { search.GroupID = 0; } else { search.GroupID = int.Parse(sGroupId); } PageView view = new PageView(form); string colkey = form["colkey"]; string colsinfo = form["colsinfo"]; //员工列表 PagedList <EMPLOYEE> pList = EmployeeService.QueryEmpList(search, view); JsonQTable fdata = JsonQTable.ConvertFromPagedList <EMPLOYEE>(pList, colkey, colsinfo.Split(',')); //var list = EmployeeService.QueryEmpList(search.GroupID); //JsonQTable fdata = JsonQTable.ConvertFromList<EMPLOYEE_EX>(list, colkey, colsinfo.Split(','), CheckState<EMPLOYEE_EX>); return(Json(fdata)); }
public PagedList <EMPLOYEE> QueryList(int[] groupIds, EmpInfoSearch search, PageView view) { string cols = @" EMP.* "; string sqlWhere = ""; if (groupIds.Length > 0) { string ids = string.Join(",", groupIds); sqlWhere += " AND REG.GROUP_ID IN (" + ids + ") "; } if (!string.IsNullOrEmpty(search.EmpName)) { sqlWhere += " AND (EMP.NAME LIKE '" + search.EmpName + "%' OR EMP.MOBILE LIKE '" + search.EmpName + "%' OR EMP.USERID LIKE '" + search.EmpName + "%')"; } return(base.PageGet <EMPLOYEE>(view, cols, "EMPLOYEE EMP inner join REL_EMP_GROUP REG on REG.EMP_ID =EMP.ID" , sqlWhere , "EMP.ID", "")); }