/// <summary> /// 根据学生姓名或手机号查询学生信息 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间: 2019-10-29 </para> /// </summary> /// <param name="keyWord">学生名称或手机号</param> /// <returns>返回学生信息</returns> public List <StudentSearchResponse> GetSchoolStudentList(string keyWord) { // 1、根据学生名称模糊或者电话号码查询学生名称信息 List <ViewStudent> resultList = new ViewStudentRepository().GetViewStudentList(keyWord, this._schoolId); // 2、所有的校区信息 List <SchoolResponse> schoolList = new OrgService().GetAllSchoolList(); // 3、组合数据 List <StudentSearchResponse> list = (from stu in resultList join s in schoolList on stu.SchoolId equals s.SchoolId select new StudentSearchResponse { StudentId = stu.StudentId, StudentName = stu.StudentName, HeadFaceUrl = stu.HeadFaceUrl, Sex = stu.Sex, SexName = EnumName.GetDescription(typeof(SexEnum), stu.Sex), Age = Age.GetAge(stu.Birthday), Birthday = stu.Birthday, LinkMobile = stu.LinkMobile, ContactPersonMobile = string.IsNullOrEmpty(stu.ContactPersonMobile) ? "" : Regex.Replace(stu.ContactPersonMobile.Split(',')[0], "(\\d{3})\\d{4}(\\d{4})", "$1****$2"), //只截取第一个监护人手机号 SchoolId = s.SchoolId, SchoolName = s.SchoolName, StudentNo = stu.StudentNo }).ToList(); return(list); }
/// <summary> /// 根据学生姓名查询学生信息 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间: 2018-10-29 </para> /// </summary> /// <param name="keyWord">学生名称或手机号</param> /// <param name="companyId">当前登录的用户</param> /// <returns>返回学生集合</returns> public static List <StudentSearchResponse> GetListBykeyWord(string keyWord, string companyId = null) { // 1、根据学生名称模糊或者电话号码查询学生名称信息 List <ViewStudent> sList = new ViewStudentRepository().GetViewStudentListByKeyWord(keyWord, companyId); List <long> ids = sList.Select(m => m.StudentId).ToList(); List <TblCstSchoolStudent> cList = new TblCstSchoolStudentRepository().GetSchoolIdByStudentIds(ids); // 2、所有的校区信息 List <SchoolResponse> schoolList = new OrgService().GetAllSchoolList(); // 3、组合数据 List <StudentSearchResponse> list = (from stu in sList select new StudentSearchResponse { StudentId = stu.StudentId, StudentName = stu.StudentName, Sex = stu.Sex, SexName = EnumName.GetDescription(typeof(SexEnum), stu.Sex), Age = Age.GetAge(stu.Birthday), Birthday = stu.Birthday, LinkMobile = stu.LinkMobile, ContactPersonMobile = string.IsNullOrEmpty(stu.ContactPersonMobile) ? "" : Regex.Replace(stu.ContactPersonMobile, "(\\d{3})\\d{4}(\\d{4})", "$1****$2"), //只截取第一个监护人手机号 Company = GetCompanyName(stu.StudentId, schoolList, cList), SchoolName = GetSchoolNameByStuId(stu.StudentId, schoolList, cList) }).ToList(); return(list.ToList()); }
/// <summary> /// 根据查询条件获取学生管理列表 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间: 2019-11-06 </para> /// </summary> /// <param name="req">查询学生查询条件</param> /// <param name="pageIndex">当前页</param> /// <param name="pageSize">每页大小</param> /// <returns>返回学生分页数据</returns> public PageResult <StudentListResponse> GetStudentPageList(StudentListSearchRequest req, int pageIndex, int pageSize) { PageResult <ViewStudent> studentList = new ViewStudentRepository().GetViewStudentList(req, _schoolId, pageIndex, pageSize); PageResult <StudentListResponse> list = Mapper.Map <PageResult <ViewStudent>, PageResult <StudentListResponse> >(studentList); foreach (var item in list.Data) { item.ContactPersonMobile = string.IsNullOrEmpty(item.ContactPersonMobile) ? "" : Regex.Replace(item.ContactPersonMobile, "(\\d{3})\\d{4}(\\d{4})", "$1****$2"); item.Age = Age.GetAgeByBirthday(item.Birthday); } return(list); }