// GET: Student #region 学生列表相关操作 public ActionResult Index() { DtoSchoolStudentSearch search = new DtoSchoolStudentSearch(); search.SchoolId = CurrentUser.Teacher.Yoh_SchoolId; return(View(search)); }
public ActionResult GetStudentList(DtoSchoolStudentSearch search) { var list = studentBll.GetSchoolStudentList(search); var table = AbhsTableFactory.Create(list, search.Pagination.TotalCount); return(Json(table, JsonRequestBehavior.AllowGet)); }
public List <DtoSchoolStudent> GetSchoolStudentList(DtoSchoolStudentSearch search) { return(StudentRepository.GetSchoolStudentList(search)); }
/// <summary> /// 学校学生列表 /// </summary> /// <param name="search"></param> /// <returns></returns> public List <DtoSchoolStudent> GetSchoolStudentList(DtoSchoolStudentSearch search) { if (search == null) { return(null); } var strWhere = new StringBuilder(); var fields = "s.*,sp.Bsp_PassportKey AS StudentAccount,sc.Bsl_SchoolName AS SchoolName,ss.Sst_OwnCourseCount"; var orderBy = "s.Bst_Id DESC "; var parameters = new DynamicParameters(); strWhere.Append(@"dbo.Bas_Student s JOIN dbo.Bas_StudentPassport sp ON s.Bst_Id = sp.Bsp_StudentId JOIN dbo.Bas_School sc ON s.Bst_SchoolId = sc.Bsl_Id JOIN dbo.Sum_Student ss ON s.Bst_Id = ss.Sst_StudentId WHERE 1 = 1 "); if (search.SchoolId > 0) { strWhere.Append("AND s.Bst_SchoolId=@Bst_SchoolId "); parameters.Add("Bst_SchoolId", search.SchoolId); } strWhere.Append(" AND sp.Bsp_PassportType=@Bsp_PassportType "); parameters.Add("Bsp_PassportType", (int)StudentAccountSourceEnum.手机); if (search.StudentId > 0) { strWhere.Append(" AND s.Bst_Id=@Bst_Id "); parameters.Add("Bst_Id", search.StudentId); } else { if (search.Grade > 0) { strWhere.Append(" AND s.Bst_Grade=@Bst_Grade "); parameters.Add("Bst_Grade", search.Grade); } if (search.Status > 0) { strWhere.Append(" AND s.Bst_Status=@Bst_Status "); parameters.Add("Bst_Status", search.Status); } if (search.Bst_No.HasValue()) { strWhere.Append(" AND s.Bst_No=@Bst_No "); parameters.Add("Bst_No", search.Bst_No); } if (search.AccountType > 0) { if (search.AccountType == (int)StudentAccountTypeEnum.客户) { strWhere.Append(" AND ss.Sst_OwnCourseCount>0 "); } else if (search.AccountType == (int)StudentAccountTypeEnum.用户) { strWhere.Append(" AND ss.Sst_OwnCourseCount=0 "); } } if (search.SearchStr.HasValue()) { strWhere.Append(" AND (s.Bst_Phone LIKE @Bst_Phone OR s.Bst_NickName LIKE @Bst_NickName OR sp.Bsp_PassportKey LIKE @Bsp_PassportKey) "); parameters.Add("Bst_Phone", $"%{search.SearchStr}%"); parameters.Add("Bst_NickName", $"%{search.SearchStr}%"); parameters.Add("Bsp_PassportKey", $"%{search.SearchStr}%"); } } return(base.QueryPaging <DtoSchoolStudent>(fields, strWhere._ToString(), orderBy, search.Pagination, parameters).ToList()); }