joinTable=string.Format(" INNER JOIN (SELECT PlanId,DutyMan FROM rb_duty_plandetails WHERE 1=1 AND DutyMan IN({0})) AS C ON A.Id=C.PlanId ",query.QDutyMan);
}
StringBuilderbuilder=newStringBuilder();
builder.AppendFormat(@"
SELECT A.* ,IFNULL(B.SName,'') AS SchoolName
FROM RB_Duty_Plan AS A LEFT JOIN rb_school AS B ON A.School_Id=B.SId
FROM RB_Duty_Plan AS A LEFT JOIN rb_school AS B ON A.School_Id=B.SId
{0}
WHERE 1=1
");
",joinTable);
builder.AppendFormat(@" AND A.{0}={1} ",nameof(RB_Duty_Plan_ViewModel.Status),(int)DateStateEnum.Normal);
if(query==null)
{
...
...
@@ -108,7 +115,7 @@ WHERE 1=1 AND A.`Status`=0
{
builder.AppendFormat(@" AND A.{0}={1} ",nameof(RB_Duty_Plan_ViewModel.Group_Id),query.Group_Id);
}
if(query.QDutyMan>0)
if(!string.IsNullOrEmpty(query.QDutyMan))
{
builder.AppendFormat(@" AND B.{0}={1} ",nameof(RB_Duty_PlanDetails_ViewModel.DutyMan),query.QDutyMan);