where+=$@" and a.MallBaseId = {model.MallBaseId} ";
}
if(model.Id>0)
{
where+=$@" and a.Id = {model.Id} ";
}
if(model.CreateBy>0)
{
where+=$@" and a.CreateBy = {model.CreateBy} ";
}
if(!string.IsNullOrWhiteSpace(model.Ids))
{
where+=$@" and a.Id in({model.Ids}) ";
}
}
stringsql=$@"SELECT e.`Name` as CreateByName,e.Photo as CrearteByPhoto,a.TenantId,a.MallBaseId,a.CreateBy,a.id,a.UserTeacher,a.Content,a.Files,a.LatAndLong,a.Address,a.CreateTime,a.CoverPhoto,a.FileType,a.IsOpen,a.`Status`,a.TalkId as tid from
Rb_Education_Dynamic a
LEFT JOIN rb_member_user e on e.Id = a.CreateBy {where}";
sb.Append($@"SELECT a.*,b.`Name`,b.Photo from RB_MiAi_BaseInfo as a
sb.Append($@"SELECT a.*,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age from RB_MiAi_BaseInfo as a
LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ");
if(where!=null)
{
...
...
@@ -126,9 +126,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
}
if(where.UserId>0)
{
sb.AppendFormat(" and a.UserId={0}",where.UserId);
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);
...
...
@@ -136,14 +139,14 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
if(where.Sort==1)
{
// sb.AppendFormat(" order by ");
// sb.AppendFormat(" order by ");
}
elseif(where.Sort==2)
{
sb.AppendFormat($@" ORDER BY (((a.FollowNum* {where.FollowRate})+(a.BrowseNum*{where.BrowseRate}))) desc");
}
elseif(where.Sort==3)
elseif(where.Sort==3)
{
sb.AppendFormat(" ORDER BY b.CreateDate desc ");
}
...
...
@@ -153,6 +156,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
/// <summary>
/// 分页列表
/// </summary>
...
...
@@ -164,7 +173,7 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
sb.Append($@"SELECT a.*,b.`Name`,b.Photo from RB_MiAi_BaseInfo as a
sb.Append($@"SELECT a.*,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age from RB_MiAi_BaseInfo as a
LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ");
if(where!=null)
{
...
...
@@ -182,7 +191,11 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
}
if(where.UserId>0)
{
sb.AppendFormat(" and a.UserId={0}",where.UserId);
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))
...
...
@@ -204,7 +217,69 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis