diff --git a/upgrade.properties b/upgrade.properties new file mode 100644 index 00000000..9aebea2e --- /dev/null +++ b/upgrade.properties @@ -0,0 +1,6 @@ +# 本文件用于已部署好的系统检测自己是否需要升级使用 +lastVersion=1.0.1 +upgradeContent=1、增加wiki文档模块;2、dubbo文档支持使用元数据生成参数和返回值;3、框架进行了大的拆分;4、增加升级通知;5、细节优化; +upgradeUrl= +nextStep= + diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/entity/WikiPageFile.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/entity/WikiPageFile.java index d303b9c7..c3a47b62 100644 --- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/entity/WikiPageFile.java +++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/entity/WikiPageFile.java @@ -12,7 +12,7 @@ import java.util.Date; *

* * @author 鏆厜锛氬煄涓煄 - * @since 2019-02-24 + * @since 2019-03-06 */ public class WikiPageFile implements Serializable { @@ -39,6 +39,11 @@ public class WikiPageFile implements Serializable { */ private String fileUrl; + /** + * 鏂囦欢UUID + */ + private String uuid; + /** * 鍒涘缓浜篒D */ @@ -102,6 +107,13 @@ public class WikiPageFile implements Serializable { public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl; } + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } public Long getCreateUserId() { return createUserId; } @@ -159,6 +171,7 @@ public class WikiPageFile implements Serializable { ", pageId=" + pageId + ", fileName=" + fileName + ", fileUrl=" + fileUrl + + ", uuid=" + uuid + ", createUserId=" + createUserId + ", createUserName=" + createUserName + ", createTime=" + createTime + diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/mapper/WikiPageFileMapper.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/mapper/WikiPageFileMapper.java index 1451a75b..986cbdf4 100644 --- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/mapper/WikiPageFileMapper.java +++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/manage/mapper/WikiPageFileMapper.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; *

* * @author 鏆厜锛氬煄涓煄 - * @since 2019-02-24 + * @since 2019-03-06 */ public interface WikiPageFileMapper extends BaseMapper { diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/support/generator/CodeGenerator.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/support/generator/CodeGenerator.java index 3a857a12..94880a7e 100644 --- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/support/generator/CodeGenerator.java +++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/repository/support/generator/CodeGenerator.java @@ -19,7 +19,7 @@ public class CodeGenerator { final String moduleName = "manage"; // 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_page" }; + final String[] tableName = { "wiki_page_file" }; // 浠g爜鐢熸垚鍣 AutoGenerator mpg = new AutoGenerator(); diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/WikiPageFileService.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/WikiPageFileService.java index 46972102..6676ace4 100644 --- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/WikiPageFileService.java +++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/WikiPageFileService.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService; *

* * @author 鏆厜锛氬煄涓煄 - * @since 2019-02-24 + * @since 2019-03-06 */ public interface WikiPageFileService extends IService { diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageFileServiceImpl.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageFileServiceImpl.java index f744bbb0..4844b599 100644 --- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageFileServiceImpl.java +++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageFileServiceImpl.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Service; *

* * @author 鏆厜锛氬煄涓煄 - * @since 2019-02-24 + * @since 2019-03-06 */ @Service public class WikiPageFileServiceImpl extends ServiceImpl implements WikiPageFileService { diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageZanServiceImpl.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageZanServiceImpl.java index 008a4ed9..1af3bc2e 100644 --- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageZanServiceImpl.java +++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/WikiPageZanServiceImpl.java @@ -47,6 +47,7 @@ public class WikiPageZanServiceImpl extends ServiceImpl娴嬭瘯1娴嬭瘯1娴嬭瘯1娴嬭瘯1娴嬭瘯1

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); -INSERT INTO `wiki_page_content` VALUES (2, 8, '

娴嬭瘯2娴嬭瘯2娴嬭瘯2娴嬭瘯2

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); +INSERT INTO `wiki_page_content` VALUES (2, 8, '

娴嬭瘯2娴嬭瘯2娴嬭瘯2娴嬭瘯2fasfafafdsafasfxxxxxxxxxxxxdsadsadsadasdasd

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-03-06 09:25:29'); INSERT INTO `wiki_page_content` VALUES (3, 9, '

娴嬭瘯3娴嬭瘯3娴嬭瘯3娴嬭瘯3娴嬭瘯3

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); INSERT INTO `wiki_page_content` VALUES (4, 10, '

娴嬭瘯4娴嬭瘯4娴嬭瘯4娴嬭瘯4娴嬭瘯4

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); INSERT INTO `wiki_page_content` VALUES (5, 11, '

娴嬭瘯5娴嬭瘯5娴嬭瘯5娴嬭瘯5

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); INSERT INTO `wiki_page_content` VALUES (6, 12, '

娴嬭瘯6娴嬭瘯6娴嬭瘯6娴嬭瘯6娴嬭瘯6

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); -INSERT INTO `wiki_page_content` VALUES (7, 13, '

娆㈣繋浣跨敤 wangEditor 瀵屾枃鏈紪杈戝櫒

娴嬭瘯7

', 1, NULL, '2019-02-24 17:51:56', NULL, NULL, '2019-02-24 17:51:56'); +INSERT INTO `wiki_page_content` VALUES (7, 13, '

娴嬭瘯7娴嬭瘯7娴嬭瘯7娴嬭瘯7

', 1, NULL, '2019-02-24 17:51:56', NULL, NULL, '2019-02-24 17:51:56'); INSERT INTO `wiki_page_content` VALUES (8, 14, '

娴嬭瘯7 娴嬭瘯7娴嬭瘯7娴嬭瘯7 

', 1, NULL, '2019-02-24 17:51:56', 1, NULL, '2019-02-24 17:51:56'); -- ---------------------------- @@ -189,6 +184,7 @@ CREATE TABLE `wiki_page_file` ( `page_id` bigint(20) NULL DEFAULT NULL COMMENT '椤甸潰ID', `file_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚', `file_url` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '鏂囦欢URL', + `uuid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏂囦欢UUID', `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D', `create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜哄悕瀛', `create_time` datetime(0) NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿', @@ -196,13 +192,9 @@ CREATE TABLE `wiki_page_file` ( `update_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜哄悕瀛', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '淇敼鏃堕棿', `del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0=鏈夋晥 1=鍒犻櫎', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of wiki_page_file --- ---------------------------- -INSERT INTO `wiki_page_file` VALUES (1, 7, '寮鍙戣鑼.doc', 'http://www.baidu.com', 1, '鏆厜锛氬煄涓煄', '2019-02-24 17:51:56', NULL, NULL, NULL, 0); + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uk_uuid`(`uuid`) USING BTREE COMMENT '鏂囦欢ID' +) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for wiki_page_zan @@ -213,10 +205,11 @@ CREATE TABLE `wiki_page_zan` ( `page_id` bigint(20) NULL DEFAULT NULL COMMENT '椤甸潰ID', `comment_id` bigint(20) NULL DEFAULT NULL COMMENT '璇勮ID', `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D', - `create_user_name` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_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 '鍒涘缓鏃堕棿', + `yn` tinyint(4) NULL DEFAULT NULL COMMENT '鏄惁鏈夋晥 0=鏃犳晥 1=鏈夋晥', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for wiki_space @@ -228,10 +221,10 @@ CREATE TABLE `wiki_space` ( `type` tinyint(4) NULL DEFAULT 1 COMMENT '绌洪棿绫诲瀷 1=鍏徃 2=涓汉 3=绉佷汉', `explain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎻忚堪', `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D', - `create_user_name` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_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 '鍒涘缓鏃堕棿', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of wiki_space @@ -250,9 +243,10 @@ CREATE TABLE `zyplayer_storage` ( `update_time` datetime(0) NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `key`(`doc_key`) USING BTREE COMMENT 'key鍞竴绱㈠紩' -) ENGINE = InnoDB AUTO_INCREMENT = 43 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; diff --git a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiCommonController.java b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiCommonController.java index 05b667f8..399aa33e 100644 --- a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiCommonController.java +++ b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiCommonController.java @@ -2,12 +2,14 @@ package com.zyplayer.doc.wiki.controller; import cn.hutool.core.date.DateTime; import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.zyplayer.doc.core.json.DocResponseJson; import com.zyplayer.doc.core.json.ResponseJson; import com.zyplayer.doc.data.config.security.DocUserDetails; import com.zyplayer.doc.data.config.security.DocUserUtil; import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile; import com.zyplayer.doc.data.service.manage.WikiPageFileService; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -43,7 +45,6 @@ public class WikiCommonController { @PostMapping("/upload") public ResponseJson upload(WikiPageFile wikiPageFile, @RequestParam("files") MultipartFile file) { - //閫氳繃CommonsMultipartFile鐨勬柟娉曠洿鎺ュ啓鏂囦欢锛堟敞鎰忚繖涓椂鍊欙級 String fileName = file.getOriginalFilename(); String fileSuffix = ""; if (fileName != null && fileName.lastIndexOf(".") >= 0) { @@ -55,7 +56,8 @@ public class WikiCommonController { if (!newFile.exists() && !newFile.mkdir()) { return DocResponseJson.warn("鍒涘缓鏂囦欢澶瑰け璐"); } - path += RandomUtil.simpleUUID() + fileSuffix; + String simpleUUID = RandomUtil.simpleUUID(); + path += simpleUUID + fileSuffix; newFile = new File(path); try { file.transferTo(newFile); @@ -63,6 +65,7 @@ public class WikiCommonController { e.printStackTrace(); return DocResponseJson.warn("淇濆瓨鏂囦欢澶辫触"); } + wikiPageFile.setUuid(simpleUUID); wikiPageFile.setFileUrl(path); wikiPageFile.setFileName(fileName); wikiPageFile.setCreateTime(new Date()); @@ -70,16 +73,18 @@ public class WikiCommonController { wikiPageFile.setCreateUserName(currentUser.getUsername()); wikiPageFile.setDelFlag(0); wikiPageFileService.save(wikiPageFile); - wikiPageFile.setFileUrl("zyplayer-doc-wiki/common/file?fileId=" + wikiPageFile.getId()); + wikiPageFile.setFileUrl("zyplayer-doc-wiki/common/file?uuid=" + wikiPageFile.getUuid()); return DocResponseJson.ok(wikiPageFile); } @GetMapping("/file") - public ResponseJson file(Long fileId, HttpServletResponse response) { - if (fileId == null || fileId <= 0) { + public ResponseJson file(String uuid, HttpServletResponse response) { + if (StringUtils.isBlank(uuid)) { return DocResponseJson.warn("璇锋寚瀹氭枃浠禝D"); } - WikiPageFile pageFile = wikiPageFileService.getById(fileId); + UpdateWrapper wrapperFile = new UpdateWrapper<>(); + wrapperFile.eq("uuid", uuid); + WikiPageFile pageFile = wikiPageFileService.getOne(wrapperFile); if (pageFile == null) { return DocResponseJson.warn("鏈壘鍒版寚瀹氭枃浠"); } diff --git a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageCommentController.java b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageCommentController.java index 5cd8d003..b71b54eb 100644 --- a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageCommentController.java +++ b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageCommentController.java @@ -49,9 +49,10 @@ public class WikiPageCommentController { DocUserDetails currentUser = DocUserUtil.getCurrentUser(); pageComment.setCreateTime(new Date()); pageComment.setCreateUserId(currentUser.getUserId()); + pageComment.setCreateUserName(currentUser.getUsername()); wikiPageCommentService.save(pageComment); } - return DocResponseJson.ok(); + return DocResponseJson.ok(pageComment); } } diff --git a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java index 498aaeaf..c11dbae2 100644 --- a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java +++ b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java @@ -71,7 +71,7 @@ public class WikiPageController { wrapperFile.eq("del_flag", 0); List pageFiles = wikiPageFileService.list(wrapperFile); for (WikiPageFile pageFile : pageFiles) { - pageFile.setFileUrl("zyplayer-doc-wiki/common/file?fileId=" + pageFile.getId()); + pageFile.setFileUrl("zyplayer-doc-wiki/common/file?uuid=" + pageFile.getUuid()); } UpdateWrapper wrapperZan = new UpdateWrapper<>(); wrapperZan.eq("page_id", wikiPage.getId()); diff --git a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageFileController.java b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageFileController.java index 1a3a2912..e262955e 100644 --- a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageFileController.java +++ b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageFileController.java @@ -1,12 +1,19 @@ package com.zyplayer.doc.wiki.controller; +import com.zyplayer.doc.core.json.DocResponseJson; +import com.zyplayer.doc.core.json.ResponseJson; +import com.zyplayer.doc.data.config.security.DocUserDetails; +import com.zyplayer.doc.data.config.security.DocUserUtil; +import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile; import com.zyplayer.doc.data.service.manage.WikiPageFileService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.Date; /** * 鏂囨。鎺у埗鍣 @@ -30,23 +37,27 @@ public class WikiPageFileController { // wrapper.eq("page_id", wikiPageFile.getPageId()); // List fileList = wikiPageFileService.list(wrapper); // for (WikiPageFile pageFile : fileList) { -// pageFile.setFileUrl("zyplayer-doc-wiki/common/file?fileId=" + pageFile.getId()); +// pageFile.setFileUrl("zyplayer-doc-wiki/common/file?uuid=" + pageFile.getUuid()); // } // return DocResponseJson.ok(fileList); // } // -// @PostMapping("/update") -// public ResponseJson update(WikiPageFile wikiPageFile) { -// Long id = wikiPageFile.getId(); -// if (id != null && id > 0) { -// wikiPageFileService.updateById(wikiPageFile); -// } else { -// DocUserDetails currentUser = DocUserUtil.getCurrentUser(); -// wikiPageFile.setCreateTime(new Date()); -// wikiPageFile.setCreateUserId(currentUser.getUserId()); -// wikiPageFileService.save(wikiPageFile); -// } -// return DocResponseJson.ok(); -// } + @PostMapping("/update") + public ResponseJson update(WikiPageFile wikiPageFile) { + DocUserDetails currentUser = DocUserUtil.getCurrentUser(); + Long id = wikiPageFile.getId(); + if (id != null && id > 0) { + wikiPageFile.setUpdateUserId(currentUser.getUserId()); + wikiPageFile.setUpdateUserName(currentUser.getUsername()); + wikiPageFile.setUpdateTime(new Date()); + wikiPageFileService.updateById(wikiPageFile); + } else { + wikiPageFile.setCreateTime(new Date()); + wikiPageFile.setCreateUserId(currentUser.getUserId()); + wikiPageFile.setCreateUserName(currentUser.getUsername()); + wikiPageFileService.save(wikiPageFile); + } + return DocResponseJson.ok(); + } } diff --git a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageZanController.java b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageZanController.java index 24bc408e..83615c21 100644 --- a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageZanController.java +++ b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageZanController.java @@ -1,5 +1,6 @@ package com.zyplayer.doc.wiki.controller; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.zyplayer.doc.core.json.DocResponseJson; import com.zyplayer.doc.core.json.ResponseJson; import com.zyplayer.doc.data.repository.manage.entity.WikiPageZan; @@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.List; /** * 鏂囨。鎺у埗鍣 @@ -26,14 +28,14 @@ public class WikiPageZanController { @Resource WikiPageZanService wikiPageZanService; -// @PostMapping("/list") -// public ResponseJson> list(WikiPageZan wikiPageZan) { -// UpdateWrapper wrapper = new UpdateWrapper<>(); -// wrapper.eq("page_id", wikiPageZan.getPageId()); -// wrapper.eq(wikiPageZan.getCommentId() != null, "comment_id", wikiPageZan.getCommentId()); -// List zanList = wikiPageZanService.list(wrapper); -// return DocResponseJson.ok(zanList); -// } + @PostMapping("/list") + public ResponseJson> list(WikiPageZan wikiPageZan) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("page_id", wikiPageZan.getPageId()); + wrapper.eq(wikiPageZan.getCommentId() != null, "comment_id", wikiPageZan.getCommentId()); + List zanList = wikiPageZanService.list(wrapper); + return DocResponseJson.ok(zanList); + } @PostMapping("/update") public ResponseJson update(WikiPageZan wikiPageZan) { diff --git a/zyplayer-doc-wiki/src/main/resources/doc-wiki.html b/zyplayer-doc-wiki/src/main/resources/doc-wiki.html index a2b902e5..74a2ed28 100644 --- a/zyplayer-doc-wiki/src/main/resources/doc-wiki.html +++ b/zyplayer-doc-wiki/src/main/resources/doc-wiki.html @@ -28,7 +28,6 @@
- {{wikiPage.name}}
缂栬緫 @@ -49,6 +48,7 @@ class="upload-page-file" action="zyplayer-doc-wiki/common/upload" :on-success="uploadFileSuccess" + :on-error="uploadFileError" name="files" show-file-list multiple @@ -66,12 +66,17 @@ + + +
-
+
@@ -84,6 +89,13 @@ 鎴戝拰{{wikiPage.zanNum-1}}涓叾浠栦汉璧炰簡瀹
+
+
璇勮鍒楄〃锛
+
+
{{item.createUserName}}锛
{{item.createTime}}
+
銆{{item.content}}
+
+
@@ -105,6 +117,13 @@ + + + + + + + @@ -155,6 +174,7 @@ // 鎼滅储鐨勮緭鍏ュ唴瀹 searchKeywords: "", lastClickNode: {}, + // 缂栬緫鐩稿叧 newPageId: "", newPageTitle: "", // 椤甸潰灞曠ず鐩稿叧 @@ -163,8 +183,11 @@ pageFileList: [], uploadFileList: [], uploadFormData: {pageId: 0}, + zanUserDialogVisible: false, + zanUserList: [], // 璇勮鐩稿叧 - commentTextInput: "" + commentTextInput: "", + commentList: [], } }, watch: { @@ -185,14 +208,46 @@ }); }, showZanPageUser() { - + app.zanUserDialogVisible = true; + app.zanUserList = []; + var param = {pageId: app.wikiPage.id}; + ajaxTemp("zyplayer-doc-wiki/page/zan/list", "post", "json", param, function (json) { + if (validateResult(json)) { + app.zanUserList = json.data; + } + }); }, submitPageComment() { - Toast.success(app.commentTextInput); + var param = {pageId: app.wikiPage.id, content: app.commentTextInput}; + ajaxTemp("zyplayer-doc-wiki/page/comment/update", "post", "json", param, function (json) { + if (validateResult(json)) { + app.commentTextInput = ""; + app.commentList.push(json.data); + } + }); + }, + uploadFileError(err) { + Toast.success("涓婁紶澶辫触锛" + err); }, uploadFileSuccess(response) { - app.pageFileList.push(response.data); - Toast.success("涓婁紶鎴愬姛锛"); + if (validateResult(response)) { + app.pageFileList.push(response.data); + Toast.success("涓婁紶鎴愬姛锛"); + } + }, + deletePageFile(row) { + var param = {id: row.id, delFlag: 1}; + ajaxTemp("zyplayer-doc-wiki/page/file/update", "post", "json", param, function (json) { + if (validateResult(json)) { + var pageFileList = []; + for (var i = 0; i < app.pageFileList.length; i++) { + if (app.pageFileList[i].id != row.id) { + pageFileList.push(app.pageFileList[i]); + } + } + app.pageFileList = pageFileList; + } + }); }, editWiki() { this.rightContentType = 2; @@ -200,18 +255,20 @@ this.newPageTitle = app.wikiPage.name; page.newPageContentEditor.txt.html(app.pageContent.content || ""); }, - createWiki(){ + createWiki() { this.newPageId = ""; + this.newPageTitle = ""; + page.newPageContentEditor.txt.html(""); this.rightContentType = 2; }, - createWikiCancel(){ + createWikiCancel() { if (isEmpty(this.lastClickNode.label)) { this.rightContentType = 0; } else { this.rightContentType = 1; } }, - createWikiSave(){ + createWikiSave() { var parentId = app.lastClickNode.id; if (this.newPageId > 0) { parentId = ""; @@ -252,6 +309,16 @@ app.uploadFormData = {pageId: app.wikiPage.id}; } }); + this.loadCommentList(pageId); + }, + loadCommentList(pageId) { + app.commentList = []; + var param = {pageId: pageId}; + ajaxTemp("zyplayer-doc-wiki/page/comment/list", "post", "json", param, function (json) { + if (validateResult(json)) { + app.commentList = json.data || []; + } + }); }, searchByKeywords() { app.pathIndex = createTreeViewByTreeWithMerge(app.dubboDocList, app.searchKeywords);