评论优化
This commit is contained in:
@@ -68,13 +68,14 @@
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- 阿里系的Druid依赖包 -->
|
||||
|
||||
<!-- 阿里系的Druid依赖包 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
package com.yaoyuan.jiscuss.common;
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* @author yaoyuan2.chu
|
||||
* @Title:
|
||||
* @Package com.yaoyuan.jiscuss.common
|
||||
* @Description:
|
||||
* @date 2020/8/17 14:51
|
||||
*/
|
||||
@Data
|
||||
public class Node {
|
||||
|
||||
public Node() {
|
||||
|
||||
}
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer discussionId;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private Date time;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String content;
|
||||
|
||||
private Integer parentId;
|
||||
|
||||
private Date editTime;
|
||||
|
||||
private Integer editUserId;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private String copyright;
|
||||
|
||||
private Integer isApproved;
|
||||
|
||||
private Integer createId;
|
||||
|
||||
private Date createTime;
|
||||
//下一条回复
|
||||
private List<Node> nextNodes = new ArrayList<Node>();
|
||||
|
||||
|
||||
/**
|
||||
* 将单个node添加到链表中
|
||||
*
|
||||
* @param list
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
public static boolean addNode(List<Node> list, Node node) {
|
||||
for (Node node1 : list) { //循环添加
|
||||
if (node1.getId() .equals(node.getParentId()) ) { //判断留言的上一段是都是这条留言
|
||||
node1.getNextNodes().add(node); //是,添加,返回true;
|
||||
System.out.println("添加了一个");
|
||||
return true;
|
||||
} else { //否则递归继续判断
|
||||
if (node1.getNextNodes().size() != 0) {
|
||||
if (Node.addNode(node1.getNextNodes(), node)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将查出来的lastId不为null的回复都添加到第一层Node集合中
|
||||
*
|
||||
* @param firstList
|
||||
* @param thenList
|
||||
* @return
|
||||
*/
|
||||
public static List addAllNode(List<Node> firstList, List<Posts> thenList) {
|
||||
while (thenList.size() != 0) {
|
||||
int size = thenList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Node node = new Node();
|
||||
BeanUtils.copyProperties(thenList.get(i), node);
|
||||
if (Node.addNode(firstList, node)) {
|
||||
thenList.remove(i);
|
||||
i--;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return firstList;
|
||||
}
|
||||
|
||||
//打印
|
||||
public static void show(List<Node> list) {
|
||||
for (Node node : list) {
|
||||
System.out.println(node.getUserId() + " 用户回复了你:" + node.getContent());
|
||||
if (node.getNextNodes().size() != 0) {
|
||||
Node.show(node.getNextNodes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -43,7 +43,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
|
||||
"/js/**",
|
||||
"/images/**",
|
||||
"/static/**",
|
||||
"/h2-console/**"
|
||||
"/h2-console/**",
|
||||
"/druid/**"
|
||||
);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.yaoyuan.jiscuss.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.yaoyuan.jiscuss.common.Node;
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import com.yaoyuan.jiscuss.entity.UserInfo;
|
||||
import com.yaoyuan.jiscuss.entity.*;
|
||||
import com.yaoyuan.jiscuss.entity.custom.DiscussionCustom;
|
||||
import com.yaoyuan.jiscuss.entity.custom.PostCustom;
|
||||
import com.yaoyuan.jiscuss.service.IPostsService;
|
||||
import com.yaoyuan.jiscuss.service.IUsersService;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -26,8 +24,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Discussions;
|
||||
import com.yaoyuan.jiscuss.entity.Tags;
|
||||
import com.yaoyuan.jiscuss.service.IDiscussionsService;
|
||||
import com.yaoyuan.jiscuss.service.ITagsService;
|
||||
|
||||
@@ -48,7 +44,11 @@ public class UserPostController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IPostsService postsService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IUsersService usersService;
|
||||
|
||||
|
||||
//首页查看主题列表(各种条件筛选,最热最新标签等)
|
||||
|
||||
|
||||
@@ -58,34 +58,34 @@ public class UserPostController extends BaseController {
|
||||
public String getDiscussionsById(HttpServletRequest request, ModelMap map, @RequestParam("id") Integer id) {
|
||||
logger.info(">>> getDiscussionsById{}",id);
|
||||
|
||||
Discussions discussions = discussionsService.findOne(id);
|
||||
Discussion discussion = discussionsService.findOne(id);
|
||||
// 获取此主题下的评论
|
||||
List<Post> posts = postsService.findOneBy(id);
|
||||
|
||||
List<Posts> posts = postsService.findOneBy(id);
|
||||
|
||||
List<Tags> tags = tagsService.findByDId(id);
|
||||
|
||||
//查询id为1且parentId为null的评论
|
||||
List<Posts> firstList = postsService.findAllByDIdAndparentIdNull(1);
|
||||
//查询id为1且parentId不为null的评论
|
||||
List<Posts> thenList = postsService.findAllByDIdAndparentIdNotNull(1);
|
||||
//新建一个Node集合。
|
||||
ArrayList<Node> nodes = new ArrayList<>();
|
||||
//将第一层评论都添加都Node集合中
|
||||
for (Posts post : firstList) {
|
||||
Node node = new Node();
|
||||
BeanUtils.copyProperties(post, node);
|
||||
nodes.add(node);
|
||||
DiscussionCustom newdd = new DiscussionCustom();
|
||||
BeanUtils.copyProperties(discussion , newdd);
|
||||
if (null != newdd.getStartUserId()){
|
||||
User startUser = usersService.findOne(newdd.getStartUserId());
|
||||
newdd.setAvatar(startUser.getAvatar());
|
||||
newdd.setRealname(startUser.getRealname());
|
||||
newdd.setUsername(startUser.getUsername());
|
||||
}
|
||||
if (null != newdd.getLastUserId()){
|
||||
User lastUser = usersService.findOne(newdd.getLastUserId());
|
||||
newdd.setAvatarLast(lastUser.getAvatar());
|
||||
newdd.setRealnameLast(lastUser.getRealname());
|
||||
newdd.setUsernameLast(lastUser.getUsername());
|
||||
}
|
||||
//将回复添加到对应的位置
|
||||
List list = Node.addAllNode(nodes, thenList);
|
||||
System.out.println();
|
||||
//打印回复链表
|
||||
Node.show(list);
|
||||
|
||||
|
||||
List<Tag> tags = tagsService.findByDId(id);
|
||||
|
||||
map.put("discussions", discussions);
|
||||
map.put("posts", posts);
|
||||
List<PostCustom> postsObj = postsService.findPostCustomById(id);
|
||||
|
||||
map.put("tags", tags);
|
||||
|
||||
map.put("discussions", newdd);
|
||||
map.put("posts", postsObj);
|
||||
UserInfo user = getUserInfo(request);
|
||||
if(user != null){
|
||||
map.put("username", user.getUsername());
|
||||
@@ -93,26 +93,27 @@ public class UserPostController extends BaseController {
|
||||
return "discussions";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//新建主题
|
||||
@PostMapping(value = "/newdiscussions")
|
||||
@ResponseBody
|
||||
public String newDiscussions(@RequestBody Discussions discussions) {
|
||||
logger.info(">>> newPost"+discussions);
|
||||
public String newDiscussions(@RequestBody Discussion discussion) {
|
||||
logger.info(">>> newPost"+ discussion);
|
||||
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = servletRequestAttributes.getRequest();
|
||||
UserInfo user = getUserInfo(request);
|
||||
if(user != null){
|
||||
discussions.setLastUserId( user.getId());
|
||||
discussions.setCreateId( user.getId());
|
||||
discussion.setLastUserId( user.getId());
|
||||
discussion.setCreateId( user.getId());
|
||||
}
|
||||
discussions.setCreateTime(new Date());
|
||||
discussion.setCreateTime(new Date());
|
||||
|
||||
Discussions saveDiscussions = discussionsService.insert(discussions);
|
||||
Discussion saveDiscussion = discussionsService.insert(discussion);
|
||||
JSONObject resultobj = new JSONObject();
|
||||
|
||||
logger.info(">>>{}",saveDiscussions );
|
||||
logger.info(">>>{}", saveDiscussion);
|
||||
resultobj.put("msg", "添加成功");
|
||||
resultobj.put("flag", true);
|
||||
return resultobj.toString(); //
|
||||
@@ -127,19 +128,24 @@ public class UserPostController extends BaseController {
|
||||
//新建评论
|
||||
@PostMapping(value = "/newpost")
|
||||
@ResponseBody
|
||||
public String newPosts(@RequestBody Posts posts) {
|
||||
logger.info(">>> newpost"+posts);
|
||||
public String newPosts(@RequestBody Post post) {
|
||||
logger.info(">>> newpost"+ post);
|
||||
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = servletRequestAttributes.getRequest();
|
||||
|
||||
UserInfo user = getUserInfo(request);
|
||||
if(user != null){
|
||||
posts.setCreateId( user.getId());
|
||||
post.setCreateId( user.getId());
|
||||
}
|
||||
posts.setCreateTime(new Date());
|
||||
post.setCreateTime(new Date());
|
||||
if(null != post.getParentId()){
|
||||
Post temp =postsService.findOneByid(post.getParentId());
|
||||
post.setUserId(temp.getCreateId());
|
||||
|
||||
Posts savePost = postsService.insert(posts);
|
||||
}
|
||||
|
||||
Post savePost = postsService.insert(post);
|
||||
JSONObject resultobj = new JSONObject();
|
||||
|
||||
logger.info(">>>{}",savePost );
|
||||
@@ -153,22 +159,22 @@ public class UserPostController extends BaseController {
|
||||
//新建标签
|
||||
@PostMapping(value = "/newtags")
|
||||
@ResponseBody
|
||||
public String newTags(@RequestBody Tags tags) {
|
||||
logger.info(">>> newTags"+tags);
|
||||
public String newTags(@RequestBody Tag tag) {
|
||||
logger.info(">>> newTags"+ tag);
|
||||
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = servletRequestAttributes.getRequest();
|
||||
|
||||
UserInfo user = getUserInfo(request);
|
||||
if(user != null){
|
||||
tags.setCreateId( user.getId());
|
||||
tag.setCreateId( user.getId());
|
||||
}
|
||||
tags.setCreateTime(new Date());
|
||||
tag.setCreateTime(new Date());
|
||||
|
||||
Tags saveTags = tagsService.insert(tags);
|
||||
Tag saveTag = tagsService.insert(tag);
|
||||
JSONObject resultobj = new JSONObject();
|
||||
|
||||
logger.info(">>>{}",saveTags );
|
||||
logger.info(">>>{}", saveTag);
|
||||
resultobj.put("msg", "添加成功");
|
||||
resultobj.put("flag", true);
|
||||
return resultobj.toString(); //
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.yaoyuan.jiscuss.controller;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Discussions;
|
||||
import com.yaoyuan.jiscuss.entity.Tags;
|
||||
import com.yaoyuan.jiscuss.entity.Discussion;
|
||||
import com.yaoyuan.jiscuss.entity.Tag;
|
||||
import com.yaoyuan.jiscuss.entity.UserInfo;
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.User;
|
||||
import com.yaoyuan.jiscuss.entity.custom.DiscussionCustom;
|
||||
import com.yaoyuan.jiscuss.service.IDiscussionsService;
|
||||
import com.yaoyuan.jiscuss.service.ITagsService;
|
||||
import com.yaoyuan.jiscuss.service.IUsersService;
|
||||
import com.yaoyuan.jiscuss.util.DelTagsUtil;
|
||||
import org.apache.catalina.mbeans.MBeanUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -48,23 +48,23 @@ public class UserSystemController extends BaseController {
|
||||
logger.info(">>> index");
|
||||
logger.info(">>> tag:" + tag);
|
||||
logger.info(">>> pageNum:" + pageNum);
|
||||
List<Users> userall = usersService.getAllList();
|
||||
List<User> userall = usersService.getAllList();
|
||||
logger.info(">>> 第一遍的全部用户:"+userall);
|
||||
|
||||
List<Users> useral2 = usersService.getAllList();
|
||||
List<User> useral2 = usersService.getAllList();
|
||||
logger.info(">>> 第二遍的全部用户:"+useral2);
|
||||
|
||||
int pageSiz = 10;
|
||||
int pageNumNew = pageNum - 1;
|
||||
Discussions discussions = new Discussions();
|
||||
Discussion discussion = new Discussion();
|
||||
//分页获取主题帖子
|
||||
Page<Discussions> allDiscussionsPage = discussionsService.queryAllDiscussionsList(discussions,pageNumNew,pageSiz);
|
||||
Page<Discussion> allDiscussionsPage = discussionsService.queryAllDiscussionsList(discussion,pageNumNew,pageSiz);
|
||||
|
||||
List<Discussions> allDiscussions = allDiscussionsPage.getContent();
|
||||
List<Discussions> newAllD = new ArrayList<>();
|
||||
List<Discussion> allDiscussions = allDiscussionsPage.getContent();
|
||||
List<DiscussionCustom> newAllD = new ArrayList<>();
|
||||
|
||||
for (Discussions dd : allDiscussions){
|
||||
Discussions newdd = new Discussions();
|
||||
for (Discussion dd : allDiscussions){
|
||||
DiscussionCustom newdd = new DiscussionCustom();
|
||||
BeanUtils.copyProperties(dd , newdd);
|
||||
String newCon = "";
|
||||
String content = DelTagsUtil.getTextFromHtml(newdd.getContent());
|
||||
@@ -74,6 +74,19 @@ public class UserSystemController extends BaseController {
|
||||
newCon = content;
|
||||
}
|
||||
newdd.setContent(newCon);
|
||||
if (null != newdd.getStartUserId()){
|
||||
User startUser = usersService.findOne(newdd.getStartUserId());
|
||||
newdd.setAvatar(startUser.getAvatar());
|
||||
newdd.setRealname(startUser.getRealname());
|
||||
newdd.setUsername(startUser.getUsername());
|
||||
}
|
||||
if (null != newdd.getLastUserId()){
|
||||
User lastUser = usersService.findOne(newdd.getLastUserId());
|
||||
newdd.setAvatarLast(lastUser.getAvatar());
|
||||
newdd.setRealnameLast(lastUser.getRealname());
|
||||
newdd.setUsernameLast(lastUser.getUsername());
|
||||
}
|
||||
|
||||
newAllD.add(newdd);
|
||||
}
|
||||
|
||||
@@ -85,7 +98,7 @@ public class UserSystemController extends BaseController {
|
||||
List<String> pageNumList = getPageNumList(allDiscussionsPage.getTotalPages());
|
||||
|
||||
//获取所有标签(以后尝试去缓存中取)
|
||||
List<Tags> allTags = tagsService.getAllList();
|
||||
List<Tag> allTags = tagsService.getAllList();
|
||||
logger.info("全部标签==>:{}",allTags);
|
||||
|
||||
System.out.println(userall.toString());
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Discussions;
|
||||
import com.yaoyuan.jiscuss.entity.Discussion;
|
||||
import com.yaoyuan.jiscuss.exception.BaseException;
|
||||
import com.yaoyuan.jiscuss.response.ResponseCode;
|
||||
import com.yaoyuan.jiscuss.service.IDiscussionsService;
|
||||
@@ -31,10 +31,10 @@ public class RestPostController {
|
||||
|
||||
@PostMapping("/discussion")
|
||||
@ApiOperation("新增主题")
|
||||
public Discussions save(@RequestBody Discussions discussions) {
|
||||
Discussions saveDiscussions = discussionsService.insert(discussions);
|
||||
if (saveDiscussions!=null) {
|
||||
return saveDiscussions;
|
||||
public Discussion save(@RequestBody Discussion discussion) {
|
||||
Discussion saveDiscussion = discussionsService.insert(discussion);
|
||||
if (saveDiscussion !=null) {
|
||||
return saveDiscussion;
|
||||
} else {
|
||||
throw new BaseException(ResponseCode.RESOURCES_NOT_EXIST);
|
||||
}
|
||||
@@ -43,15 +43,15 @@ public class RestPostController {
|
||||
|
||||
@GetMapping("/discussion/{id}")
|
||||
@ApiOperation("获取主题")
|
||||
public Discussions getDiscussions(@PathVariable Integer id) {
|
||||
Discussions discussions = discussionsService.findOne(id);
|
||||
return discussions;
|
||||
public Discussion getDiscussions(@PathVariable Integer id) {
|
||||
Discussion discussion = discussionsService.findOne(id);
|
||||
return discussion;
|
||||
}
|
||||
|
||||
@GetMapping("/discussions")
|
||||
@ApiOperation("获取全部主题")
|
||||
public List<Discussions> getAllDiscussions() {
|
||||
List<Discussions> allDiscussions = discussionsService.getAllList();
|
||||
public List<Discussion> getAllDiscussions() {
|
||||
List<Discussion> allDiscussions = discussionsService.getAllList();
|
||||
logger.info("全部主题==>:{}",allDiscussions);
|
||||
return allDiscussions;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.User;
|
||||
import com.yaoyuan.jiscuss.exception.BaseException;
|
||||
import com.yaoyuan.jiscuss.response.ResponseCode;
|
||||
import com.yaoyuan.jiscuss.service.IUsersService;
|
||||
@@ -34,8 +34,8 @@ public class RestUserController {
|
||||
|
||||
@PostMapping("/user")
|
||||
@ApiOperation("新增用户")
|
||||
public Users save(@RequestBody Users user) {
|
||||
Users saveUser = usersService.insert(user);
|
||||
public User save(@RequestBody User user) {
|
||||
User saveUser = usersService.insert(user);
|
||||
if (saveUser!=null) {
|
||||
return saveUser;
|
||||
} else {
|
||||
@@ -58,8 +58,8 @@ public class RestUserController {
|
||||
|
||||
@PutMapping("/user/{id}")
|
||||
@ApiOperation("修改用户")
|
||||
public Users update(@RequestBody Users user, @PathVariable Integer id) {
|
||||
Users updateuser = usersService.update(user, id);
|
||||
public User update(@RequestBody User user, @PathVariable Integer id) {
|
||||
User updateuser = usersService.update(user, id);
|
||||
if (updateuser!=null) {
|
||||
return updateuser;
|
||||
} else {
|
||||
@@ -69,15 +69,15 @@ public class RestUserController {
|
||||
|
||||
@GetMapping("/user/{id}")
|
||||
@ApiOperation("获取用户")
|
||||
public Users getUser(@PathVariable Integer id) {
|
||||
Users user = usersService.findOne(id);
|
||||
public User getUser(@PathVariable Integer id) {
|
||||
User user = usersService.findOne(id);
|
||||
return user;
|
||||
}
|
||||
|
||||
@GetMapping("/user")
|
||||
@ApiOperation("获取全部用户")
|
||||
public List<Users> getUser(Users user) {
|
||||
List<Users> userall = usersService.getAllList();
|
||||
public List<User> getUser(User user) {
|
||||
List<User> userall = usersService.getAllList();
|
||||
logger.info("全部用户==>:{}",userall);
|
||||
return userall;
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ import javax.persistence.Table;
|
||||
import lombok.Data;
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="discussions")
|
||||
public class Discussions implements Serializable {
|
||||
@Table(name="discussion")
|
||||
public class Discussion implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
+2
-2
@@ -10,8 +10,8 @@ import javax.persistence.Table;
|
||||
import lombok.Data;
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="discussionstags")
|
||||
public class DiscussionsTags implements Serializable{
|
||||
@Table(name="discussiontag")
|
||||
public class DiscussionTag implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
+2
-2
@@ -14,8 +14,8 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="posts")
|
||||
public class Posts implements Serializable{
|
||||
@Table(name="post")
|
||||
public class Post implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
+2
-2
@@ -11,8 +11,8 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="settings")
|
||||
public class Settings implements Serializable{
|
||||
@Table(name="setting")
|
||||
public class Setting implements Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
+2
-2
@@ -14,8 +14,8 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="tags")
|
||||
public class Tags implements Serializable{
|
||||
@Table(name="tag")
|
||||
public class Tag implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
+5
-2
@@ -23,8 +23,8 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="users")
|
||||
public class Users implements Serializable {
|
||||
@Table(name="user")
|
||||
public class User implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@@ -51,6 +51,9 @@ public class Users implements Serializable {
|
||||
|
||||
@Column(name="gender")
|
||||
private String gender;
|
||||
|
||||
@Column(name="avatar")
|
||||
private String avatar;
|
||||
|
||||
@Column(name="phone")
|
||||
private String phone;
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.yaoyuan.jiscuss.repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Discussions;
|
||||
import com.yaoyuan.jiscuss.entity.Discussion;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface DiscussionsRepository extends JpaRepository<Discussions,Integer> {
|
||||
public interface DiscussionsRepository extends JpaRepository<Discussion,Integer> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.yaoyuan.jiscuss.repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.DiscussionsTags;
|
||||
import com.yaoyuan.jiscuss.entity.DiscussionTag;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
@Repository
|
||||
public interface DiscussionsTagsRepository extends JpaRepository<DiscussionsTags,Integer> {
|
||||
public interface DiscussionsTagsRepository extends JpaRepository<DiscussionTag,Integer> {
|
||||
}
|
||||
|
||||
@@ -1,28 +1,38 @@
|
||||
package com.yaoyuan.jiscuss.repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.Post;
|
||||
import com.yaoyuan.jiscuss.entity.custom.PostCustom;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface PostsRepository extends JpaRepository<Posts,Integer> {
|
||||
public interface PostsRepository extends JpaRepository<Post,Integer> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dId
|
||||
* @return
|
||||
*/
|
||||
@Query("from Posts where discussionId = :dId")
|
||||
List<Posts> findOneBy(@Param("dId")Integer dId);
|
||||
@Query("from Post where discussionId = :dId")
|
||||
List<Post> findOneBy(@Param("dId")Integer dId);
|
||||
|
||||
@Query("from Posts where parentId is null and discussionId = :dId")
|
||||
List<Posts> findAllByDIdAndparentIdNull(@Param("dId")Integer dId);
|
||||
@Query(value = "select p.*,u.avatar as user_avatar ,u.username as user_username ,u.realname as user_realname ," +
|
||||
"u2.avatar as create_avatar ,u2.username as create_username ,u2.realname as create_realname \n" +
|
||||
"from Post p \n" +
|
||||
"left join User u on p.user_id = u.id \n" +
|
||||
"left join User u2 on p.create_id = u2.id \n" +
|
||||
"where p.discussion_id = :dId order by p.create_time desc"
|
||||
, nativeQuery = true)
|
||||
List<Map<String, Object>> findPostCustomById(@Param("dId")Integer dId);
|
||||
|
||||
@Query("from Posts where parentId is not null and discussionId = :dId")
|
||||
List<Posts> findAllByDIdAndparentIdNotNull(@Param("dId")Integer dId);
|
||||
@Query("from Post where parentId is null and discussionId = :dId")
|
||||
List<Post> findAllByDIdAndparentIdNull(@Param("dId")Integer dId);
|
||||
|
||||
@Query("from Post where parentId is not null and discussionId = :dId")
|
||||
List<Post> findAllByDIdAndparentIdNotNull(@Param("dId")Integer dId);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.yaoyuan.jiscuss.repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Settings;
|
||||
import com.yaoyuan.jiscuss.entity.Setting;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SettingsRepository extends JpaRepository<Settings,Integer> {
|
||||
public interface SettingsRepository extends JpaRepository<Setting,Integer> {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.yaoyuan.jiscuss.repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import com.yaoyuan.jiscuss.entity.Tags;
|
||||
import com.yaoyuan.jiscuss.entity.Tag;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
@@ -10,8 +9,8 @@ import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface TagsRepository extends JpaRepository<Tags,Integer> {
|
||||
public interface TagsRepository extends JpaRepository<Tag,Integer> {
|
||||
|
||||
@Query(value = "FROM Tags a, DiscussionsTags b WHERE a.id = b.tagId and b.discussionId = :dId")
|
||||
List<Tags> findByDId(@Param("dId")Integer dId);
|
||||
@Query(value = "FROM Tag a, DiscussionTag b WHERE a.id = b.tagId and b.discussionId = :dId")
|
||||
List<Tag> findByDId(@Param("dId")Integer dId);
|
||||
}
|
||||
|
||||
@@ -7,33 +7,33 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.User;
|
||||
|
||||
|
||||
@Repository
|
||||
public interface UsersRepository extends JpaRepository<Users,Integer> {
|
||||
public interface UsersRepository extends JpaRepository<User,Integer> {
|
||||
/**
|
||||
*
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
@Query("from Users where username like %:username%")
|
||||
List<Users> getByUsernameIsLike(@Param("username")String username);
|
||||
@Query("from User where username like %:username%")
|
||||
List<User> getByUsernameIsLike(@Param("username")String username);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Users getById(Integer id);
|
||||
User getById(Integer id);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
@Query("from Users where username = :username")
|
||||
Users getByUsername(String username);
|
||||
@Query("from User where username = :username")
|
||||
User getByUsername(String username);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,7 +41,7 @@ public interface UsersRepository extends JpaRepository<Users,Integer> {
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
@Query("from Users where username = :username and password = :password")
|
||||
Users checkByUsernameAndPassword(String username, String password);
|
||||
@Query("from User where username = :username and password = :password")
|
||||
User checkByUsernameAndPassword(String username, String password);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,16 +4,16 @@ import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Discussions;
|
||||
import com.yaoyuan.jiscuss.entity.Discussion;
|
||||
|
||||
public interface IDiscussionsService {
|
||||
|
||||
List<Discussions> getAllList();
|
||||
List<Discussion> getAllList();
|
||||
|
||||
Discussions insert(Discussions discussions);
|
||||
Discussion insert(Discussion discussion);
|
||||
|
||||
Discussions findOne(Integer id);
|
||||
Discussion findOne(Integer id);
|
||||
|
||||
Page<Discussions> queryAllDiscussionsList(Discussions discussions,int pageNum,int pageSize);
|
||||
Page<Discussion> queryAllDiscussionsList(Discussion discussion, int pageNum, int pageSize);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.yaoyuan.jiscuss.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.DiscussionsTags;
|
||||
import com.yaoyuan.jiscuss.entity.DiscussionTag;
|
||||
|
||||
public interface IDiscussionsTagsService {
|
||||
|
||||
List<DiscussionsTags> getAllList();
|
||||
List<DiscussionTag> getAllList();
|
||||
|
||||
DiscussionsTags insert(DiscussionsTags discussionsTags);
|
||||
DiscussionTag insert(DiscussionTag discussionTag);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package com.yaoyuan.jiscuss.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import com.yaoyuan.jiscuss.entity.Post;
|
||||
import com.yaoyuan.jiscuss.entity.custom.PostCustom;
|
||||
|
||||
public interface IPostsService {
|
||||
List<Posts> getAllList();
|
||||
List<Post> getAllList();
|
||||
|
||||
Posts insert(Posts posts);
|
||||
Post insert(Post post);
|
||||
|
||||
List<Posts> findOneBy(Integer id);
|
||||
List<Post> findOneBy(Integer id);
|
||||
|
||||
List<Posts> findAllByDIdAndparentIdNull(Integer dId);
|
||||
List<Post> findAllByDIdAndparentIdNull(Integer dId);
|
||||
|
||||
List<Posts> findAllByDIdAndparentIdNotNull(Integer dId);
|
||||
List<Post> findAllByDIdAndparentIdNotNull(Integer dId);
|
||||
|
||||
List<PostCustom> findPostCustomById(Integer id);
|
||||
|
||||
Post findOneByid(Integer parentId);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.yaoyuan.jiscuss.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Settings;
|
||||
import com.yaoyuan.jiscuss.entity.Setting;
|
||||
|
||||
public interface ISettingsService {
|
||||
|
||||
List<Settings> getAllList();
|
||||
List<Setting> getAllList();
|
||||
|
||||
Settings insert(Settings settings);
|
||||
Setting insert(Setting setting);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package com.yaoyuan.jiscuss.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Tags;
|
||||
import com.yaoyuan.jiscuss.entity.Tag;
|
||||
|
||||
public interface ITagsService {
|
||||
|
||||
List<Tags> getAllList();
|
||||
List<Tag> getAllList();
|
||||
|
||||
Tags insert(Tags tags);
|
||||
Tag insert(Tag tag);
|
||||
|
||||
List<Tags> findByDId(Integer id);
|
||||
List<Tag> findByDId(Integer id);
|
||||
}
|
||||
|
||||
@@ -4,29 +4,29 @@ import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.User;
|
||||
|
||||
public interface IUsersService {
|
||||
|
||||
List<Users> getAllList();
|
||||
List<User> getAllList();
|
||||
|
||||
Page<Users> queryAllUsersList(int pageNum,int pageSize);
|
||||
Page<User> queryAllUsersList(int pageNum, int pageSize);
|
||||
|
||||
List<Users> getByUsernameIsLike(String name);
|
||||
List<User> getByUsernameIsLike(String name);
|
||||
|
||||
// @Cacheable("myCache")
|
||||
Users findOne(Integer id);
|
||||
User findOne(Integer id);
|
||||
|
||||
Users insert(Users user);
|
||||
User insert(User user);
|
||||
|
||||
void remove(Integer id);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
Users getByUsername(String username);
|
||||
User getByUsername(String username);
|
||||
|
||||
Users checkByUsernameAndPassword(String username, String password);
|
||||
User checkByUsernameAndPassword(String username, String password);
|
||||
|
||||
Users update(Users user, Integer id);
|
||||
User update(User user, Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Discussions;
|
||||
import com.yaoyuan.jiscuss.entity.Discussion;
|
||||
import com.yaoyuan.jiscuss.repository.DiscussionsRepository;
|
||||
import com.yaoyuan.jiscuss.service.IDiscussionsService;
|
||||
|
||||
@@ -19,30 +19,30 @@ public class DiscussionsServiceImpl implements IDiscussionsService {
|
||||
private DiscussionsRepository discussionsRepository;
|
||||
|
||||
@Override
|
||||
public List<Discussions> getAllList() {
|
||||
public List<Discussion> getAllList() {
|
||||
return discussionsRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Discussions insert(Discussions discussions) {
|
||||
public Discussion insert(Discussion discussion) {
|
||||
|
||||
return discussionsRepository.save(discussions);
|
||||
return discussionsRepository.save(discussion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Discussions findOne(Integer id) {
|
||||
Discussions discussions = new Discussions();
|
||||
discussions.setId(id);
|
||||
public Discussion findOne(Integer id) {
|
||||
Discussion discussion = new Discussion();
|
||||
discussion.setId(id);
|
||||
return discussionsRepository.getOne(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Discussions> queryAllDiscussionsList(Discussions discussions,int pageNum, int pageSize) {
|
||||
public Page<Discussion> queryAllDiscussionsList(Discussion discussion, int pageNum, int pageSize) {
|
||||
Sort sort=new Sort(Sort.Direction.DESC,"id");
|
||||
@SuppressWarnings("deprecation")
|
||||
Pageable pageable=new PageRequest(pageNum,pageSize,sort);
|
||||
//将匹配对象封装成Example对象
|
||||
Example<Discussions> example = Example.of(discussions);
|
||||
Example<Discussion> example = Example.of(discussion);
|
||||
|
||||
return discussionsRepository.findAll(example,pageable);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import javax.transaction.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.DiscussionsTags;
|
||||
import com.yaoyuan.jiscuss.entity.DiscussionTag;
|
||||
import com.yaoyuan.jiscuss.repository.DiscussionsTagsRepository;
|
||||
import com.yaoyuan.jiscuss.service.IDiscussionsTagsService;
|
||||
|
||||
@@ -18,13 +18,13 @@ public class DiscussionsTagsServiceImpl implements IDiscussionsTagsService {
|
||||
private DiscussionsTagsRepository discussionsTagsRepository;
|
||||
|
||||
@Override
|
||||
public List<DiscussionsTags> getAllList() {
|
||||
public List<DiscussionTag> getAllList() {
|
||||
return discussionsTagsRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscussionsTags insert(DiscussionsTags discussionsTags) {
|
||||
return discussionsTagsRepository.save(discussionsTags);
|
||||
public DiscussionTag insert(DiscussionTag discussionTag) {
|
||||
return discussionsTagsRepository.save(discussionTag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.yaoyuan.jiscuss.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Reader;
|
||||
import java.sql.Clob;
|
||||
import java.util.*;
|
||||
|
||||
import com.yaoyuan.jiscuss.common.PostCommonUtil;
|
||||
import com.yaoyuan.jiscuss.entity.Discussion;
|
||||
import com.yaoyuan.jiscuss.entity.custom.DiscussionCustom;
|
||||
import com.yaoyuan.jiscuss.entity.custom.PostCustom;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Posts;
|
||||
import com.yaoyuan.jiscuss.entity.Post;
|
||||
import com.yaoyuan.jiscuss.repository.PostsRepository;
|
||||
import com.yaoyuan.jiscuss.service.IPostsService;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
@@ -20,32 +28,86 @@ public class PostsServiceImpl implements IPostsService {
|
||||
private PostsRepository postsRepository;
|
||||
|
||||
@Override
|
||||
public List<Posts> getAllList() {
|
||||
public List<Post> getAllList() {
|
||||
return postsRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Posts> findOneBy(Integer id) {
|
||||
public List<Post> findOneBy(Integer id) {
|
||||
|
||||
List<Posts> posts = postsRepository.findOneBy(id);
|
||||
List<Post> posts = postsRepository.findOneBy(id);
|
||||
return posts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Posts> findAllByDIdAndparentIdNull(Integer dId) {
|
||||
List<Posts> posts = postsRepository.findAllByDIdAndparentIdNull(dId);
|
||||
public Post findOneByid(Integer id) {
|
||||
Post post =new Post();
|
||||
post.setId(id);
|
||||
Example<Post> example = Example.of(post);
|
||||
Optional<Post> postRes = postsRepository.findOne(example);
|
||||
return postRes.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostCustom> findPostCustomById(Integer id) {
|
||||
|
||||
List<Map<String, Object>> posts = postsRepository.findPostCustomById(id);
|
||||
// List<Map<String, Object>> postsObjNew = this.getNewPostsObj(posts);
|
||||
|
||||
List<PostCustom> postCustomList = new ArrayList<>();
|
||||
for(Map<String, Object> mapObj : posts){
|
||||
PostCustom postCustom = new PostCustom();
|
||||
postCustom.setId(Integer.parseInt(String.valueOf(mapObj.get("id"))));
|
||||
postCustom.setParentId(mapObj.get("parent_id") != null ? Integer.parseInt(String.valueOf(mapObj.get("parent_id"))) : null);
|
||||
if(null != mapObj.get("create_time")){
|
||||
postCustom.setCreateTime((Date) mapObj.get("create_time"));
|
||||
}
|
||||
String content = "";
|
||||
if(mapObj.get("content") != null){
|
||||
Clob clob = (Clob) mapObj.get("content");
|
||||
content = PostCommonUtil.clobToString(clob);
|
||||
}
|
||||
postCustom.setContent(content);
|
||||
String avatar = "";
|
||||
if(mapObj.get("create_avatar") != null){
|
||||
Clob clob = (Clob) mapObj.get("create_avatar");
|
||||
avatar = PostCommonUtil.clobToString(clob);
|
||||
}
|
||||
postCustom.setAvatar(avatar);
|
||||
postCustom.setUsername(mapObj.get("create_username") != null ? String.valueOf(mapObj.get("create_username")): null);
|
||||
postCustom.setRealname(mapObj.get("create_realname") != null ? String.valueOf(mapObj.get("create_realname")): null);
|
||||
String avatarReply = "";
|
||||
if(mapObj.get("user_avatar") != null){
|
||||
Clob clob = (Clob) mapObj.get("user_avatar");
|
||||
avatarReply = PostCommonUtil.clobToString(clob);
|
||||
}
|
||||
postCustom.setAvatarReply(avatarReply);
|
||||
postCustom.setUsernameReply(mapObj.get("user_username") != null ? String.valueOf(mapObj.get("user_username")): null);
|
||||
postCustom.setRealnameReply(mapObj.get("user_realname") != null ? String.valueOf(mapObj.get("user_realname")): null);
|
||||
|
||||
postCustomList.add(postCustom);
|
||||
}
|
||||
|
||||
List<PostCustom> postCustomListNew = PostCommonUtil.getNewPostsObjCustom(postCustomList);
|
||||
|
||||
return postCustomListNew;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Post> findAllByDIdAndparentIdNull(Integer dId) {
|
||||
List<Post> posts = postsRepository.findAllByDIdAndparentIdNull(dId);
|
||||
return posts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Posts> findAllByDIdAndparentIdNotNull(Integer dId) {
|
||||
List<Posts> posts = postsRepository.findAllByDIdAndparentIdNotNull(dId);
|
||||
public List<Post> findAllByDIdAndparentIdNotNull(Integer dId) {
|
||||
List<Post> posts = postsRepository.findAllByDIdAndparentIdNotNull(dId);
|
||||
return posts;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Posts insert(Posts posts) {
|
||||
return postsRepository.save(posts);
|
||||
public Post insert(Post post) {
|
||||
return postsRepository.save(post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import javax.transaction.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Settings;
|
||||
import com.yaoyuan.jiscuss.entity.Setting;
|
||||
import com.yaoyuan.jiscuss.repository.SettingsRepository;
|
||||
import com.yaoyuan.jiscuss.service.ISettingsService;
|
||||
|
||||
@@ -18,12 +18,12 @@ public class SettingsServiceImpl implements ISettingsService {
|
||||
private SettingsRepository settingsRepository;
|
||||
|
||||
@Override
|
||||
public List<Settings> getAllList() {
|
||||
public List<Setting> getAllList() {
|
||||
return settingsRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Settings insert(Settings settings) {
|
||||
return settingsRepository.save(settings);
|
||||
public Setting insert(Setting setting) {
|
||||
return settingsRepository.save(setting);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,9 @@ import java.util.List;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Tags;
|
||||
import com.yaoyuan.jiscuss.entity.Tag;
|
||||
import com.yaoyuan.jiscuss.repository.TagsRepository;
|
||||
import com.yaoyuan.jiscuss.service.ITagsService;
|
||||
|
||||
@@ -19,17 +18,17 @@ public class TagsServiceImpl implements ITagsService {
|
||||
private TagsRepository tagsRepository;
|
||||
|
||||
@Override
|
||||
public List<Tags> getAllList() {
|
||||
public List<Tag> getAllList() {
|
||||
return tagsRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tags insert(Tags tags) {
|
||||
return tagsRepository.save(tags);
|
||||
public Tag insert(Tag tag) {
|
||||
return tagsRepository.save(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Tags> findByDId(Integer id) {
|
||||
public List<Tag> findByDId(Integer id) {
|
||||
return tagsRepository.findByDId(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.yaoyuan.jiscuss.service.impl;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.UserInfo;
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.User;
|
||||
import com.yaoyuan.jiscuss.service.IUsersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@@ -37,7 +35,7 @@ public class UserDetailServiceImpl implements UserDetailsService {
|
||||
@Override
|
||||
public UserInfo loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
// 通过用户名从数据库获取用户信息
|
||||
Users userInfo = userInfoService.getByUsername(username);
|
||||
User userInfo = userInfoService.getByUsername(username);
|
||||
if (userInfo == null) {
|
||||
throw new UsernameNotFoundException("用户不存在");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import com.yaoyuan.jiscuss.entity.Users;
|
||||
import com.yaoyuan.jiscuss.entity.User;
|
||||
import com.yaoyuan.jiscuss.repository.UsersRepository;
|
||||
import com.yaoyuan.jiscuss.service.IUsersService;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
*/
|
||||
@Cacheable(value = "user")
|
||||
@Override
|
||||
public List<Users> getAllList() {
|
||||
public List<User> getAllList() {
|
||||
return usersRepository.findAll();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Users> queryAllUsersList(int pageNum,int pageSize) {
|
||||
public Page<User> queryAllUsersList(int pageNum, int pageSize) {
|
||||
Sort sort=new Sort(Sort.Direction.DESC,"id");
|
||||
@SuppressWarnings("deprecation")
|
||||
Pageable pageable=new PageRequest(pageNum,pageSize,sort);
|
||||
@@ -57,7 +57,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Users> getByUsernameIsLike(String name) {
|
||||
public List<User> getByUsernameIsLike(String name) {
|
||||
return usersRepository.getByUsernameIsLike(name);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
*/
|
||||
@Cacheable(value = "user", key = "#id")
|
||||
@Override
|
||||
public Users findOne(Integer id) {
|
||||
public User findOne(Integer id) {
|
||||
return usersRepository.getById(id);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
*/
|
||||
@CachePut(value = "user", key = "#user.id")
|
||||
@Override
|
||||
public Users insert(Users user) {
|
||||
public User insert(User user) {
|
||||
return usersRepository.save(user);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
*/
|
||||
@CachePut(value = "user", key = "#user.id")
|
||||
@Override
|
||||
public Users update(Users user, Integer id) {
|
||||
public User update(User user, Integer id) {
|
||||
return usersRepository.saveAndFlush(user);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Users getByUsername(String username) {
|
||||
public User getByUsername(String username) {
|
||||
return usersRepository.getByUsername(username);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class UsersServiceImpl implements IUsersService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Users checkByUsernameAndPassword(String username,String password) {
|
||||
public User checkByUsernameAndPassword(String username, String password) {
|
||||
return usersRepository.checkByUsernameAndPassword(username,password);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,32 @@ spring:
|
||||
initial-size: 5
|
||||
max-active: 10
|
||||
max-wait: 5000
|
||||
validation-query: select 1
|
||||
validation-query: select 1SS
|
||||
# 状态监控
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
db-type: h2
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 2000
|
||||
# 监控过滤器
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
exclusions:
|
||||
- "*.js"
|
||||
- "*.gif"
|
||||
- "*.jpg"
|
||||
- "*.png"
|
||||
- "*.css"
|
||||
- "*.ico"
|
||||
- "/druid/*"
|
||||
# druid 监控页面
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
# reset-enable: false
|
||||
# login-username: root
|
||||
# login-password: root
|
||||
freemarker:
|
||||
# 设置模板后缀名
|
||||
suffix: .ftl
|
||||
|
||||
+33
-29
@@ -1,67 +1,71 @@
|
||||
|
||||
|
||||
insert into users
|
||||
values (1, 'admin', '管理员', 'as_2583698@sina.com','123','2019-09-09 00:00:00',31,'男','13804250293',0,0,'2019-09-09 00:00:00',1,1);
|
||||
insert into user
|
||||
values (1, 'admin', '管理员', 'as_2583698@sina.com','123','2019-09-09 00:00:00',31,'','男','13804250293',0,0,'2019-09-09 00:00:00',1,1);
|
||||
|
||||
insert into users
|
||||
values (2, 'test', '测试用户1', 'as_2583698@sina.com','123','2019-09-09 00:00:00',31,'男','13804250293',0,0,'2019-09-09 00:00:00',1,0);
|
||||
insert into user
|
||||
values (2, 'test', '测试用户1', 'as_2583698@sina.com','123','2019-09-09 00:00:00',31,'','男','13804250293',0,0,'2019-09-09 00:00:00',1,0);
|
||||
|
||||
|
||||
insert into discussions
|
||||
values (1, '测试主题1', '测试内容1',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
insert into discussion
|
||||
values (1, '测试主题1', '测试内容1',null,null,null,'2020-09-19 00:00:00',1,null,'2020-09-29 00:00:00',2,null,null,null,null,null,1,'2020-09-09 00:00:00');
|
||||
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (2, '测试主题2', '测试内容2',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (3, '测试主题3', '测试内容3',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (4, '测试主题4', '测试内容4',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (5, '测试主题5', '测试内容2测试内容2测试内容2测试内容2测试内容2测试内容2',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (6, '测试主题6', '测试内容3测试测试测试测试测试测试测试测试测试测试测试测试测试',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (7, '测试主题7', '测试内容7',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (8, '测试主题8', '测试内容8',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (9, '测试主题9', '测试内容9',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (10, '测试主题10', '测试内容113',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into discussions
|
||||
insert into discussion
|
||||
values (11, '测试主题11', '测试内容3测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试',null,null,null,null,null,null,null,1,null,null,null,null,null,null,null);
|
||||
|
||||
insert into tags
|
||||
insert into tag
|
||||
values (1, '测试标签1',null,null,null,null,null,null,null,null,null);
|
||||
|
||||
|
||||
insert into posts
|
||||
values (1, 1, 1,null,1,null,'评论内容222',null,null,null,null,null,null,null,null);
|
||||
insert into post
|
||||
values (1, 1, 1,'2020-02-09 00:00:00',1,null,'评论内容222',null,null,null,null,null,null,1,'2020-08-09 00:00:00');
|
||||
|
||||
insert into posts
|
||||
values (2, 1, 2,null,1,null,'评论内容333',null,null,1,null,null,null,null,null);
|
||||
insert into post
|
||||
values (2, 1, 2,'2020-01-09 00:00:00',2,null,'评论内容333',null,null,1,null,null,null,2,'2020-07-09 00:00:00');
|
||||
|
||||
insert into posts
|
||||
values (3, 1, 3,null,1,1,'评论内容444',null,null,1,null,null,null,null,null);
|
||||
insert into post
|
||||
values (7, 1, 7,'2020-01-09 00:00:00',1,null,'评论内容3331111',null,null,1,null,null,null,1,'2020-03-09 00:00:00');
|
||||
|
||||
insert into posts
|
||||
values (4, 1, 4,null,1,1,'评论内容555',null,null,null,null,null,null,null,null);
|
||||
|
||||
insert into posts
|
||||
values (5, 1, 5,null,1,null,'评论内容666',null,null,4,null,null,null,null,null);
|
||||
insert into post
|
||||
values (3, 1, 3,'2020-01-09 00:00:00',1,1,'评论内容444',null,null,1,null,null,null,1,'2020-02-09 00:00:00');
|
||||
|
||||
insert into posts
|
||||
values (6, 1, 6,null,1,null,'评论内容777',null,null,5,null,null,null,null,null);
|
||||
insert into post
|
||||
values (4, 1, 4,'2020-01-09 00:00:00',2,1,'评论内容555',null,null,null,null,null,null,2,'2020-03-09 00:00:00');
|
||||
|
||||
insert into post
|
||||
values (5, 1, 5,'2020-01-09 00:00:00',2,null,'评论内容666',null,null,1,null,null,null,2,'2020-09-09 00:00:00');
|
||||
|
||||
insert into post
|
||||
values (6, 1, 6,'2020-01-09 00:00:00',1,null,'评论内容777',null,null,5,null,null,null,1,'2020-09-09 00:00:00');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- 用户表1
|
||||
drop table if exists users;
|
||||
CREATE TABLE users(
|
||||
drop table if exists user;
|
||||
CREATE TABLE user(
|
||||
id INTEGER not null primary key auto_increment,
|
||||
username varchar(20),
|
||||
realname varchar(20),
|
||||
@@ -8,6 +8,7 @@ email varchar(20),
|
||||
password varchar(20),
|
||||
join_time datetime,
|
||||
age INTEGER,
|
||||
avatar text,
|
||||
gender char(20),
|
||||
phone char(20),
|
||||
discussions_count INTEGER,
|
||||
@@ -17,8 +18,8 @@ flag INTEGER,
|
||||
level INTEGER
|
||||
);
|
||||
-- 主题表2
|
||||
drop table if exists discussions;
|
||||
CREATE TABLE discussions(
|
||||
drop table if exists discussion;
|
||||
CREATE TABLE discussion(
|
||||
id INTEGER not null primary key auto_increment,
|
||||
title varchar(200),
|
||||
content text,
|
||||
@@ -39,14 +40,14 @@ create_id INTEGER,
|
||||
create_time datetime
|
||||
);
|
||||
-- 主题标签关联表3
|
||||
drop table if exists discussionstags;
|
||||
CREATE TABLE discussionstags(
|
||||
drop table if exists discussiontag;
|
||||
CREATE TABLE discussiontag(
|
||||
discussion_id INTEGER not null ,
|
||||
tag_id INTEGER
|
||||
);
|
||||
-- 评论表4
|
||||
drop table if exists posts;
|
||||
CREATE TABLE posts(
|
||||
drop table if exists post;
|
||||
CREATE TABLE post(
|
||||
id INTEGER not null primary key auto_increment ,
|
||||
discussion_id INTEGER,
|
||||
number INTEGER,
|
||||
@@ -64,14 +65,14 @@ create_id INTEGER,
|
||||
create_time datetime
|
||||
);
|
||||
-- 设置表5
|
||||
drop table if exists settings;
|
||||
CREATE TABLE settings(
|
||||
drop table if exists setting;
|
||||
CREATE TABLE setting(
|
||||
key varchar(20) primary key,
|
||||
value text
|
||||
);
|
||||
-- 标签表6
|
||||
drop table if exists tags;
|
||||
CREATE TABLE tags(
|
||||
drop table if exists tag;
|
||||
CREATE TABLE tag(
|
||||
id INTEGER not null primary key auto_increment,
|
||||
name varchar(200),
|
||||
description varchar(200),
|
||||
|
||||
@@ -9,20 +9,22 @@ $("#addPost").click(function () {
|
||||
console.log("点击 addPost");
|
||||
console.log(username);
|
||||
console.log(discussionsId);
|
||||
|
||||
let postId = $("#postId").val();
|
||||
console.log(postId);
|
||||
if(username && username!=null){
|
||||
var token = $("meta[name='_csrf']").attr("content");
|
||||
var header = $("meta[name='_csrf_header']").attr("content");
|
||||
console.warn(header)
|
||||
console.warn(token)
|
||||
var content = $("#postcontent").val();
|
||||
var content = $("#postContent").val();
|
||||
console.log(content);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/newpost",
|
||||
data: JSON.stringify({
|
||||
content: content,
|
||||
discussion_id: discussionsId
|
||||
discussionId: discussionsId,
|
||||
parentId: postId
|
||||
}),
|
||||
contentType: 'application/json',
|
||||
beforeSend: function(request) {
|
||||
@@ -32,7 +34,7 @@ $("#addPost").click(function () {
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if(data.flag){
|
||||
massage(title+',添加成功!','');
|
||||
massage(content+',添加成功!','');
|
||||
location.reload();
|
||||
}else{
|
||||
massage(data.msg,'');
|
||||
@@ -46,4 +48,16 @@ $("#addPost").click(function () {
|
||||
}
|
||||
});
|
||||
|
||||
// 回复
|
||||
function replyThis(username, postId) {
|
||||
console.warn(username)
|
||||
console.warn(postId)
|
||||
$("#postId").val(postId);
|
||||
var content = $("#postContent").val();
|
||||
if (content) content += '\n';
|
||||
$("#postContent").val(content + "@" + username + " ");
|
||||
$("#postContent").focus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="ui main menu" id="menu">
|
||||
<div class="ui container">
|
||||
<div href="#" class="header borderless item">
|
||||
<div href="/" class="header borderless item">
|
||||
<img class="logo" src="static/assets/images/logo.png">
|
||||
Jiscuss
|
||||
</div>
|
||||
|
||||
@@ -35,10 +35,13 @@
|
||||
<div id="context2">
|
||||
|
||||
<h2 class="ui header">
|
||||
<i class="save outline"></i>
|
||||
<i class="settings icon"></i>
|
||||
<div class="content">
|
||||
${discussions.title}
|
||||
<div class="sub header">某某标签分类</div>
|
||||
<#list tags as tag>
|
||||
<div class="sub header">${tag.name}</div>
|
||||
</#list>
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
@@ -55,9 +58,15 @@
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="summary">
|
||||
用户 <a>测试人员1</a> 发布于
|
||||
用户 <a>${discussions.realname}</a> 发布于
|
||||
<div class="date">
|
||||
${discussions.createTime}
|
||||
${discussions.startTime}
|
||||
</div>
|
||||
</div>
|
||||
<div class="summary">
|
||||
用户 <a>${discussions.realnameLast}</a> 最后回复于
|
||||
<div class="date">
|
||||
${discussions.lastTime}
|
||||
</div>
|
||||
</div>
|
||||
<div class="meta">
|
||||
@@ -70,84 +79,57 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="ui minimal comments">
|
||||
<div class="ui threaded comments">
|
||||
<h3 class="ui dividing header">评论区</h3>
|
||||
<div class="comment">
|
||||
<a class="avatar">
|
||||
<img src="/static/assets/images/logo.png">
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="author">用户6</a>
|
||||
<div class="metadata">
|
||||
<span class="date">Today at 5:42PM</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
测试测试6666!
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="reply">回复</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment">
|
||||
<a class="avatar">
|
||||
<img src="/static/assets/images/logo.png">
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="author">用户7</a>
|
||||
<div class="metadata">
|
||||
<span class="date">Yesterday at 12:30AM</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
<p>测试评论!</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="reply">回复</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comments">
|
||||
<div class="comment">
|
||||
<a class="avatar">
|
||||
<img src="/static/assets/images/logo.png">
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="author">用户8</a>
|
||||
<div class="metadata">
|
||||
<span class="date">Just now</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
测试平路8 :)
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="reply">回复</a>
|
||||
</div>
|
||||
<input type="hidden" name="postId" id="postId" value=""/>
|
||||
<#list posts as post>
|
||||
<div class="comment">
|
||||
<a class="avatar">
|
||||
<img src="/static/assets/images/logo.png">
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="author">${post.username}</a>
|
||||
<div class="metadata">
|
||||
<span class="date">${post.createTime}</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
${post.content}
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="reply" onclick="replyThis('${post.username}', '${post.id}')">回复</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment">
|
||||
<a class="avatar">
|
||||
<img src="/static/assets/images/logo.png">
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="author">测试用户999n</a>
|
||||
<div class="metadata">
|
||||
<span class="date">5 days ago</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
哈哈哈哈, 测试评论
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="reply">回复</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui section divider"></div>
|
||||
<#list post.child as child>
|
||||
<div class="comments">
|
||||
<div class="comment">
|
||||
<a class="avatar">
|
||||
<img src="/static/assets/images/logo.png">
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="author">${child.username}</a>
|
||||
<div class="metadata">
|
||||
<span class="date">${child.createTime}</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
${child.content}
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="reply" onclick="replyThis('${child.username}', '${child.id}')">回复</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#list>
|
||||
</div>
|
||||
</#list>
|
||||
|
||||
<div class="ui">
|
||||
|
||||
</div>
|
||||
<form class="ui reply form">
|
||||
<div class="field">
|
||||
<textarea id="postcontent"></textarea>
|
||||
<textarea id="postContent"></textarea>
|
||||
</div>
|
||||
<div class="ui blue labeled submit icon button" id="addPost">
|
||||
<i class="icon edit"></i> 添加评论
|
||||
@@ -155,13 +137,10 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="widescreen large screen computer tablet only four wide column">
|
||||
|
||||
<div class="widescreen large screen computer tablet only four wide column">
|
||||
<div class="ui fluid action input">
|
||||
<input type="text" placeholder="搜索...">
|
||||
<div class="ui button">搜索</div>
|
||||
@@ -200,30 +179,32 @@
|
||||
|
||||
<div class="ui card">
|
||||
<div class="content">
|
||||
<div class="header">预留功能</div>
|
||||
<div class="header">作者的热门主题</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h4 class="ui sub header">Jiscuss</h4>
|
||||
<div class="ui small feed">
|
||||
<div class="event">
|
||||
<div class="ui middle aligned divided list">
|
||||
<div class="item">
|
||||
<img class="ui avatar image" src="/static/assets/images/logo.png">
|
||||
<div class="content">
|
||||
<div class="summary">
|
||||
<a>Jiscuss</a> 一直持续更新, <a>Jiscuss</a> 一直更新完善,感谢支持!
|
||||
</div>
|
||||
<a class="header">他的测试主题1</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="event">
|
||||
<div class="item">
|
||||
<img class="ui avatar image" src="/static/assets/images/logo.png">
|
||||
<div class="content">
|
||||
<div class="summary">
|
||||
<a>2019</a> 测试内容
|
||||
</div>
|
||||
<a class="header">他的测试主题2</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img class="ui avatar image" src="/static/assets/images/logo.png">
|
||||
<div class="content">
|
||||
<a class="header">他的测试主题3</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<button class="ui button">预留按钮</button>
|
||||
<p>预留信息</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -297,6 +278,7 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
<#if username??>
|
||||
setusername('${username}');
|
||||
console.log('已经登陆:' + username);
|
||||
</#if>
|
||||
setDiscussionsId('${discussions.id}');
|
||||
|
||||
Reference in New Issue
Block a user