public ResponseMessage <object> QueryDataByNameAndTypeByPage([FromBody] QueryByPageWithDeptRequest reqMsg) { List <object> reslst = new List <object>(); var total = _sysJobService.QueryDataByNameAndType(reqMsg.keyWords, reqMsg.status, reqMsg.dept); var list = _sysJobService.QueryDataByNameAndTypeByPage(reqMsg.keyWords, reqMsg.status, reqMsg.dept, reqMsg.OrderBy, reqMsg.limit, reqMsg.offset); foreach (var item in list.OrderBy(t => t.sort)) { var org = _sysOrgService.GetById(item.org_id); Object deptobj = new { id = org.id, name = org.org_name, enabled = org.dept_type, pid = org.parent_id, createTime = org.created_time.ToString(), label = org.org_name }; Object obj = new { id = item.id, sort = item.sort, label = item.job_name, name = item.job_name, pid = 0, job_name = item.job_name, is_enable = item.is_enable, dept = deptobj, deptSuperiorName = org.org_name, createTime = item.created_time.ToString() }; reslst.Add(obj); } return(new ResponseMessage <object> { data = new { content = reslst, totalElements = total } }); }
public ResponseMessage <object> QueryDataByDept([FromBody] QueryByPageWithDeptRequest reqMsg) { List <UserInfoResult> reslst = new List <UserInfoResult>(); var rolemaps = _sysUserAppRoleService.QueryDataByPage(new QueryByPageRequest() { limit = 10000, page = 1 }); var roles = _sysAppRoleService.QueryDataByPage(new QueryByPageRequest() { limit = 10000, page = 1 }); var total = _sysUserService.QueryDataRecord(new QueryByPageRequest() { keyWords = reqMsg.keyWords, limit = reqMsg.limit, page = reqMsg.page }); var list = _sysUserService.QueryDataByPage(new QueryByPageRequest() { keyWords = reqMsg.keyWords, limit = reqMsg.limit, page = reqMsg.page }); if (reqMsg.dept != null) { string dept = reqMsg.dept; list = list.Where(t => t.org_id == dept).ToList(); } foreach (var item in list) { var deptobj = new { id = "", name = "" }; if (!string.IsNullOrEmpty(item.org_id)) { var org = _sysOrgService.GetById(item.org_id); deptobj = new { id = org.id, name = org.org_name }; } var jobobj = new { id = "", name = "" }; if (!string.IsNullOrEmpty(item.job_id)) { var job = _sysJobService.GetById(item.job_id); jobobj = new { id = job.id, name = job.job_name }; } var approlemaps = rolemaps.Where(t => t.app_id == reqMsg.app && t.user_id == item.id).ToList(); List <object> roleobjs = new List <object>(); foreach (var rolemapitem in approlemaps) { var rolename = roles.Where(t => t.id == rolemapitem.role_id).ToList()[0].role_code; Object roleobj = new { id = rolemapitem.role_id, name = rolename }; roleobjs.Add(roleobj); } UserInfoResult resitem = new UserInfoResult { user = item, dept = deptobj, job = jobobj, role = roleobjs }; reslst.Add(resitem); } return(new ResponseMessage <object> { data = new { content = reslst, totalElements = total } }); }