社区升级
1、表字段统一小写, 2、表模块划分 3、表状态等字段统一smallint 4、部分字段值重新定义
This commit is contained in:
@@ -2,7 +2,7 @@ package com.lxyer.bbs.servlet;
|
||||
|
||||
import com.jfinal.kit.Kv;
|
||||
import com.lxyer.bbs.base.BaseServlet;
|
||||
import com.lxyer.bbs.base.user.User;
|
||||
import com.lxyer.bbs.base.user.UserRecord;
|
||||
import com.lxyer.bbs.comment.CommentInfo;
|
||||
import com.lxyer.bbs.content.ContentInfo;
|
||||
import org.redkale.net.http.*;
|
||||
@@ -28,8 +28,8 @@ public class ContentServlet extends BaseServlet {
|
||||
int curr = request.getIntParameter("curr", 1);
|
||||
|
||||
//分页帖子列表
|
||||
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createTime DESC");
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived, currentId);
|
||||
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createtime DESC");
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived, currentid);
|
||||
|
||||
Kv kv = Kv.by("contents", contents).set("url", request.getRequestURI())
|
||||
.set("actived", actived).set("curr", curr);
|
||||
@@ -61,15 +61,15 @@ public class ContentServlet extends BaseServlet {
|
||||
//Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId);
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentid);
|
||||
|
||||
//更新
|
||||
CompletableFuture.supplyAsync(new Supplier<String>() {
|
||||
@Override
|
||||
public String get() {
|
||||
User user = request.currentUser();
|
||||
if (user == null || user.getUserId() > 10_0003)
|
||||
UserRecord user = request.currentUser();
|
||||
if (user == null || user.getUserid() > 10_0003)
|
||||
contentService.incrViewNum(contentid);
|
||||
return "";
|
||||
}
|
||||
@@ -88,17 +88,17 @@ public class ContentServlet extends BaseServlet {
|
||||
|
||||
Kv column = Kv.by("qz", 10).set("fx", 20).set("jy", 30).set("gg", 40).set("dt", 50);//栏目
|
||||
|
||||
Flipper flipper = new Flipper().offset((curr-1) * 20).limit(20).sort("top DESC,createTime DESC");
|
||||
Flipper flipper = new Flipper().offset((curr-1) * 20).limit(20).sort("top DESC,createtime DESC");
|
||||
//帖子列表
|
||||
FilterNode filterNode = FilterNode.create("status", NOTEQUAL, -1).and("type", column.getAs(para));
|
||||
if (solved > -1) filterNode.and("solved", solved);
|
||||
if (wonderful > -1) filterNode.and("wonderful", wonderful);
|
||||
if (solved > 0) filterNode.and("solved", 20);
|
||||
if (wonderful > 0) filterNode.and("wonderful", 20);
|
||||
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(filterNode));
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId);
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentid);
|
||||
|
||||
|
||||
Kv kv = Kv.by("contents", contents).set("hotReply", hotReply)
|
||||
|
@@ -13,6 +13,7 @@ import org.redkale.source.Flipper;
|
||||
import org.redkale.util.Sheet;
|
||||
|
||||
import static org.redkale.source.FilterExpress.GREATERTHAN;
|
||||
import static org.redkale.source.FilterExpress.GREATERTHANOREQUALTO;
|
||||
import static org.redkale.source.FilterExpress.NOTEQUAL;
|
||||
|
||||
|
||||
@@ -26,13 +27,13 @@ public class IndexServlet extends BaseServlet {
|
||||
|
||||
@HttpMapping(url = "/", auth = false, comment = "社区首页")
|
||||
public void abc(HttpRequest request, HttpResponse response){
|
||||
Flipper flipper = new Flipper().limit(30).sort("top DESC,createTime DESC");
|
||||
Flipper flipper = new Flipper().limit(30).sort("top DESC,createtime DESC");
|
||||
//置顶贴
|
||||
FilterNode topNode = FilterNode.create("status", NOTEQUAL, -1).and("top", GREATERTHAN, 0);
|
||||
FilterNode topNode = FilterNode.create("status", NOTEQUAL, -10).and("top", GREATERTHANOREQUALTO, 20);
|
||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, setPrivate(topNode));
|
||||
|
||||
//非置顶贴
|
||||
FilterNode untopNode = FilterNode.create("status", NOTEQUAL, -1).and("top", 0);
|
||||
FilterNode untopNode = FilterNode.create("status", NOTEQUAL, -10).and("top", 10);
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(untopNode));
|
||||
|
||||
//热帖
|
||||
@@ -40,8 +41,8 @@ public class IndexServlet extends BaseServlet {
|
||||
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId);
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentid);
|
||||
|
||||
//最新加入
|
||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||
|
@@ -2,7 +2,7 @@ package com.lxyer.bbs.servlet;
|
||||
|
||||
import com.jfinal.kit.Kv;
|
||||
import com.lxyer.bbs.base.BaseServlet;
|
||||
import com.lxyer.bbs.base.user.User;
|
||||
import com.lxyer.bbs.base.user.UserRecord;
|
||||
import com.lxyer.bbs.base.user.UserBean;
|
||||
import com.lxyer.bbs.base.user.UserInfo;
|
||||
import com.lxyer.bbs.comment.CommentInfo;
|
||||
@@ -58,9 +58,9 @@ public class UserServlet extends BaseServlet {
|
||||
}
|
||||
|
||||
//创建的帖子
|
||||
Flipper flipper = new Flipper().limit(8).sort("createTime DESC");
|
||||
Flipper flipper = new Flipper().limit(8).sort("createtime DESC");
|
||||
ContentBean bean = new ContentBean();
|
||||
bean.setUserId(user.getUserId());
|
||||
bean.setUserid(user.getUserid());
|
||||
Sheet<ContentInfo> contents = contentService.queryByBean(flipper, bean);
|
||||
|
||||
//收藏的帖子
|
||||
@@ -72,30 +72,30 @@ public class UserServlet extends BaseServlet {
|
||||
}
|
||||
|
||||
//-------用户主页------
|
||||
int userId = 0;
|
||||
int userid = 0;
|
||||
if ("nick".equals(para)){//通过@ 点击跳转
|
||||
String nickname = request.getParameter("nickname");
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setNickname(nickname);
|
||||
Sheet<User> users = userService.queryUser(new Flipper().limit(1), userBean);
|
||||
Sheet<UserRecord> users = userService.queryUser(new Flipper().limit(1), userBean);
|
||||
if (users.getTotal() > 0){
|
||||
userId = users.stream().findFirst().orElse(null).getUserId();
|
||||
userid = users.stream().findFirst().orElse(null).getUserid();
|
||||
}
|
||||
}else {//直接访问
|
||||
userId = getParaToInt(0);
|
||||
userid = getParaToInt(0);
|
||||
}
|
||||
|
||||
//用户信息
|
||||
UserInfo user = userService.findUserInfo(userId);
|
||||
UserInfo user = userService.findUserInfo(userid);
|
||||
|
||||
//帖子
|
||||
Flipper flipper = new Flipper().limit(8).sort("createTime DESC");
|
||||
Flipper flipper = new Flipper().limit(8).sort("createtime DESC");
|
||||
ContentBean bean = new ContentBean();
|
||||
bean.setUserId(userId);
|
||||
bean.setUserid(userid);
|
||||
Sheet<ContentInfo> contents = contentService.queryByBean(flipper, bean);
|
||||
|
||||
//回复
|
||||
Sheet<CommentInfo> comments = commentService.queryByUserid(userId);
|
||||
Sheet<CommentInfo> comments = commentService.queryByUserid(userid);
|
||||
|
||||
Kv kv = Kv.by("contents", contents).set("user", user).set("comments", comments);
|
||||
finish("/user/home.html", kv);
|
||||
|
Reference in New Issue
Block a user