where+=$@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.ParentId)} =0";
}
stringsql=$@"select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName,b.Sex,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
stringsql=$@"select d.*,u.Name as CreateByUserName,u.Photo,u1.Name as ReplyUserName,b.Sex,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
left join rb_miai_baseinfo b on d.UserId =b.UserId
...
...
@@ -120,7 +120,7 @@ where {where} order by d.Id desc";
if(count==1)
{
//只有一条数据
sql=$@"select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
sql=$@"select d.*,u.Name as CreateByUserName,u.Photo,u1.Name as ReplyUserName,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
LEFT JOIN (SELECT ActivityDiscussId,COUNT(*) DianZanNum from rb_miai_dianzan where `Status`=0 and ActivityId>0 and ActivityDiscussId>0 GROUP BY ActivityDiscussId) as dz on dz.ActivityDiscussId=d.Id
...
...
@@ -133,7 +133,7 @@ where d.Status =0 and d.ParentId ={pidsList.FirstOrDefault()} order by d.Id desc
if(i==count-1)
{
//最后一条
sql+=$@"(select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
sql+=$@"(select d.*,u.Name as CreateByUserName,u.Photo,u1.Name as ReplyUserName,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
LEFT JOIN (SELECT ActivityDiscussId,COUNT(*) DianZanNum from rb_miai_dianzan where `Status`=0 and ActivityId>0 and ActivityDiscussId>0 GROUP BY ActivityDiscussId) as dz on dz.ActivityDiscussId=d.Id
...
...
@@ -141,7 +141,7 @@ where d.Status =0 and d.ParentId ={pidsList[i]} order by d.Id desc limit {number
}
else
{
sql+=$@"(select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
sql+=$@"(select d.*,u.Name as CreateByUserName,u.Photo,u1.Name as ReplyUserName,IFNULL(dz.DianZanNum,0) as DianZanNum from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
LEFT JOIN (SELECT ActivityDiscussId,COUNT(*) DianZanNum from rb_miai_dianzan where `Status`=0 and ActivityId>0 and ActivityDiscussId>0 GROUP BY ActivityDiscussId) as dz on dz.ActivityDiscussId=d.Id