wiki接口和页面
This commit is contained in:
@@ -48,7 +48,7 @@ public class WikiPageCommentController {
|
||||
} else {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
pageComment.setCreateTime(new Date());
|
||||
pageComment.setCreateUid(currentUser.getUserId());
|
||||
pageComment.setCreateUserId(currentUser.getUserId());
|
||||
wikiPageCommentService.save(pageComment);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
|
||||
@@ -7,8 +7,11 @@ import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageContent;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageContentService;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageFileService;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageService;
|
||||
import com.zyplayer.doc.wiki.controller.vo.WikiPageContentVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -34,6 +37,8 @@ public class WikiPageController {
|
||||
WikiPageService wikiPageService;
|
||||
@Resource
|
||||
WikiPageContentService wikiPageContentService;
|
||||
@Resource
|
||||
WikiPageFileService wikiPageFileService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseJson<List<WikiPage>> list(WikiPage wikiPage) {
|
||||
@@ -47,6 +52,26 @@ public class WikiPageController {
|
||||
return DocResponseJson.ok(authList);
|
||||
}
|
||||
|
||||
@PostMapping("/detail")
|
||||
public ResponseJson<WikiPageContentVo> detail(WikiPage wikiPage) {
|
||||
WikiPage wikiPageSel = wikiPageService.getById(wikiPage.getId());
|
||||
|
||||
UpdateWrapper<WikiPageContent> wrapper = new UpdateWrapper<>();
|
||||
wrapper.eq("page_id", wikiPage.getId());
|
||||
WikiPageContent pageContent = wikiPageContentService.getOne(wrapper);
|
||||
|
||||
UpdateWrapper<WikiPageFile> wrapperFile = new UpdateWrapper<>();
|
||||
wrapperFile.eq("page_id", wikiPage.getId());
|
||||
wrapper.eq("del_flag", 0);
|
||||
List<WikiPageFile> pageFiles = wikiPageFileService.list(wrapperFile);
|
||||
|
||||
WikiPageContentVo vo = new WikiPageContentVo();
|
||||
vo.setWikiPage(wikiPageSel);
|
||||
vo.setPageContent(pageContent);
|
||||
vo.setFileList(pageFiles);
|
||||
return DocResponseJson.ok(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ResponseJson<Object> update(WikiPage wikiPage, String content) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
@@ -56,24 +81,25 @@ public class WikiPageController {
|
||||
Long id = wikiPage.getId();
|
||||
if (id != null && id > 0) {
|
||||
wikiPage.setUpdateTime(new Date());
|
||||
wikiPage.setUpdateUid(currentUser.getUserId());
|
||||
wikiPage.setUpdateUserId(currentUser.getUserId());
|
||||
wikiPageService.updateById(wikiPage);
|
||||
// 详情
|
||||
pageContent.setUpdateTime(new Date());
|
||||
pageContent.setUpdateUid(currentUser.getUserId());
|
||||
pageContent.setUpdateUserId(currentUser.getUserId());
|
||||
UpdateWrapper<WikiPageContent> wrapper = new UpdateWrapper<>();
|
||||
wrapper.eq("page_id", id);
|
||||
wikiPageContentService.update(pageContent, wrapper);
|
||||
} else {
|
||||
wikiPage.setCreateTime(new Date());
|
||||
wikiPage.setCreateUid(currentUser.getUserId());
|
||||
wikiPage.setCreateUserId(currentUser.getUserId());
|
||||
wikiPageService.save(wikiPage);
|
||||
// 详情
|
||||
pageContent.setPageId(wikiPage.getId());
|
||||
pageContent.setCreateTime(new Date());
|
||||
pageContent.setCreateUid(currentUser.getUserId());
|
||||
pageContent.setCreateUserId(currentUser.getUserId());
|
||||
wikiPageContentService.save(pageContent);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
return DocResponseJson.ok(wikiPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WikiPageFileController {
|
||||
} else {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
wikiPageFile.setCreateTime(new Date());
|
||||
wikiPageFile.setCreateUid(currentUser.getUserId());
|
||||
wikiPageFile.setCreateUserId(currentUser.getUserId());
|
||||
wikiPageFileService.save(wikiPageFile);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
|
||||
@@ -52,7 +52,7 @@ public class WikiPageZanController {
|
||||
return DocResponseJson.warn("您已经赞过了哦~");
|
||||
}
|
||||
wikiPageZan.setCreateTime(new Date());
|
||||
wikiPageZan.setCreateUid(currentUser.getUserId());
|
||||
wikiPageZan.setCreateUserId(currentUser.getUserId());
|
||||
wikiPageZanService.save(wikiPageZan);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class WikiSpaceController {
|
||||
wrapper.in("type", 1, 2);
|
||||
} else if(wikiSpace.getType() == 1 || wikiSpace.getType() == 2) {
|
||||
wrapper.eq(wikiSpace.getType() != null, "type", wikiSpace.getType());
|
||||
wrapper.eq(Objects.equals(wikiSpace.getType(), 2), "create_uid", wikiSpace.getCreateUid());
|
||||
wrapper.eq(Objects.equals(wikiSpace.getType(), 2), "create_uid", wikiSpace.getCreateUserId());
|
||||
} else if(wikiSpace.getType() == 3) {
|
||||
wrapper.eq("create_uid", currentUser.getUserId());
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class WikiSpaceController {
|
||||
} else {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
wikiSpace.setCreateTime(new Date());
|
||||
wikiSpace.setCreateUid(currentUser.getUserId());
|
||||
wikiSpace.setCreateUserId(currentUser.getUserId());
|
||||
wikiSpaceService.save(wikiSpace);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zyplayer.doc.wiki.controller.vo;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageContent;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WikiPageContentVo {
|
||||
private WikiPage wikiPage;
|
||||
private WikiPageContent pageContent;
|
||||
private List<WikiPageFile> fileList;
|
||||
|
||||
public WikiPage getWikiPage() {
|
||||
return wikiPage;
|
||||
}
|
||||
|
||||
public void setWikiPage(WikiPage wikiPage) {
|
||||
this.wikiPage = wikiPage;
|
||||
}
|
||||
|
||||
public WikiPageContent getPageContent() {
|
||||
return pageContent;
|
||||
}
|
||||
|
||||
public void setPageContent(WikiPageContent pageContent) {
|
||||
this.pageContent = pageContent;
|
||||
}
|
||||
|
||||
public List<WikiPageFile> getFileList() {
|
||||
return fileList;
|
||||
}
|
||||
|
||||
public void setFileList(List<WikiPageFile> fileList) {
|
||||
this.fileList = fileList;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/webjars/doc-wiki/lib/wangEditor/wangEditor.min.css
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/webjars/doc-wiki/lib/wangEditor/wangEditor.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4
zyplayer-doc-wiki/src/main/resources/webjars/doc-wiki/lib/wangEditor/wangEditor.min.js
vendored
Normal file
4
zyplayer-doc-wiki/src/main/resources/webjars/doc-wiki/lib/wangEditor/wangEditor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user