wiki评论和空间
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
package com.zyplayer.doc.data.repository.manage.entity;
|
package com.zyplayer.doc.data.repository.manage.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import java.util.Date;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -11,7 +12,7 @@ import java.io.Serializable;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2019-02-24
|
* @since 2019-03-07
|
||||||
*/
|
*/
|
||||||
public class WikiSpace implements Serializable {
|
public class WikiSpace implements Serializable {
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class WikiSpace implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
private String explain;
|
private String spaceExplain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人ID
|
* 创建人ID
|
||||||
@@ -74,12 +75,12 @@ public class WikiSpace implements Serializable {
|
|||||||
public void setType(Integer type) {
|
public void setType(Integer type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
public String getExplain() {
|
public String getSpaceExplain() {
|
||||||
return explain;
|
return spaceExplain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExplain(String explain) {
|
public void setSpaceExplain(String spaceExplain) {
|
||||||
this.explain = explain;
|
this.spaceExplain = spaceExplain;
|
||||||
}
|
}
|
||||||
public Long getCreateUserId() {
|
public Long getCreateUserId() {
|
||||||
return createUserId;
|
return createUserId;
|
||||||
@@ -109,7 +110,7 @@ public class WikiSpace implements Serializable {
|
|||||||
"id=" + id +
|
"id=" + id +
|
||||||
", name=" + name +
|
", name=" + name +
|
||||||
", type=" + type +
|
", type=" + type +
|
||||||
", explain=" + explain +
|
", spaceExplain=" + spaceExplain +
|
||||||
", createUserId=" + createUserId +
|
", createUserId=" + createUserId +
|
||||||
", createUserName=" + createUserName +
|
", createUserName=" + createUserName +
|
||||||
", createTime=" + createTime +
|
", createTime=" + createTime +
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2019-02-24
|
* @since 2019-03-07
|
||||||
*/
|
*/
|
||||||
public interface WikiSpaceMapper extends BaseMapper<WikiSpace> {
|
public interface WikiSpaceMapper extends BaseMapper<WikiSpace> {
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class CodeGenerator {
|
|||||||
final String moduleName = "manage";
|
final String moduleName = "manage";
|
||||||
// final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info" };
|
// final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info" };
|
||||||
// final String[] tableName = { "wiki_space", "wiki_page", "wiki_page_content", "wiki_page_file", "wiki_page_comment", "wiki_page_zan" };
|
// final String[] tableName = { "wiki_space", "wiki_page", "wiki_page_content", "wiki_page_file", "wiki_page_comment", "wiki_page_zan" };
|
||||||
final String[] tableName = { "wiki_page_file" };
|
final String[] tableName = { "wiki_space" };
|
||||||
|
|
||||||
// 代码生成器
|
// 代码生成器
|
||||||
AutoGenerator mpg = new AutoGenerator();
|
AutoGenerator mpg = new AutoGenerator();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2019-02-24
|
* @since 2019-03-07
|
||||||
*/
|
*/
|
||||||
public interface WikiSpaceService extends IService<WikiSpace> {
|
public interface WikiSpaceService extends IService<WikiSpace> {
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 暮光:城中城
|
* @author 暮光:城中城
|
||||||
* @since 2019-02-24
|
* @since 2019-03-07
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WikiSpaceServiceImpl extends ServiceImpl<WikiSpaceMapper, WikiSpace> implements WikiSpaceService {
|
public class WikiSpaceServiceImpl extends ServiceImpl<WikiSpaceMapper, WikiSpace> implements WikiSpaceService {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class DocDetailsServiceImpl implements UserDetailsService {
|
|||||||
List<UserAuth> userAuthList = userAuthService.list(authWrapper);
|
List<UserAuth> userAuthList = userAuthService.list(authWrapper);
|
||||||
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
|
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
|
||||||
if (userAuthList != null && userAuthList.size() > 0) {
|
if (userAuthList != null && userAuthList.size() > 0) {
|
||||||
List<Long> authIdList = userAuthList.stream().collect(Collectors.mapping(UserAuth::getAuthId, Collectors.toList()));
|
List<Long> authIdList = userAuthList.stream().map(UserAuth::getAuthId).collect(Collectors.toList());
|
||||||
Collection<AuthInfo> authInfoList = authInfoService.listByIds(authIdList);
|
Collection<AuthInfo> authInfoList = authInfoService.listByIds(authIdList);
|
||||||
authInfoList.forEach(val -> {
|
authInfoList.forEach(val -> {
|
||||||
authorities.add(new SimpleGrantedAuthority(val.getAuthName()));
|
authorities.add(new SimpleGrantedAuthority(val.getAuthName()));
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
Target Server Version : 50724
|
Target Server Version : 50724
|
||||||
File Encoding : 65001
|
File Encoding : 65001
|
||||||
|
|
||||||
Date: 06/03/2019 19:00:24
|
Date: 07/03/2019 20:06:40
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
@@ -121,12 +121,12 @@ CREATE TABLE `wiki_page` (
|
|||||||
-- Records of wiki_page
|
-- Records of wiki_page
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `wiki_page` VALUES (7, 1, '测试1', NULL, 0, 1, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
INSERT INTO `wiki_page` VALUES (7, 1, '测试1', NULL, 0, 1, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
||||||
INSERT INTO `wiki_page` VALUES (8, 1, '测试2', NULL, 0, 3, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-03-06 09:25:29', 0);
|
INSERT INTO `wiki_page` VALUES (8, 1, '测试2', NULL, 0, 4, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-03-06 09:25:29', 0);
|
||||||
INSERT INTO `wiki_page` VALUES (9, 1, '测试3', 7, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
INSERT INTO `wiki_page` VALUES (9, 1, '测试3', 7, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
||||||
INSERT INTO `wiki_page` VALUES (10, 1, '测试4', 7, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
INSERT INTO `wiki_page` VALUES (10, 1, '测试4', 7, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
||||||
INSERT INTO `wiki_page` VALUES (11, 1, '测试5', 9, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
INSERT INTO `wiki_page` VALUES (11, 1, '测试5', 9, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
||||||
INSERT INTO `wiki_page` VALUES (12, 1, '测试6', 7, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
INSERT INTO `wiki_page` VALUES (12, 1, '测试6', 7, 0, 0, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
||||||
INSERT INTO `wiki_page` VALUES (14, 1, '测试7', NULL, 0, 1, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
INSERT INTO `wiki_page` VALUES (14, 1, '测试7', NULL, 0, 2, 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56', 0);
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for wiki_page_comment
|
-- Table structure for wiki_page_comment
|
||||||
@@ -143,7 +143,17 @@ CREATE TABLE `wiki_page_comment` (
|
|||||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0=有效 1=删除',
|
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0=有效 1=删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of wiki_page_comment
|
||||||
|
-- ----------------------------
|
||||||
|
INSERT INTO `wiki_page_comment` VALUES (11, 14, NULL, '阿斯顿撒多撒多撒多撒大所多', 0, 1, '暮光:城中城', '2019-03-07 10:47:05', 0);
|
||||||
|
INSERT INTO `wiki_page_comment` VALUES (12, 14, NULL, '阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多', 0, 1, '暮光:城中城', '2019-03-07 12:53:07', 0);
|
||||||
|
INSERT INTO `wiki_page_comment` VALUES (13, 14, 12, '大声道撒大所大所', 0, 1, '暮光:城中城', '2019-03-07 13:01:49', 0);
|
||||||
|
INSERT INTO `wiki_page_comment` VALUES (14, 14, NULL, '大声道撒大所大所\n大声道撒大所大所\n大声道撒大所大所', 0, 1, '暮光:城中城', '2019-03-07 13:11:02', 0);
|
||||||
|
INSERT INTO `wiki_page_comment` VALUES (15, 14, 12, '大声道撒大所大所\n大声道撒大所大所\n大声道撒大所大所', 0, 1, '暮光:城中城', '2019-03-07 13:11:12', 0);
|
||||||
|
INSERT INTO `wiki_page_comment` VALUES (16, 14, 12, '阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多阿斯顿撒多撒多撒多撒大所多', 0, 1, '暮光:城中城', '2019-03-07 13:11:27', 0);
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for wiki_page_content
|
-- Table structure for wiki_page_content
|
||||||
@@ -194,7 +204,11 @@ CREATE TABLE `wiki_page_file` (
|
|||||||
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0=有效 1=删除',
|
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0=有效 1=删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE INDEX `uk_uuid`(`uuid`) USING BTREE COMMENT '文件ID'
|
UNIQUE INDEX `uk_uuid`(`uuid`) USING BTREE COMMENT '文件ID'
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of wiki_page_file
|
||||||
|
-- ----------------------------
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for wiki_page_zan
|
-- Table structure for wiki_page_zan
|
||||||
@@ -209,7 +223,13 @@ CREATE TABLE `wiki_page_zan` (
|
|||||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
`yn` tinyint(4) NULL DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
|
`yn` tinyint(4) NULL DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of wiki_page_zan
|
||||||
|
-- ----------------------------
|
||||||
|
INSERT INTO `wiki_page_zan` VALUES (7, 8, NULL, 1, '暮光:城中城', '2019-03-06 19:04:26', 1);
|
||||||
|
INSERT INTO `wiki_page_zan` VALUES (8, 14, NULL, 1, '暮光:城中城', '2019-03-07 10:32:18', 1);
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for wiki_space
|
-- Table structure for wiki_space
|
||||||
@@ -219,7 +239,7 @@ CREATE TABLE `wiki_space` (
|
|||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||||
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '空间名',
|
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '空间名',
|
||||||
`type` tinyint(4) NULL DEFAULT 1 COMMENT '空间类型 1=公司 2=个人 3=私人',
|
`type` tinyint(4) NULL DEFAULT 1 COMMENT '空间类型 1=公司 2=个人 3=私人',
|
||||||
`explain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
|
`space_explain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
|
||||||
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
|
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
|
||||||
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
|
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
|
||||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
@@ -245,8 +265,4 @@ CREATE TABLE `zyplayer_storage` (
|
|||||||
UNIQUE INDEX `key`(`doc_key`) USING BTREE COMMENT 'key唯一索引'
|
UNIQUE INDEX `key`(`doc_key`) USING BTREE COMMENT 'key唯一索引'
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '存储网页上相关的数据' ROW_FORMAT = Compact;
|
) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '存储网页上相关的数据' ROW_FORMAT = Compact;
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of zyplayer_storage
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.zyplayer.doc.data.config.security.DocUserDetails;
|
|||||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageComment;
|
import com.zyplayer.doc.data.repository.manage.entity.WikiPageComment;
|
||||||
import com.zyplayer.doc.data.service.manage.WikiPageCommentService;
|
import com.zyplayer.doc.data.service.manage.WikiPageCommentService;
|
||||||
|
import com.zyplayer.doc.wiki.controller.vo.WikiPageCommentVo;
|
||||||
|
import org.dozer.Mapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -16,6 +18,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文档控制器
|
* 文档控制器
|
||||||
@@ -30,14 +34,23 @@ public class WikiPageCommentController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
WikiPageCommentService wikiPageCommentService;
|
WikiPageCommentService wikiPageCommentService;
|
||||||
|
@Resource
|
||||||
|
Mapper mapper;
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public ResponseJson<List<WikiPageComment>> list(WikiPageComment wikiPageComment) {
|
public ResponseJson<List<WikiPageCommentVo>> list(WikiPageComment wikiPageComment) {
|
||||||
UpdateWrapper<WikiPageComment> wrapper = new UpdateWrapper<>();
|
UpdateWrapper<WikiPageComment> wrapper = new UpdateWrapper<>();
|
||||||
wrapper.eq("page_id", wikiPageComment.getPageId());
|
wrapper.eq("page_id", wikiPageComment.getPageId());
|
||||||
wrapper.eq(wikiPageComment.getParentId() != null, "parent_id", wikiPageComment.getParentId());
|
wrapper.eq(wikiPageComment.getParentId() != null, "parent_id", wikiPageComment.getParentId());
|
||||||
List<WikiPageComment> authList = wikiPageCommentService.list(wrapper);
|
List<WikiPageComment> authList = wikiPageCommentService.list(wrapper);
|
||||||
return DocResponseJson.ok(authList);
|
Map<Long, List<WikiPageComment>> listMap = authList.stream().filter(val -> val.getParentId() != null)
|
||||||
|
.collect(Collectors.groupingBy(WikiPageComment::getParentId));
|
||||||
|
List<WikiPageCommentVo> commentList = authList.stream().filter(val -> val.getParentId() == null)
|
||||||
|
.map(val -> mapper.map(val, WikiPageCommentVo.class)).collect(Collectors.toList());
|
||||||
|
for (WikiPageCommentVo commentVo : commentList) {
|
||||||
|
commentVo.setCommentList(listMap.get(commentVo.getId()));
|
||||||
|
}
|
||||||
|
return DocResponseJson.ok(commentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class WikiSpaceController {
|
|||||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||||
wikiSpace.setCreateTime(new Date());
|
wikiSpace.setCreateTime(new Date());
|
||||||
wikiSpace.setCreateUserId(currentUser.getUserId());
|
wikiSpace.setCreateUserId(currentUser.getUserId());
|
||||||
|
wikiSpace.setCreateUserName(currentUser.getUsername());
|
||||||
wikiSpaceService.save(wikiSpace);
|
wikiSpaceService.save(wikiSpace);
|
||||||
}
|
}
|
||||||
return DocResponseJson.ok();
|
return DocResponseJson.ok();
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.zyplayer.doc.wiki.controller.vo;
|
||||||
|
|
||||||
|
import com.zyplayer.doc.data.repository.manage.entity.WikiPageComment;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @since 2019-02-24
|
||||||
|
*/
|
||||||
|
public class WikiPageCommentVo extends WikiPageComment {
|
||||||
|
private List<WikiPageComment> commentList;
|
||||||
|
|
||||||
|
public List<WikiPageComment> getCommentList() {
|
||||||
|
return commentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommentList(List<WikiPageComment> commentList) {
|
||||||
|
this.commentList = commentList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,19 +11,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<el-container style="height: 100%;">
|
<el-container style="height: 100%;">
|
||||||
<el-aside width="auto" style="height: 100%;">
|
<el-header>
|
||||||
<div class="logo" @click="aboutDialogVisible = true">zyplayer-doc-wiki</div>
|
<!--<div class="logo" @click="aboutDialogVisible = true">zyplayer-doc-wiki</div>-->
|
||||||
<div style="padding: 10px;">
|
|
||||||
<div align="center"><el-button type="primary" v-on:click="createWiki" icon="el-icon-plus" style="width: 100%;">创建文档</el-button></div>
|
|
||||||
<!--<el-row><el-switch v-model="isCollapse"></el-switch></el-row>-->
|
|
||||||
<el-input v-model="searchKeywords" placeholder="搜索文档" style="margin: 10px 0;">
|
|
||||||
<el-button slot="append" icon="el-icon-search" v-on:click="searchByKeywords"></el-button>
|
|
||||||
</el-input>
|
|
||||||
<el-tree :props="defaultProps" @node-click="handleNodeClick" :load="loadNodeChildren" lazy></el-tree>
|
|
||||||
</div>
|
|
||||||
</el-aside>
|
|
||||||
<el-container>
|
|
||||||
<el-header style="text-align: right;height: 50px;">
|
|
||||||
<el-dropdown @command="notOpen" trigger="click">
|
<el-dropdown @command="notOpen" trigger="click">
|
||||||
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
|
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
@@ -32,6 +21,29 @@
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-header>
|
</el-header>
|
||||||
|
<el-container>
|
||||||
|
<el-aside width="auto" style="height: 100%;">
|
||||||
|
<div style="padding: 10px;">
|
||||||
|
<!--<el-row><el-switch v-model="isCollapse"></el-switch></el-row>-->
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
|
<el-select v-model="choiceSpace" @change="spaceChangeEvents" filterable placeholder="选择空间" style="width: 100%;">
|
||||||
|
<el-option-group label="">
|
||||||
|
<el-option key="0" label="创建空间" value="0"></el-option>
|
||||||
|
</el-option-group>
|
||||||
|
<el-option-group label="已有空间">
|
||||||
|
<el-option v-for="item in spaceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
<div align="center">
|
||||||
|
<el-button v-on:click="createWiki" icon="el-icon-plus" style="width: 100%;">创建文档</el-button>
|
||||||
|
</div>
|
||||||
|
<el-input v-model="searchKeywords" placeholder="搜索文档" style="margin: 10px 0;">
|
||||||
|
<el-button slot="append" icon="el-icon-search" v-on:click="searchByKeywords"></el-button>
|
||||||
|
</el-input>
|
||||||
|
<el-tree :props="defaultProps" @node-click="handleNodeClick" :load="loadSpaceList" lazy></el-tree>
|
||||||
|
</div>
|
||||||
|
</el-aside>
|
||||||
<el-main class="doc-body-box">
|
<el-main class="doc-body-box">
|
||||||
<el-row type="border-card" v-show="rightContentType == 0">
|
<el-row type="border-card" v-show="rightContentType == 0">
|
||||||
<div style="margin-top: 30px;color: #666; text-align: center;">欢迎使用在线文档</div>
|
<div style="margin-top: 30px;color: #666; text-align: center;">欢迎使用在线文档</div>
|
||||||
@@ -100,21 +112,34 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="commentList.length > 0" class="comment-box" style="margin-top: 20px;">
|
<div v-show="commentList.length > 0" class="comment-box" style="margin-top: 20px;">
|
||||||
<div style="margin-bottom: 10px;">评论列表:</div>
|
<div style="border-bottom: 1px solid #67C23A;padding-bottom: 10px;">评论列表:</div>
|
||||||
<div v-for="(item,index) in commentList" :key="item.id" :data-id="item.id" :data-index="index" style="border-top: 1px solid #eee;padding: 10px;">
|
<div v-for="(comment,index) in commentList" :key="comment.id" :data-id="comment.id" :data-index="index" style="border-bottom: 1px solid #eee;padding: 10px;">
|
||||||
<div>
|
<div>
|
||||||
<div :style="'background-color: '+item.color" class="head">{{item.createUserName.substr(0,1)}}</div>
|
<div :style="'background-color: '+comment.color" class="head">{{comment.createUserName.substr(0,1)}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-left: 55px;">
|
<div style="padding-left: 55px;">
|
||||||
{{item.createUserName}} <span style="color: #888;font-size: 13px;">{{item.createTime}}</span>
|
{{comment.createUserName}}
|
||||||
|
<span style="color: #888;font-size: 13px;padding-left: 10px;">{{comment.createTime}}</span>
|
||||||
|
<span style="color: #888;font-size: 13px;margin-left: 10px;cursor: pointer;" @click="recommentUser(comment.id, index)">回复</span>
|
||||||
|
</div>
|
||||||
|
<pre style="padding: 10px 0 0 55px;">{{comment.content}}</pre>
|
||||||
|
<div v-for="(commentSub,indexSub) in comment.commentList" :key="commentSub.id" :data-id="commentSub.id" :data-index="indexSub" style="border-bottom: 1px solid #eee;padding: 10px;margin-left: 40px;">
|
||||||
|
<div>
|
||||||
|
<div :style="'background-color: '+commentSub.color" class="head">{{commentSub.createUserName.substr(0,1)}}</div>
|
||||||
|
</div>
|
||||||
|
<div style="padding-left: 55px;">
|
||||||
|
{{commentSub.createUserName}}
|
||||||
|
<span style="color: #888;font-size: 13px;padding-left: 10px;">{{commentSub.createTime}}</span>
|
||||||
|
</div>
|
||||||
|
<pre style="padding: 10px 0 0 55px;">{{commentSub.content}}</pre>
|
||||||
</div>
|
</div>
|
||||||
<pre style="padding: 10px 0 0 55px;">{{item.content}}</pre>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin: 20px 0 50px 0;">
|
<div style="margin: 20px 0 50px 0;">
|
||||||
<el-input type="textarea" v-model="commentTextInput" :rows="5" placeholder="请输入评论内容"></el-input>
|
<el-input type="textarea" v-model="commentTextInput" :rows="5" :placeholder="recommentInfo.placeholder || '请输入评论内容'"></el-input>
|
||||||
<div align="right" style="margin-top: 5px;">
|
<div align="right" style="margin-top: 5px;">
|
||||||
<el-button v-on:click="submitPageComment">提交评论</el-button>
|
<el-button type="primary" v-on:click="submitPageComment">提交评论</el-button>
|
||||||
|
<el-button v-on:click="cancelCommentUser">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -170,6 +195,7 @@
|
|||||||
var page = {
|
var page = {
|
||||||
newPageContentEditor: '',
|
newPageContentEditor: '',
|
||||||
colorArr: ["#67C23A", "#409EFF", "#E6A23C", "#F56C6C", "#909399", "#303133"],
|
colorArr: ["#67C23A", "#409EFF", "#E6A23C", "#F56C6C", "#909399", "#303133"],
|
||||||
|
userHeadColor: {},
|
||||||
};
|
};
|
||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
@@ -185,7 +211,11 @@
|
|||||||
label: 'label',
|
label: 'label',
|
||||||
isLeaf: 'leaf'
|
isLeaf: 'leaf'
|
||||||
},
|
},
|
||||||
wikiPageList:[],
|
// 空间搜索相关
|
||||||
|
spaceOptions: [],
|
||||||
|
spaceList:[],
|
||||||
|
choiceSpace: "",
|
||||||
|
nowSpaceId: 0,
|
||||||
// 依据目录树存储的map全局对象
|
// 依据目录树存储的map全局对象
|
||||||
treePathDataMap: new Map(),
|
treePathDataMap: new Map(),
|
||||||
// 搜索的输入内容
|
// 搜索的输入内容
|
||||||
@@ -195,6 +225,7 @@
|
|||||||
newPageId: "",
|
newPageId: "",
|
||||||
newPageTitle: "",
|
newPageTitle: "",
|
||||||
// 页面展示相关
|
// 页面展示相关
|
||||||
|
wikiPageList:[],
|
||||||
wikiPage: {},
|
wikiPage: {},
|
||||||
pageContent: {},
|
pageContent: {},
|
||||||
pageFileList: [],
|
pageFileList: [],
|
||||||
@@ -205,13 +236,13 @@
|
|||||||
// 评论相关
|
// 评论相关
|
||||||
commentTextInput: "",
|
commentTextInput: "",
|
||||||
commentList: [],
|
commentList: [],
|
||||||
|
recommentInfo: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
//this.doGetPageList();
|
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -234,12 +265,26 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
recommentUser(id, index) {
|
||||||
|
this.recommentInfo = {id: id, index: index, placeholder: '回复' + (index + 1) + '楼'};
|
||||||
|
},
|
||||||
|
cancelCommentUser() {
|
||||||
|
this.recommentInfo = {};
|
||||||
|
},
|
||||||
submitPageComment() {
|
submitPageComment() {
|
||||||
var param = {pageId: app.wikiPage.id, content: app.commentTextInput};
|
var param = {
|
||||||
|
pageId: app.wikiPage.id, content: app.commentTextInput,
|
||||||
|
parentId: app.recommentInfo.id
|
||||||
|
};
|
||||||
ajaxTemp("zyplayer-doc-wiki/page/comment/update", "post", "json", param, function (json) {
|
ajaxTemp("zyplayer-doc-wiki/page/comment/update", "post", "json", param, function (json) {
|
||||||
if (validateResult(json)) {
|
if (validateResult(json)) {
|
||||||
var data = json.data;
|
var data = json.data;
|
||||||
data.color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
var color = page.userHeadColor[data.createUserId];
|
||||||
|
if (!color) {
|
||||||
|
color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
||||||
|
page.userHeadColor[data.createUserId] = color;
|
||||||
|
}
|
||||||
|
data.color = color;
|
||||||
app.commentTextInput = "";
|
app.commentTextInput = "";
|
||||||
app.commentList.push(data);
|
app.commentList.push(data);
|
||||||
}
|
}
|
||||||
@@ -327,6 +372,39 @@
|
|||||||
app.lastClickNode = data;
|
app.lastClickNode = data;
|
||||||
this.loadPageDetail(app.lastClickNode.id);
|
this.loadPageDetail(app.lastClickNode.id);
|
||||||
},
|
},
|
||||||
|
spaceChangeEvents(data) {
|
||||||
|
app.nowSpaceId = data;
|
||||||
|
if (data == 0) {
|
||||||
|
this.$prompt('请输入空间名', '创建空间', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
}).then(({value}) => {
|
||||||
|
var param = {name: value};
|
||||||
|
ajaxTemp("zyplayer-doc-wiki/space/update", "post", "json", param, function (json) {
|
||||||
|
if (validateResult(json)) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadSpaceList(node, resolve) {
|
||||||
|
ajaxTemp("zyplayer-doc-wiki/space/list", "post", "json", {}, function (json) {
|
||||||
|
if (validateResult(json)) {
|
||||||
|
app.spaceList = json.data || [];
|
||||||
|
var spaceOptions = [];
|
||||||
|
for (var i = 0; i < app.spaceList.length; i++) {
|
||||||
|
spaceOptions.push({
|
||||||
|
label: app.spaceList[i].name, value: app.spaceList[i].id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
app.spaceOptions = spaceOptions;
|
||||||
|
if (app.spaceList.length > 0) {
|
||||||
|
app.nowSpaceId = app.spaceList[0].id;
|
||||||
|
app.loadNodeChildren(node, resolve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
loadPageDetail(pageId) {
|
loadPageDetail(pageId) {
|
||||||
app.rightContentType = 1;
|
app.rightContentType = 1;
|
||||||
var param = {id: pageId};
|
var param = {id: pageId};
|
||||||
@@ -344,12 +422,29 @@
|
|||||||
},
|
},
|
||||||
loadCommentList(pageId) {
|
loadCommentList(pageId) {
|
||||||
app.commentList = [];
|
app.commentList = [];
|
||||||
|
app.cancelCommentUser();
|
||||||
var param = {pageId: pageId};
|
var param = {pageId: pageId};
|
||||||
ajaxTemp("zyplayer-doc-wiki/page/comment/list", "post", "json", param, function (json) {
|
ajaxTemp("zyplayer-doc-wiki/page/comment/list", "post", "json", param, function (json) {
|
||||||
if (validateResult(json)) {
|
if (validateResult(json)) {
|
||||||
var commentList = json.data || [];
|
var commentList = json.data || [];
|
||||||
for (var i = 0; i < commentList.length; i++) {
|
for (var i = 0; i < commentList.length; i++) {
|
||||||
commentList[i].color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
var color = page.userHeadColor[commentList[i].createUserId];
|
||||||
|
if (!color) {
|
||||||
|
color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
||||||
|
page.userHeadColor[commentList[i].createUserId] = color;
|
||||||
|
}
|
||||||
|
commentList[i].color = color;
|
||||||
|
var subCommentList = commentList[i].commentList || [];
|
||||||
|
for (var j = 0; j < subCommentList.length; j++) {
|
||||||
|
var subItem = subCommentList[j];
|
||||||
|
var colorSub = page.userHeadColor[subItem.createUserId];
|
||||||
|
if (!colorSub) {
|
||||||
|
colorSub = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
||||||
|
page.userHeadColor[subItem.createUserId] = colorSub;
|
||||||
|
}
|
||||||
|
subItem.color = colorSub;
|
||||||
|
}
|
||||||
|
commentList[i].commentList = subCommentList;
|
||||||
}
|
}
|
||||||
app.commentList = commentList;
|
app.commentList = commentList;
|
||||||
}
|
}
|
||||||
@@ -375,7 +470,7 @@
|
|||||||
} else {
|
} else {
|
||||||
nodePath = "/";
|
nodePath = "/";
|
||||||
}
|
}
|
||||||
var param = {spaceId: 1, parentId: parentId};
|
var param = {spaceId: this.nowSpaceId, parentId: parentId};
|
||||||
ajaxTemp("zyplayer-doc-wiki/page/list", "post", "json", param, function (json) {
|
ajaxTemp("zyplayer-doc-wiki/page/list", "post", "json", param, function (json) {
|
||||||
if (validateResult(json)) {
|
if (validateResult(json)) {
|
||||||
app.wikiPageList = json.data || [];
|
app.wikiPageList = json.data || [];
|
||||||
@@ -414,19 +509,15 @@
|
|||||||
border-right: 0;
|
border-right: 0;
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
}
|
}
|
||||||
.el-header {
|
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
|
||||||
background-color: #409EFF;
|
|
||||||
color: #333;
|
|
||||||
line-height: 50px;
|
|
||||||
}
|
|
||||||
.doc-body-box{
|
.doc-body-box{
|
||||||
overflow-x: hidden;height: calc(100vh);overflow-y: auto;width: 100%;
|
overflow-x: hidden;overflow-y: auto;width: 100%;
|
||||||
padding: 10px;border-left: 1px solid #f1f1f1; box-sizing: border-box;
|
padding: 10px;border-left: 1px solid #f1f1f1; box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.el-tree{margin-right: 3px;}
|
.el-tree{margin-right: 3px;}
|
||||||
.logo{
|
.logo{
|
||||||
background: #409EFF; cursor: pointer;
|
background: #409EFF; cursor: pointer;
|
||||||
width: 100%; height:50px;line-height:50px;font-size: 25px;color: #fff;text-align: center;
|
width: 100%; height:40px;line-height:40px;font-size: 25px;color: #fff;text-align: center;
|
||||||
}
|
}
|
||||||
.wiki-title{font-size: 20px;}
|
.wiki-title{font-size: 20px;}
|
||||||
.wiki-author{font-size: 14px;padding: 10px 0;}
|
.wiki-author{font-size: 14px;padding: 10px 0;}
|
||||||
|
|||||||
Reference in New Issue
Block a user