public PageDateRes <Pub_Role> GetPage([FromBody] PageDataReq pageReq) { var whereStr = GetWhereStr(); if (whereStr == "-1") { return(new PageDateRes <Pub_Role>() { code = ResCode.Error, msg = "查询参数有误!", data = null }); } var list = bll.GetPage(whereStr, (pageReq.field + " " + pageReq.order), pageReq.pageNum, pageReq.pageSize); return(list); }
public PageDateRes <Pub_course> GetCourseInfoAdmin([FromBody] PageDataReq pageReq) { var whereStr = GetWhereStr(2); if (whereStr == "-1") { return(new PageDateRes <Pub_course>() { code = ResCode.Error, msg = "查询参数有误!", data = null }); } var courses = courseBll.GetPage(whereStr, (pageReq.field + " " + pageReq.order), pageReq.pageNum, pageReq.pageSize); courses.data.ForEach(p => { if (p.imgUrl == null) { p.imgUrl = preImgUrl + p.imgName; } }); return(courses); }
public PageDateRes <V_PubUser_Dept> GetPage([FromBody] PageDataReq pageReq) { var whereStr = GetWhereStr(); if (whereStr == "-1") { return(new PageDateRes <V_PubUser_Dept>() { code = ResCode.Error, msg = "查询参数有误!", data = null }); } var users = userDeptBLL.GetPage(whereStr, (pageReq.field + " " + pageReq.order), pageReq.pageNum, pageReq.pageSize); // PageDateRes<V_PubUser_DeptExt> users = usersPage.MapTo<PageDateRes <V_PubUser_Dept>,PageDateRes <V_PubUser_DeptExt>>(); var userCodes = string.Join("','", users.data.Select(p => p.UserCode)); List <Pub_UserRole> userRoles = userRoleBLL.GetList($"userCode in ('{userCodes}')"); users.data.ForEach(p => { p.RoleCodes = userRoles.Where(c => c.UserCode == p.UserCode).Select(d => d.RoleCode); }); return(users); }