sb.Append($@"SELECT * from (SELECT c.*,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( c.Birthday )- 1+ (DATE_FORMAT( c.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age from RB_MiAi_BaseInfo as c
LEFT JOIN rb_member_user as b on c.UserId=b.Id where c.Status=0 and b.Blacklist!=1
) as a where 1=1");
if(where!=null)
{
if(where.TenantId>0)
{
sb.AppendFormat(" and a.TenantId={0}",where.TenantId);
}
if(where.MallBaseId>0)
{
sb.AppendFormat(" and a.MallBaseId={0}",where.MallBaseId);
}
if(where.Id>0)
{
sb.AppendFormat(" and a.Id={0}",where.Id);
}
if(where.UserId>0)
{
sb.AppendFormat(" and a.UserId !={0}",where.UserId);
}
if(where.Sex>0)
{
sb.AppendFormat(" and a.Sex ={0}",where.Sex);
}
if(!string.IsNullOrWhiteSpace(where.UserIds))
{
sb.AppendFormat(" and a.UserId in({0})",where.UserIds);
}
if(where.Age>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Age)} >={where.Age}");
}
if(where.EndAge>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Age)} <={where.EndAge}");
}
if(where.Height>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Height)} >={where.Height}");
}
if(where.EndHeight>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Height)} <={where.EndHeight}");
}
if(where.Weight>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Weight)} >={where.Weight}");
}
if(where.EndWeight>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Weight)} <={where.EndWeight}");
}
if(where.YearMoney>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.YearMoney)} >={where.YearMoney}");
}
if(where.EndYearMoney>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.YearMoney)} <={where.EndYearMoney}");
}
if(where.CarInfo.HasValue&&where.CarInfo.Value>0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.CarInfo)} ={(int)where.CarInfo}");