Commit a9706783 authored by 黄奎's avatar 黄奎

新增实体类

parent c3330d57
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 学员补课表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Student_Makeup
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 学员编号
/// </summary>
public int OrderGuestId { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 上课日期
/// </summary>
public DateTime ClassDate { get; set; }
/// <summary>
/// 补课状态(1-正常,2-已处理,3-未处理)
/// </summary>
public int MakeUpStatus { get; set; }
/// <summary>
/// 签到编号
/// </summary>
public int ClassCheckId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 处理人
/// </summary>
public int DealBy { get; set; }
/// <summary>
/// 处理时间
/// </summary>
public DateTime DealTime { get; set; }
}
}
......@@ -23,5 +23,10 @@ namespace Edu.Model.ViewModel.Course
/// 完成分钟数
/// </summary>
public decimal FinishMinutes { get; set; }
/// <summary>
/// 完成课时数
/// </summary>
public decimal FinishClassHours { get; set; }
}
}
using Edu.Model.Entity.Course;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 学员补课表扩展实体类
/// </summary>
public class RB_Student_Makeup_ViewModel: RB_Student_Makeup
{
/// <summary>
/// 学员状态
/// </summary>
public int GuestState { get; set; }
/// <summary>
/// 处理状态字符串
/// </summary>
public string MakeUpStatusStr
{
get
{
string str = "";
switch (this.MakeUpStatus)
{
case 1: str = "正常"; break;
case 2: str = "已处理"; break;
case 3: str = "未处理"; break;
}
return str;
}
}
/// <summary>
/// 学员状态
/// </summary>
public string GuestStateStr
{
get
{
string str = "";
switch (this.GuestState)
{
case 1: str = "正常"; break;
case 2: str = "退学"; break;
case 3: str = "申请退学中"; break;
case 4: str = "驳回申请"; break;
case 5: str = "停课"; break;
}
return str;
}
}
/// <summary>
/// 学员姓名
/// </summary>
public string GuestName { get; set; }
/// <summary>
/// 班级名称
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 教师名称
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 教室名称
/// </summary>
public string RoomName { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndDate { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndTime { get; set; }
}
}
This diff is collapsed.
......@@ -64,100 +64,6 @@ WHERE 1=1 AND A.Status=0 ");
return Get<RB_Class_Check_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取签到记录分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_Check_ViewModel> GetClassCheckPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_Check_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName,IFNULL(B.GuestState,0) AS GuestState,IFNULL(C.ClassName,'') AS ClassName
,IFNULL(D.CourseName,'') AS CourseName,IFNULL(E.RoomName,'') AS RoomName,IFNULL(F.TeacherName,'') AS TeacherName
FROM RB_Class_Check AS A LEFT JOIN rb_order_guest AS B ON A.OrderGuestId=B.Id
LEFT JOIN rb_class AS C ON A.ClassId=C.ClassId
LEFT JOIN rb_course AS D ON C.CouseId=D.CourseId
LEFT JOIN rb_class_room AS E ON A.ClassRoomId=E.RoomId
LEFT JOIN rb_teacher AS F ON A.TeacherId=F.TId
WHERE 1=1 AND A.Status=0 ");
builder.AppendFormat(" AND A.{0} IN(2,3) ", nameof(RB_Class_Check_ViewModel.MakeUpStatus));
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
//builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.School_Id), query.School_Id);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.ClassId), query.ClassId);
}
if (!string.IsNullOrEmpty(query.Q_ClassIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_Check_ViewModel.ClassId), query.Q_ClassIds);
}
if (query.OrderGuestId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.OrderGuestId), query.OrderGuestId);
}
if (!string.IsNullOrWhiteSpace(query.StartDate))
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')>=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.ClassDate), query.StartDate);
}
if (!string.IsNullOrWhiteSpace(query.EndDate))
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%Y-%m-%d')<=DATE_FORMAT('{1}','%Y-%m-%d') ", nameof(RB_Class_Check_ViewModel.ClassDate), query.EndDate);
}
if (query.CheckStatus > -1)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.CheckStatus), query.CheckStatus);
}
if (query.IsAbsentHours > -1)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.IsAbsentHours), query.IsAbsentHours);
}
if (query.MakeUpStatus > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.MakeUpStatus), query.MakeUpStatus);
}
if (!string.IsNullOrEmpty(query.GuestName))
{
builder.AppendFormat(" AND B.{0} LIKE @GuestName ", nameof(RB_Order_Guest.GuestName));
parameters.Add("GuestName", "%" + query.GuestName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.ClassName))
{
builder.AppendFormat(" AND C.{0} LIKE @ClassName ", nameof(RB_Class.ClassName));
parameters.Add("ClassName", "%" + query.ClassName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.CourseName))
{
builder.AppendFormat(" AND D.{0} LIKE @CourseName ", nameof(RB_Course.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.TeacherName))
{
builder.AppendFormat(" AND F.{0} LIKE @TeacherName ", nameof(RB_Teacher.TeacherName));
parameters.Add("TeacherName", "%" + query.TeacherName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.RoomName))
{
builder.AppendFormat(" AND E.{0} LIKE @RoomName ", nameof(RB_Class_Room.RoomName));
parameters.Add("RoomName", "%" + query.RoomName.Trim() + "%");
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Class_Check_ViewModel.ClassDate));
return GetPage<RB_Class_Check_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取签到列表
/// </summary>
......@@ -166,7 +72,10 @@ WHERE 1=1 AND A.Status=0 ");
public List<RB_Class_Check_ViewModel> GetClassCheckStatistics(RB_Class_Check_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.ClassId,A.ClassDate,COUNT(0) AS CheckNum FROM RB_Class_Check AS A WHERE 1=1 AND `Status` =0 and CheckStatus =0 ");
builder.AppendFormat(@"
SELECT A.ClassId,A.ClassDate,COUNT(0) AS CheckNum
FROM RB_Class_Check AS A
WHERE 1=1 AND `Status` =0 and CheckStatus =0 ");
if (query != null)
{
if (query.Group_Id > 0)
......@@ -240,19 +149,22 @@ WHERE 1=1 AND A.Status=0 ");
/// </summary>
/// <param name="guestIds">学员编号</param>
/// <returns></returns>
public List<GuestFinishMinute_ViewModel> GetGuestFinishMinutesRepository(string guestIds)
public List<GuestFinishMinute_ViewModel> GetGuestFinishMinutesRepository(string guestIds,int ClassCheckId=0)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT B.OrderGuestId AS GuestId,SUM(IFNULL(B.FinishMinutes,0)) AS FinishMinutes
FROM
(
SELECT A.OrderGuestId, SUM(A.StudyNum) AS FinishMinutes
FROM rb_class_check AS A
WHERE A.CheckStatus=0 AND A.OrderGuestId IN({0})
) AS B
GROUP BY B.OrderGuestId
", guestIds);
SELECT A.OrderGuestId AS GuestId,SUM(A.StudyNum) AS FinishMinutes,SUM(A.CurrentDeductionHours) AS FinishClassHours
FROM rb_class_check AS A
WHERE A.CheckStatus=0 ");
if (!string.IsNullOrEmpty(guestIds))
{
builder.AppendFormat(" AND A.OrderGuestId IN({0})", guestIds);
}
if (ClassCheckId > 0)
{
builder.AppendFormat(" AND A.ClassCheckId<>{0} ", ClassCheckId);
}
builder.AppendFormat(" GROUP BY A.OrderGuestId ");
return Get<GuestFinishMinute_ViewModel>(builder.ToString()).ToList();
}
......@@ -431,12 +343,5 @@ WHERE g.Group_Id ={groupId} and g.`Status`=0 and g.GuestState <>2 and c.`Status`
group by g.OrderId,DATE_FORMAT(c.ClassDate,'%Y-%m');";
return Get<RB_Class_Check_ViewModel>(sql).ToList();
}
public bool ClearCheck()
{
string sql = " TRUNCATE TABLE rb_class_check ";
base.ExecuteScalar(sql);
return true;
}
}
}
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 学员补课仓储层
/// </summary>
public class RB_Student_MakeupRepository:BaseRepository<RB_Student_Makeup>
{
/// <summary>
/// 获取学员补课列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Makeup_ViewModel> GetStudentMakeupPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Student_Makeup_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,C.GuestName, D.ClassName,E.CourseName,F.TeacherName,G.RoomName,C.GuestState,H.StartTime,H.EndTime
FROM RB_Student_Makeup AS A LEFT JOIN rb_class_check AS B ON A.ClassCheckId=B.ClassCheckId
LEFT JOIN rb_order_guest AS C ON A.OrderGuestId=C.Id
LEFT JOIN rb_class AS D ON A.ClassId=D.ClassId
LEFT JOIN rb_course AS E ON D.CouseId=E.CourseId
LEFT JOIN rb_teacher AS F ON B.TeacherId=F.TId
LEFT JOIN rb_class_room AS G ON B.ClassRoomId=G.RoomId
LEFT JOIN rb_class_time AS H ON B.ClassTimeId=H.ClassTimeId
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Makeup_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.GuestName))
{
builder.AppendFormat(" AND C.{0} LIKE @GuestName ", nameof(RB_Student_Makeup_ViewModel.GuestName));
parameters.Add("GuestName", "%" + query.GuestName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.ClassName))
{
builder.AppendFormat(" AND D.{0} LIKE @ClassName ", nameof(RB_Student_Makeup_ViewModel.ClassName));
parameters.Add("ClassName", "%" + query.ClassName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.CourseName))
{
builder.AppendFormat(" AND E.{0} LIKE @CourseName ", nameof(RB_Student_Makeup_ViewModel.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (query.MakeUpStatus>0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Makeup_ViewModel.MakeUpStatus),query.MakeUpStatus);
}
if (!string.IsNullOrEmpty(query.StartDate))
{
builder.AppendFormat(" AND A.{0}>='{1}' ", nameof(RB_Student_Makeup_ViewModel.ClassDate), query.StartDate);
}
if (!string.IsNullOrEmpty(query.EndDate))
{
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Student_Makeup_ViewModel.ClassDate), query.EndDate);
}
}
builder.Append(" ORDER BY A.ClassId,A.ClassDate,A.OrderGuestId ");
return GetPage<RB_Student_Makeup_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment