社区升级
1、表字段统一小写, 2、表模块划分 3、表状态等字段统一smallint 4、部分字段值重新定义
This commit is contained in:
@@ -1,27 +1,29 @@
|
||||
package com.lxyer.bbs.content;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import com.jfinal.kit.Kv;
|
||||
import com.lxyer.bbs.base.UF;
|
||||
import com.lxyer.bbs.base.kit.LxyKit;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.convert.json.*;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lxyer
|
||||
*/
|
||||
@Cacheable(interval = 5*60)
|
||||
@Table(catalog = "redbbs", name = "content", comment = "[内容表]")
|
||||
public class Content implements UF<ContentInfo>,java.io.Serializable {
|
||||
@Table(catalog = "redbbs", name = "sys_content", comment = "[内容表]")
|
||||
public class Content implements Serializable, UF<ContentInfo> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(comment = "[内容id]")
|
||||
private int contentId;
|
||||
private int contentid;
|
||||
|
||||
@Column(comment = "[用户id]")
|
||||
private int userId;
|
||||
private int userid;
|
||||
|
||||
@Column(length = 64, comment = "[标题]")
|
||||
private String title = "";
|
||||
@@ -32,47 +34,47 @@ public class Content implements UF<ContentInfo>,java.io.Serializable {
|
||||
@Column(comment = "[内容]")
|
||||
private String content = "";
|
||||
|
||||
@Column(comment = "[创建时间]")
|
||||
private long createTime;
|
||||
@Column(updatable = false, comment = "[创建时间]")
|
||||
private long createtime;
|
||||
|
||||
@Column(comment = "[类别]")
|
||||
private int cate;
|
||||
private short cate;
|
||||
|
||||
@Column(comment = "[内容类型]1新闻,2作品")
|
||||
private int type;
|
||||
@Column(comment = "[内容栏目]10求助,20分享,30建议,40公告,50动态")
|
||||
private short type;
|
||||
|
||||
@Column(comment = "[评论数]")
|
||||
private int replyNum;
|
||||
private int replynum;
|
||||
|
||||
@Column(comment = "[阅读量]")
|
||||
private int viewNum;
|
||||
private int viewnum;
|
||||
|
||||
@Column(comment = "[精] 0否,1是")
|
||||
private int wonderful;
|
||||
@Column(comment = "[精] 10否,20是")
|
||||
private short wonderful = 10;
|
||||
|
||||
@Column(comment = "[置顶] 0否,1是")
|
||||
private int top;
|
||||
@Column(comment = "[置顶]10否,20是")
|
||||
private short top = 10;
|
||||
|
||||
@Column(comment = "[结帖]大于0结帖")
|
||||
private int solved;
|
||||
@Column(comment = "[结帖]10否,20是")
|
||||
private short solved = 10;
|
||||
|
||||
@Column(comment = "[状态]")
|
||||
private int status = 1;
|
||||
@Column(comment = "[状态] -10删除 10未结帖 20结帖 30私密")
|
||||
private short status = 10;
|
||||
|
||||
public void setContentId(int contentId) {
|
||||
this.contentId = contentId;
|
||||
public void setContentid(int contentid) {
|
||||
this.contentid = contentid;
|
||||
}
|
||||
|
||||
public int getContentId() {
|
||||
return this.contentId;
|
||||
public int getContentid() {
|
||||
return this.contentid;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
public void setUserid(int userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return this.userId;
|
||||
public int getUserid() {
|
||||
return this.userid;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
@@ -91,84 +93,83 @@ public class Content implements UF<ContentInfo>,java.io.Serializable {
|
||||
return this.digest;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return this.createTime;
|
||||
public void setCreatetime(long createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
public int getCate() {
|
||||
return cate;
|
||||
public long getCreatetime() {
|
||||
return this.createtime;
|
||||
}
|
||||
|
||||
public void setCate(int cate) {
|
||||
public void setCate(short cate) {
|
||||
this.cate = cate;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
public short getCate() {
|
||||
return this.cate;
|
||||
}
|
||||
|
||||
public void setType(short type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
public short getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
|
||||
public int getReplyNum() {
|
||||
return replyNum;
|
||||
public void setReplynum(int replynum) {
|
||||
this.replynum = replynum;
|
||||
}
|
||||
|
||||
public void setReplyNum(int replyNum) {
|
||||
this.replyNum = replyNum;
|
||||
public int getReplynum() {
|
||||
return this.replynum;
|
||||
}
|
||||
|
||||
public int getViewNum() {
|
||||
return viewNum;
|
||||
public void setViewnum(int viewnum) {
|
||||
this.viewnum = viewnum;
|
||||
}
|
||||
|
||||
public void setViewNum(int viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
public int getViewnum() {
|
||||
return this.viewnum;
|
||||
}
|
||||
|
||||
public int getWonderful() {
|
||||
return wonderful;
|
||||
}
|
||||
|
||||
public void setWonderful(int wonderful) {
|
||||
public void setWonderful(short wonderful) {
|
||||
this.wonderful = wonderful;
|
||||
}
|
||||
|
||||
public int getTop() {
|
||||
return top;
|
||||
public short getWonderful() {
|
||||
return this.wonderful;
|
||||
}
|
||||
|
||||
public void setTop(int top) {
|
||||
public void setTop(short top) {
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public int getSolved() {
|
||||
return solved;
|
||||
public short getTop() {
|
||||
return this.top;
|
||||
}
|
||||
|
||||
public void setSolved(int solved) {
|
||||
public void setSolved(short solved) {
|
||||
this.solved = solved;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
public short getSolved() {
|
||||
return this.solved;
|
||||
}
|
||||
|
||||
public void setStatus(short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
public short getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
@@ -182,21 +183,21 @@ public class Content implements UF<ContentInfo>,java.io.Serializable {
|
||||
@Override
|
||||
public ContentInfo createInfo() {
|
||||
ContentInfo info = new ContentInfo();
|
||||
info.setContentId(contentId);
|
||||
info.setUserId(userId);
|
||||
info.setContentid(contentid);
|
||||
info.setUserid(userid);
|
||||
info.setTitle(title);
|
||||
info.setContent(content);
|
||||
info.setCate(cate);
|
||||
info.setType(type);
|
||||
info.setViewNum(viewNum);
|
||||
info.setReplyNum(replyNum);
|
||||
info.setViewnum(viewnum);
|
||||
info.setReplynum(replynum);
|
||||
info.setWonderful(wonderful);
|
||||
info.setTop(top);
|
||||
info.setSolved(solved);
|
||||
info.setStatus(status);
|
||||
|
||||
info.setTypeName(types.getOrDefault(type, "其他").toString());
|
||||
info.setCreateTime(LxyKit.dateFmt(createTime));
|
||||
info.setTypename(types.getOrDefault((int)type, "其他").toString());
|
||||
info.setCreatetime(LxyKit.dateFmt(createtime));
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
@@ -18,10 +18,10 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(comment = "[内容id]")
|
||||
private int contentId;
|
||||
private int contentid;
|
||||
|
||||
@Column(comment = "[用户id]")
|
||||
private int userId;
|
||||
private int userid;
|
||||
|
||||
@Column(length = 64, comment = "[标题]")
|
||||
private String title = "";
|
||||
@@ -33,7 +33,7 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
private String content = "";
|
||||
|
||||
@Column(comment = "[创建时间]")
|
||||
private long createTime;
|
||||
private long createtime;
|
||||
|
||||
@Column(comment = "[类别]")
|
||||
private int cate;
|
||||
@@ -42,10 +42,10 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
private int type;
|
||||
|
||||
@Column(comment = "[评论数]")
|
||||
private int replyNum;
|
||||
private int replynum;
|
||||
|
||||
@Column(comment = "[阅读量]")
|
||||
private int viewNum;
|
||||
private int viewnum;
|
||||
|
||||
/* @Column(comment = "[精] 0否,1是")
|
||||
private int wonderful;
|
||||
@@ -59,20 +59,20 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
@Column(comment = "[状态]")
|
||||
private int status = 1;*/
|
||||
|
||||
public void setContentId(int contentId) {
|
||||
this.contentId = contentId;
|
||||
public void setContentid(int contentid) {
|
||||
this.contentid = contentid;
|
||||
}
|
||||
|
||||
public int getContentId() {
|
||||
return this.contentId;
|
||||
public int getContentid() {
|
||||
return this.contentid;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
public void setUserid(int userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return this.userId;
|
||||
public int getUserid() {
|
||||
return this.userid;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
@@ -99,12 +99,12 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
public void setCreatetime(long createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return this.createTime;
|
||||
public long getCreatetime() {
|
||||
return this.createtime;
|
||||
}
|
||||
|
||||
public int getCate() {
|
||||
@@ -123,20 +123,20 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public int getReplyNum() {
|
||||
return replyNum;
|
||||
public int getReplynum() {
|
||||
return replynum;
|
||||
}
|
||||
|
||||
public void setReplyNum(int replyNum) {
|
||||
this.replyNum = replyNum;
|
||||
public void setReplynum(int replynum) {
|
||||
this.replynum = replynum;
|
||||
}
|
||||
|
||||
public int getViewNum() {
|
||||
return viewNum;
|
||||
public int getViewnum() {
|
||||
return viewnum;
|
||||
}
|
||||
|
||||
public void setViewNum(int viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
public void setViewnum(int viewnum) {
|
||||
this.viewnum = viewnum;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.lxyer.bbs.content;
|
||||
|
||||
import com.lxyer.bbs.base.UI;
|
||||
import com.lxyer.bbs.base.user.User;
|
||||
import com.lxyer.bbs.base.user.UserRecord;
|
||||
import org.redkale.convert.ConvertColumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -11,38 +11,38 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class ContentInfo implements UI<ContentInfo>,Serializable {
|
||||
|
||||
private int contentId;
|
||||
private int userId;
|
||||
private int contentid;
|
||||
private int userid;
|
||||
private String title = "";
|
||||
private String digest = "";
|
||||
private String content = "";
|
||||
private String createTime;
|
||||
private String createtime;
|
||||
private int cate;
|
||||
private int type;
|
||||
private int replyNum;
|
||||
private int viewNum;
|
||||
private int replynum;
|
||||
private int viewnum;
|
||||
private int wonderful;
|
||||
private int top;
|
||||
private int solved;
|
||||
private int status = 1;
|
||||
private int status = 10;
|
||||
|
||||
private String typeName;
|
||||
private int hadCollect = -1;
|
||||
private String typename;
|
||||
private int hadcollect = -1;
|
||||
|
||||
public int getContentId() {
|
||||
return contentId;
|
||||
public int getContentid() {
|
||||
return contentid;
|
||||
}
|
||||
|
||||
public void setContentId(int contentId) {
|
||||
this.contentId = contentId;
|
||||
public void setContentid(int contentid) {
|
||||
this.contentid = contentid;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
public int getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
public void setUserid(int userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
@@ -85,20 +85,20 @@ public class ContentInfo implements UI<ContentInfo>,Serializable {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getReplyNum() {
|
||||
return replyNum;
|
||||
public int getReplynum() {
|
||||
return replynum;
|
||||
}
|
||||
|
||||
public void setReplyNum(int replyNum) {
|
||||
this.replyNum = replyNum;
|
||||
public void setReplynum(int replynum) {
|
||||
this.replynum = replynum;
|
||||
}
|
||||
|
||||
public int getViewNum() {
|
||||
return viewNum;
|
||||
public int getViewnum() {
|
||||
return viewnum;
|
||||
}
|
||||
|
||||
public void setViewNum(int viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
public void setViewnum(int viewnum) {
|
||||
this.viewnum = viewnum;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
@@ -133,41 +133,41 @@ public class ContentInfo implements UI<ContentInfo>,Serializable {
|
||||
this.solved = solved;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
public String getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
public void setCreatetime(String createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
public String getTypename() {
|
||||
return typename;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
public void setTypename(String typename) {
|
||||
this.typename = typename;
|
||||
}
|
||||
|
||||
public int getHadCollect() {
|
||||
return hadCollect;
|
||||
public int getHadcollect() {
|
||||
return hadcollect;
|
||||
}
|
||||
|
||||
public void setHadCollect(int hadCollect) {
|
||||
this.hadCollect = hadCollect;
|
||||
public void setHadcollect(int hadcollect) {
|
||||
this.hadcollect = hadcollect;
|
||||
}
|
||||
|
||||
|
||||
//-----------
|
||||
private User user;
|
||||
private UserRecord user;
|
||||
@ConvertColumn(ignore = true)
|
||||
@Override
|
||||
public User getUser() {
|
||||
public UserRecord getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContentInfo setUser(User user) {
|
||||
public ContentInfo setUser(UserRecord user) {
|
||||
this.user = user;
|
||||
return this;
|
||||
}
|
||||
|
@@ -39,20 +39,20 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
}
|
||||
|
||||
@RestMapping(name = "query", auth = false, comment = "内容列表")
|
||||
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived, int currentId){
|
||||
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived, int currentid){
|
||||
FilterNode filterNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1);
|
||||
switch (actived){
|
||||
case "top": filterNode.and("top", 1);break;
|
||||
case "untop": filterNode.and("top", 0);break;
|
||||
case "unsolved": filterNode.and("solved", 0);break;
|
||||
case "solved": filterNode.and("solved", 1);break;
|
||||
case "wonderful": filterNode.and("wonderful", 1);break;
|
||||
case "top": filterNode.and("top", FilterExpress.GREATERTHANOREQUALTO, 20);break;
|
||||
case "untop": filterNode.and("top", 10);break;
|
||||
case "unsolved": filterNode.and("solved", 10);break;
|
||||
case "solved": filterNode.and("solved", 20);break;
|
||||
case "wonderful": filterNode.and("wonderful", FilterExpress.GREATERTHANOREQUALTO, 20);break;
|
||||
}
|
||||
|
||||
if (!userService.isAdmin(currentId)){//私密贴:非管理员限制查看
|
||||
filterNode.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 3).or(FilterNode.create("status", 3).and("userId", currentId)));
|
||||
}else if (currentId <= 0){//私密贴:未登录限制查看
|
||||
filterNode.and("status", FilterExpress.NOTEQUAL, 3);
|
||||
if (!userService.isAdmin(currentid)){//私密贴:非管理员限制查看
|
||||
filterNode.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 30).or(FilterNode.create("status", 30).and("userid", currentid)));
|
||||
}else if (currentid <= 0){//私密贴:未登录限制查看
|
||||
filterNode.and("status", FilterExpress.NOTEQUAL, 30);
|
||||
}
|
||||
|
||||
return contentQuery(flipper, filterNode);
|
||||
@@ -74,13 +74,13 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
return RetCodes.retResult(-1, "少年你的文章标题太长啦,精简化标题吧,为了更好的SEO长度请少于64个字节");
|
||||
}
|
||||
|
||||
if (content.getContentId() < 1){
|
||||
int maxId = source.getNumberResult(Content.class, FilterFunc.MAX, 10_0000, "contentId").intValue();
|
||||
if (content.getContentid() < 1){
|
||||
int maxId = source.getNumberResult(Content.class, FilterFunc.MAX, 10_0000, "contentid").intValue();
|
||||
int userId = userService.currentUserId(sessionid);
|
||||
|
||||
content.setContentId(maxId+1);
|
||||
content.setCreateTime(System.currentTimeMillis());
|
||||
content.setUserId(userId);
|
||||
content.setContentid(maxId+1);
|
||||
content.setCreatetime(System.currentTimeMillis());
|
||||
content.setUserid(userId);
|
||||
|
||||
source.insert(content);
|
||||
}else {
|
||||
@@ -101,29 +101,29 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
|
||||
//收藏状态
|
||||
if (userId > 0){
|
||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("cate", 2).and("tid", contentid).and("status", 1));
|
||||
if (actLog != null) contentInfo.setHadCollect(1);
|
||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("cate", 20).and("tid", contentid).and("status", 10));
|
||||
if (actLog != null) contentInfo.setHadcollect(1);
|
||||
}
|
||||
return contentInfo;
|
||||
}
|
||||
|
||||
@RestMapping(name = "upview", comment = "增加文章1个访问量")
|
||||
public void incrViewNum(int contentId){
|
||||
source.updateColumn(Content.class, contentId, ColumnValue.inc("viewNum", 1));
|
||||
source.updateColumn(Content.class, contentId, ColumnValue.inc("viewnum", 1));
|
||||
}
|
||||
|
||||
@RestMapping(name = "collect", comment = "内容收藏")
|
||||
public RetResult collect(@RestSessionid String sessionid, int contentId, int ok){
|
||||
int userId = userService.currentUserId(sessionid);//不会为空
|
||||
public RetResult collect(@RestSessionid String sessionid, int contentid, int ok){
|
||||
int userid = userService.currentUserId(sessionid);//不会为空
|
||||
|
||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("userId", userId).and("tid", contentId).and("cate", 2));
|
||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("userid", userid).and("tid", contentid).and("cate", 20));
|
||||
if (actLog == null && ok == 1){
|
||||
actLog = new ActLog().cate(2).tid(contentId).userId(userId);
|
||||
actLog.setCreateTime(System.currentTimeMillis());
|
||||
actLog = new ActLog(20, contentid, userid);//.cate(2).tid(contentId).userId(userId);
|
||||
actLog.setCreatetime(System.currentTimeMillis());
|
||||
source.insert(actLog);
|
||||
}else if (actLog != null && actLog.getStatus() != ok){
|
||||
actLog.setStatus(ok);
|
||||
actLog.setCreateTime(System.currentTimeMillis());
|
||||
actLog.setStatus((short) ok);
|
||||
actLog.setCreatetime(System.currentTimeMillis());
|
||||
source.update(actLog);
|
||||
}else {
|
||||
return RetCodes.retResult(-1, ok == 1 ? "已收藏" : "已取消收藏");
|
||||
@@ -134,14 +134,14 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
|
||||
@RestMapping(name = "collectquery", comment = "收藏列表")
|
||||
public Sheet<ContentInfo> collectQuery(@RestSessionid String sessionid){
|
||||
int userId = userService.currentUserId(sessionid);
|
||||
int userid = userService.currentUserId(sessionid);
|
||||
|
||||
Flipper flipper = new Flipper().sort("createTime DESC");
|
||||
FilterNode filterNode = FilterNode.create("cate", 2).and("status", 1).and("userId", userId);
|
||||
Sheet<ActLog> actLogs = source.querySheet(ActLog.class, SelectColumn.createIncludes("tid", "createTime"), flipper, filterNode);
|
||||
Flipper flipper = new Flipper().sort("createtime DESC");
|
||||
FilterNode filterNode = FilterNode.create("cate", 20).and("status", 10).and("userid", userid);
|
||||
Sheet<ActLog> actLogs = source.querySheet(ActLog.class, SelectColumn.createIncludes("tid", "createtime"), flipper, filterNode);
|
||||
|
||||
int[] contentids = actLogs.stream().mapToInt(x -> x.getTid()).toArray();
|
||||
Sheet<Content> contents = source.querySheet(Content.class, SelectColumn.createIncludes("contentId", "title"), flipper.sort(null), FilterNode.create("contentId", FilterExpress.IN, contentids));
|
||||
Sheet<Content> contents = source.querySheet(Content.class, SelectColumn.createIncludes("contentid", "title"), flipper.sort(null), FilterNode.create("contentid", FilterExpress.IN, contentids));
|
||||
|
||||
Sheet<ContentInfo> infos = createInfo(contents);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
}
|
||||
|
||||
@RestMapping(name = "set", comment = "内容操作")
|
||||
public RetResult contentSet(int id, String field, int v){
|
||||
public RetResult contentSet(int id, String field, short v){
|
||||
source.updateColumn(Content.class, id, field, v);
|
||||
return RetResult.success();
|
||||
}
|
||||
@@ -157,13 +157,13 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
@RestMapping(name = "t",auth = false, comment = "测试HttpScope 模板使用")
|
||||
public HttpScope t(){
|
||||
ContentService contentService = this;
|
||||
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", FilterExpress.NOTEQUAL, -1).and("top", FilterExpress.GREATERTHAN, 0);
|
||||
FilterNode topNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -10).and("top", FilterExpress.GREATERTHANOREQUALTO, 20);
|
||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, topNode);
|
||||
|
||||
//非置顶贴
|
||||
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", 0);
|
||||
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -10).and("top", 0);
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, untopNode);
|
||||
|
||||
//热帖
|
||||
@@ -171,13 +171,16 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
||||
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", 0);
|
||||
|
||||
//最新加入
|
||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||
|
||||
Kv kv = Kv.by("top", top).set("contents", contents).set("hotReply", hotReply).set("lastReg", lastReg);
|
||||
Kv kv = Kv.by("top", top)
|
||||
.set("contents", contents)
|
||||
.set("hotReply", hotReply)
|
||||
.set("lastReg", lastReg);
|
||||
|
||||
return HttpScope.refer("index.html").attr(kv);
|
||||
}
|
||||
|
Reference in New Issue
Block a user