예제 #1
0
        /// <summary>
        /// 根据校区Id、学生Id和学生考勤查询条件获取学生考勤信息
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <param name="schoolId">校区Id</param>
        /// <param name="studentId">学生Id</param>
        /// <param name="request">学生考勤请求对象</param>
        /// <returns>学生考勤信息列表</returns>
        public async Task <List <ViewStudentAttendance> > GetLessonStudentListAsync(string schoolId, long studentId, StudentTimeLessonRequest request)
        {
            StringBuilder querySql = new StringBuilder();

            querySql.Append(LESSON_STUDENT_SQL);
            querySql.Append(@" WHERE B.STUDENTID = @StudentId                                                    
                                                    AND B.SCHOOLID = @SchoolId
                                                    AND B.STATUS = @Status ");
            List <SqlParameter> parameterList = new List <SqlParameter>()
            {
                new SqlParameter("@StudentId", studentId),
                new SqlParameter("@SchoolId", schoolId),
                new SqlParameter("@Status", (int)request.LessonStatus)
            };

            if (request.TermIdList != null && request.TermIdList.Count > 0)
            {
                querySql.Append(" AND B.TermId in (select col from FN_SPLIT(@TermId,',')) ");
                parameterList.Add(new SqlParameter("@TermId", string.Join(",", request.TermIdList)));
            }
            if (request.ClassId.HasValue)
            {
                querySql.Append(" AND B.ClassId = @ClassId ");
                parameterList.Add(new SqlParameter("@ClassId", request.ClassId));
            }
            return(await CurrentContext.ViewStudentAttendance.FromSql(querySql.ToString(), parameterList.ToArray()).ToListAsync());
        }
 public List <StudentTimeLessonResponse> GetLessonStudentList(long studentId, [FromQuery] StudentTimeLessonRequest request)
 {
     return(new StudentTimetableService(base.SchoolId, studentId).GetLessonStudentList(request));
 }