SELECT A.*,IFNULL(B.StuName,'') AS StuName,IFNULL(B.StuTel,'') AS StuTel
FROM RB_Student_Visit AS A INNER JOIN rb_student AS B ON A.StuId=B.StuId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Student_Visit_Extend.Status),(int)DateStateEnum.Normal);
if(query!=null)
{
if(query.Group_Id>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Student_Visit_Extend.Group_Id),query.Group_Id);
}
if(query.StuId>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Student_Visit_Extend.StuId),query.StuId);
}
if(!string.IsNullOrEmpty(query.QueryDate))
{
//今日到访
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%y/%m/%d')= DATE_FORMAT('{1}','%y/%m/%d') ",nameof(RB_Student_Visit_Extend.CreateTime),Common.ConvertHelper.FormatDate(query.QueryDate));
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ",nameof(RB_Student_Visit_Extend.Id));
SELECT A.*,IFNULL(B.`Name`,'') AS VisitorName,C.ClassDate,C.ClassTime,C.EndTime,C.ClassContent,IFNULL(D.TeacherName,'') AS TeacherName,IFNULL(E.RoomName,'') AS RoomName
FROM RB_Visitor_Reserve AS A LEFT JOIN rb_visitor AS B ON A.Visitor_Id=B.Id
SELECT A.*,IFNULL(B.StuName,'') AS VisitorName,C.ClassDate,C.ClassTime,C.EndTime,C.ClassContent,IFNULL(D.TeacherName,'') AS TeacherName,IFNULL(E.RoomName,'') AS RoomName
FROM RB_Visitor_Reserve AS A LEFT JOIN rb_student AS B ON A.Visitor_Id=B.StuId
LEFT JOIN rb_reserve_class AS C ON A.ReserveClassId=C.ReserveClassId
LEFT JOIN rb_teacher AS D ON C.TeacherId=D.TId
LEFT JOIN rb_class_room AS E ON C.ClassRoomId=E.RoomId