@@ -156,11 +156,13 @@ union all SELECT a.TenantId,a.MallBaseId,a.CreateBy,a.id,a.UserTeacher,a.Content
likeWhere+=$@" and l.UserId = {model.UserId} ";
}
}
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,e.`Name` as CreateByName,e.TeacherLogo as CrearteByPhoto
from (SELECT 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` from
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,talk.Id as TalkId,
talk.Content as TalkContent,e.`Name` as CreateByName,e.TeacherLogo as CrearteByPhoto
from (SELECT 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 {where} ) as t
LEFT JOIN rb_education_dynamiclike l on l.ArticleId = t.id {likeWhere}
LEFT JOIN rb_education_teacher e on e.Id = t.UserTeacher
LEFT JOIN rb_education_talk as talk on talk.id=t.tid and talk.`Status`= 0
stringsql=$@"SELECT * from ((SELECT a.Id,a.Content,a.CoverPhoto,a.FileType,a.Files,c.CreateTime,c.UserId,
c.Content as CommentContent,1 as RealtionType,e.`Name` as CreateByName,e.Photo as CrearteByPhoto,mu.`Name` as ReplyName,mu.Photo as ReplyPhoto,c.Id as CommentId
c.Content as CommentContent,1 as RealtionType,e.`Name` as CreateByName,e.Photo as CrearteByPhoto,mu.`Name` as ReplyName,mu.Photo as ReplyPhoto,c.Id as CommentId ,talk.Id as TalkId,talk.Content as TalkContent
from rb_education_dynamiccomment c INNER JOIN rb_education_dynamic a on a.Id = c.ArticleId and
a.CreateBy={model.CreateBy} and a.TenantId={model.TenantId} and a.MallBaseId={model.MallBaseId}
and a.`Status` =0 and c.`Status` =0 and c.TenantId={model.TenantId} and c.MallBaseId={model.MallBaseId}
LEFT JOIN rb_member_user e on e.Id = c.UserId LEFT JOIN rb_education_dynamiccomment as edc on edc.Id=c.CommentId
LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId)
LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId LEFT JOIN rb_education_talk as talk on talk.id=a.TalkId and talk.`Status`= 0)
'' as CommentContent,2 as RealtionType,e.`Name` as CreateByName,e.Photo as CrearteByPhoto,'' as ReplyName ,'' as ReplyPhoto,0 as CommentId
'' as CommentContent,2 as RealtionType,e.`Name` as CreateByName,e.Photo as CrearteByPhoto,'' as ReplyName ,'' as ReplyPhoto,0 as CommentId,talk.Id as TalkId,talk.Content as TalkContent
from rb_education_dynamiclike l JOIN rb_education_dynamic a on a.Id = l.ArticleId and
a.CreateBy={model.CreateBy} and a.TenantId={model.TenantId} and a.MallBaseId={model.MallBaseId}
and a.`Status` =0 and l.TenantId={model.TenantId} and l.MallBaseId={model.MallBaseId}
LEFT JOIN rb_member_user e on e.Id = l.UserId)) as t
LEFT JOIN rb_member_user e on e.Id = l.UserId LEFT JOIN rb_education_talk as talk on talk.id=a.TalkId and talk.`Status`= 0)) as t
@@ -271,7 +277,7 @@ LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId)
{
where+=$@" and a.MallBaseId = {model.MallBaseId} ";
}
if(model.Id>0)
{
where+=$@" and a.Id = {model.Id} ";
...
...
@@ -285,11 +291,12 @@ LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId)
likeWhere+=$@" and l.UserId = {model.UserId} ";
}
}
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,e.`Name` as CreateByName,e.Photo as CrearteByPhoto
from (SELECT 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` from
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,talk.Id as TalkId,talk.Content as TalkContent,e.`Name` as CreateByName,e.Photo as CrearteByPhoto
from (SELECT 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 {where} ) as t
LEFT JOIN rb_education_dynamiclike l on l.ArticleId = t.id {likeWhere}
LEFT JOIN rb_member_user e on e.Id = t.CreateBy
LEFT JOIN rb_education_talk as talk on talk.id=t.tid and talk.`Status`= 0
@@ -307,6 +314,7 @@ LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId)
stringwhere=" and a.`Status`=0 ";
stringlikeWhere="";
stringfollowWhere="";
stringtalkWhere="";
if(model!=null)
{
if(model.TenantId>0)
...
...
@@ -321,7 +329,7 @@ LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId)
{
where+=$@" and a.Id = {model.Id} ";
}
if(model.CreateBy>0)
{
where+=$@" and a.CreateBy = {model.CreateBy} ";
...
...
@@ -331,21 +339,78 @@ LEFT JOIN rb_member_user as mu on mu.Id=edc.UserId)
likeWhere+=$@" and l.UserId = {model.UserId} ";
followWhere+=$@" and (b.UserId = {model.UserId} and b.`Status`=0 or a.CreateBy = {model.UserId} ) ";
}
if(model.TalkId>0)
{
talkWhere=$"and talk.Id = {model.TalkId} ";
}
}
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,e.`Name` as CreateByName,e.Photo as CrearteByPhoto
from (SELECT 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` from
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,talk.Id as TalkId,talk.Content as TalkContent,e.`Name` as CreateByName,e.Photo as CrearteByPhoto
from (SELECT 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 where a.IsOpen=1 {where}
union all SELECT 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` from
union all SELECT 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_MiAi_FollowMember as b on a.CreateBy=b.UserId where a.IsOpen=2 {where}{followWhere} ) as t
LEFT JOIN rb_education_dynamiclike l on l.ArticleId = t.id {likeWhere}
LEFT JOIN rb_member_user e on e.Id = t.CreateBy
LEFT JOIN rb_education_talk as talk on talk.id=t.tid and talk.`Status`= 0 where 1=1 {talkWhere}
where+=$@" and a.MallBaseId = {model.MallBaseId} ";
}
if(model.Id>0)
{
where+=$@" and a.Id = {model.Id} ";
}
if(model.IsOpen>0)
{
where+=$@" and a.IsOpen = {model.IsOpen} ";
}
if(model.UserTeacher>0)
{
where+=$@" and a.UserTeacher = {model.UserTeacher} ";
}
//if (model.CreateBy > 0)
//{
// where += $@" and a.CreateBy = {model.CreateBy} ";
//}
if(model.UserId>0)
{
// where += $@" and a.CreateBy = {model.CreateBy} ";
likeWhere+=$@" and l.UserId = {model.UserId} ";
}
}
stringsql=$@"SELECT t.*,if(l.Id>0,1,0) as HasLike,talk.Id as TalkId,talk.Content as TalkContent,e.`Name` as CreateByName,e.Photo as CrearteByPhoto
from (SELECT 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 {where} ) as t
LEFT JOIN rb_education_dynamiclike l on l.ArticleId = t.id {likeWhere}
LEFT JOIN rb_member_user e on e.Id = t.CreateBy
LEFT JOIN rb_education_talk as talk on talk.id=t.tid and talk.`Status`= 0