builder.AppendFormat(" AND A.{0} in ({1}) ",nameof(RB_AI_AuthorizeStudent_ViewModel.ApplicationId),query.ApplicationIds);
}
if(query.IsEffective==1)
{
builder.AppendFormat(" AND (A.{0}=2 or (A.{0} =1 AND DATE_FORMAT('{1}','%y-%m-%d')>=DATE_FORMAT(A.{2},'%y-%m-%d') AND DATE_FORMAT('{1}','%y-%m-%d')<=DATE_FORMAT(A.{3},'%y-%m-%d')) ) ",nameof(RB_AI_AuthorizeStudent_ViewModel.DateType),StringHelper.FormatDate(DateTime.Now),nameof(RB_AI_AuthorizeStudent_ViewModel.StartDate),nameof(RB_AI_AuthorizeStudent_ViewModel.EndDate));
...
...
@@ -104,14 +107,68 @@ namespace Edu.Repository.AI
}
if(query.StudentId>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_AuthorizeStudent_ViewModel.StudentId),query.StudentId);
builder.AppendFormat(" AND (A.{0}={1} or A.{0}= -1) ",nameof(RB_AI_AuthorizeStudent_ViewModel.StudentId),query.StudentId);
}
if(query.ApplicationId>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_AuthorizeStudent_ViewModel.ApplicationId),query.ApplicationId);
builder.AppendFormat(" AND A.{0} in ({1}) ",nameof(RB_AI_AuthorizeStudent_ViewModel.ApplicationId),query.ApplicationIds);
}
if(query.IsEffective==1)
{
builder.AppendFormat(" AND (A.{0}=2 or (A.{0} =1 AND DATE_FORMAT('{1}','%y-%m-%d')>=DATE_FORMAT(A.{2},'%y-%m-%d') AND DATE_FORMAT('{1}','%y-%m-%d')<=DATE_FORMAT(A.{3},'%y-%m-%d')) ) ",nameof(RB_AI_AuthorizeStudent_ViewModel.DateType),StringHelper.FormatDate(DateTime.Now),nameof(RB_AI_AuthorizeStudent_ViewModel.StartDate),nameof(RB_AI_AuthorizeStudent_ViewModel.EndDate));
}
}
builder.AppendFormat(" GROUP BY A.StudentId,A.ApplicationId ");
builder.AppendFormat(@" SELECT A.*,b.Name as SupplierName,c.DateType,c.StartDate as StuStartDate,c.EndDate as StuEndDate FROM RB_AI_PresetsApplication as A
inner join RB_AI_AuthorizeStudent as c on c.ApplicationId=a.ID
left join RB_AI_Supplier as b on a.SupplierId=b.Id WHERE 1=1 ");
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Status),(int)DateStateEnum.Normal);
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_AI_Supplier.Status),(int)DateStateEnum.Normal);
builder.AppendFormat(" AND C.{0}={1} ",nameof(RB_AI_AuthorizeStudent.Status),(int)DateStateEnum.Normal);
if(query!=null)
{
if(query.Group_Id>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Group_Id),query.Group_Id);
}
if(query.ID>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.ID),query.ID);
}
if(query.School_Id>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.School_Id),query.School_Id);
}
if(query.SupplierId>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.SupplierId),query.SupplierId);
}
if(query.SupplierType>0)
{
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_AI_Supplier_ViewModel.SupplierType),query.SupplierType);
}
if(query.Enable>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Enable),query.Enable);
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Enable),query.Enable);
}
if(!string.IsNullOrWhiteSpace(query.Name))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ",nameof(RB_AI_PresetsApplication_ViewModel.Name));
parameters.Add("Name","%"+query.Name.Trim()+"%");
}
if(query.IsEffective==1)
{
builder.AppendFormat(" AND (c.{0}=2 or (c.{0} =1 AND DATE_FORMAT('{1}','%y-%m-%d')>=DATE_FORMAT(c.{2},'%y-%m-%d') AND DATE_FORMAT('{1}','%y-%m-%d')<=DATE_FORMAT(c.{3},'%y-%m-%d')) ) ",nameof(RB_AI_AuthorizeStudent_ViewModel.DateType),StringHelper.FormatDate(DateTime.Now),nameof(RB_AI_AuthorizeStudent_ViewModel.StartDate),nameof(RB_AI_AuthorizeStudent_ViewModel.EndDate));
}
if(query.StudentId>0)
{
builder.AppendFormat(" AND (c.{0}={1} or c.{0}=-1 ) ",nameof(RB_AI_AuthorizeStudent_ViewModel.StudentId),query.StudentId);
builder.AppendFormat(@" SELECT A.*,b.Name as SupplierName,c.DateType,c.StartDate as StuStartDate,c.EndDate as StuEndDate FROM RB_AI_PresetsApplication as A
inner join RB_AI_AuthorizeStudent as c on c.ApplicationId=a.ID
left join RB_AI_Supplier as b on a.SupplierId=b.Id WHERE 1=1 ");
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Status),(int)DateStateEnum.Normal);
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_AI_Supplier.Status),(int)DateStateEnum.Normal);
builder.AppendFormat(" AND C.{0}={1} ",nameof(RB_AI_AuthorizeStudent.Status),(int)DateStateEnum.Normal);
if(query!=null)
{
if(query.Group_Id>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Group_Id),query.Group_Id);
}
if(query.ID>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.ID),query.ID);
}
if(query.School_Id>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.School_Id),query.School_Id);
}
if(query.SupplierId>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.SupplierId),query.SupplierId);
}
if(query.SupplierType>0)
{
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_AI_Supplier_ViewModel.SupplierType),query.SupplierType);
}
if(query.Enable>0)
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Enable),query.Enable);
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_AI_PresetsApplication_ViewModel.Enable),query.Enable);
}
if(!string.IsNullOrWhiteSpace(query.Name))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ",nameof(RB_AI_PresetsApplication_ViewModel.Name));
parameters.Add("Name","%"+query.Name.Trim()+"%");
}
if(query.IsEffective==1)
{
builder.AppendFormat(" AND (c.{0}=2 or (c.{0} =1 AND DATE_FORMAT('{1}','%y-%m-%d')>=DATE_FORMAT(c.{2},'%y-%m-%d') AND DATE_FORMAT('{1}','%y-%m-%d')<=DATE_FORMAT(c.{3},'%y-%m-%d')) ) ",nameof(RB_AI_AuthorizeStudent_ViewModel.DateType),StringHelper.FormatDate(DateTime.Now),nameof(RB_AI_AuthorizeStudent_ViewModel.StartDate),nameof(RB_AI_AuthorizeStudent_ViewModel.EndDate));
}
if(query.StudentId>0)
{
builder.AppendFormat(" AND (c.{0}={1} or c.{0}=-1 ) ",nameof(RB_AI_AuthorizeStudent_ViewModel.StudentId),query.StudentId);