网站导航模块:新增产品文档的类型适配
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.Docs;
|
||||
import com.gxwebsoft.cms.entity.DocsBook;
|
||||
import com.gxwebsoft.cms.entity.DocsContent;
|
||||
import com.gxwebsoft.cms.param.DocsBookParam;
|
||||
import com.gxwebsoft.cms.service.DocsBookService;
|
||||
import com.gxwebsoft.cms.service.DocsContentService;
|
||||
import com.gxwebsoft.cms.service.DocsService;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
@@ -26,6 +31,10 @@ import java.util.List;
|
||||
public class DocsBookController extends BaseController {
|
||||
@Resource
|
||||
private DocsBookService docsBookService;
|
||||
@Resource
|
||||
private DocsService docsService;
|
||||
@Resource
|
||||
private DocsContentService contentService;
|
||||
|
||||
@ApiOperation("分页查询书籍记录表")
|
||||
@GetMapping("/page")
|
||||
@@ -51,7 +60,25 @@ public class DocsBookController extends BaseController {
|
||||
@ApiOperation("添加书籍记录表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody DocsBook docsBook) {
|
||||
if (docsBookService.count(new LambdaQueryWrapper<DocsBook>().eq(DocsBook::getCode,docsBook.getCode())) > 0) {
|
||||
return fail("该标识已存在");
|
||||
}
|
||||
if (docsBookService.save(docsBook)) {
|
||||
// 添加默认章节
|
||||
final Docs docs = new Docs();
|
||||
final DocsContent content = new DocsContent();
|
||||
docs.setTitle("序言");
|
||||
docs.setBookId(docsBook.getBookId());
|
||||
docsService.save(docs);
|
||||
content.setDocsId(docs.getDocsId());
|
||||
content.setContent("撰写中...");
|
||||
contentService.save(content);
|
||||
docs.setTitle("系统简介");
|
||||
docs.setBookId(docsBook.getBookId());
|
||||
docsService.save(docs);
|
||||
content.setDocsId(docs.getDocsId());
|
||||
content.setContent("撰写中...");
|
||||
contentService.save(content);
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
|
||||
@@ -120,9 +120,9 @@ public class DocsController extends BaseController {
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Docs docs) {
|
||||
if (docsService.updateById(docs)) {
|
||||
return success("修改成功");
|
||||
return success("保存成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
return fail("保存失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除文档管理记录表")
|
||||
|
||||
@@ -80,4 +80,8 @@ public class Docs implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "书籍标识")
|
||||
@TableField(exist = false)
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ public class Navigation implements Serializable {
|
||||
@ApiModelProperty(value = "表单ID")
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的知识文档")
|
||||
private String bookCode;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
SELECT a.*, b.code
|
||||
FROM cms_docs a
|
||||
LEFT JOIN cms_docs_book b ON a.book_id = b.book_id
|
||||
<where>
|
||||
<if test="param.docsId != null">
|
||||
AND a.docs_id = #{param.docsId}
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
<if test="param.pageId != null">
|
||||
AND a.page_id = #{param.pageId}
|
||||
</if>
|
||||
<if test="param.bookCode != null">
|
||||
AND a.book_code = #{param.bookCode}
|
||||
</if>
|
||||
<if test="param.active != null">
|
||||
AND a.active LIKE CONCAT('%', #{param.active}, '%')
|
||||
</if>
|
||||
|
||||
@@ -86,4 +86,8 @@ public class NavigationParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer pageId;
|
||||
|
||||
@ApiModelProperty(value = "知识文档标识")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String bookCode;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user