Ver Fonte

提交代码处理文档模块功能

cxd há 8 meses atrás
pai
commit
004b795eb1
62 ficheiros alterados com 3351 adições e 548 exclusões
  1. 1 10
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  2. 109 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/DcDocumentController.java
  3. 67 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/DcTemplateController.java
  4. 89 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/DocumentCategoryController.java
  5. 65 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/ProjectController.java
  6. 78 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/TemplateCategoryController.java
  7. 0 106
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/gqy/DcDocumentController.java
  8. 18 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntityCQY.java
  9. 96 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/PageDomainGQY.java
  10. 56 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/PageGQYData.java
  11. 43 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/TableDataInfoGQY.java
  12. 37 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/TableSupportGQY.java
  13. 38 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtilsGQY.java
  14. 37 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java
  15. 15 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/Brand.java
  16. 129 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/DcTemplate.java
  17. 64 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/DcTemplateCategory.java
  18. 170 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/Document.java
  19. 69 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/DocumentCategory.java
  20. 196 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/Product.java
  21. 67 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/ProductCategory.java
  22. 103 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/Project.java
  23. 55 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/ProjectCategory.java
  24. 83 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/ProjectDocument.java
  25. 65 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/Supplier.java
  26. 78 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/TemplateCategory.java
  27. 107 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/vo/PageResult.java
  28. 59 0
      ruoyi-system/src/main/java/com/ruoyi/document/domain/vo/TemplateSearchForm.java
  29. 16 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/DcTemplateMapper.java
  30. 19 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/DocumentCategoryMapper.java
  31. 34 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/DocumentMapper.java
  32. 22 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/ProductMapper.java
  33. 15 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/ProjectDocumentMapper.java
  34. 17 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/ProjectMapper.java
  35. 26 0
      ruoyi-system/src/main/java/com/ruoyi/document/mapper/TemplateCategoryMapper.java
  36. 13 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/IDcTemplateService.java
  37. 16 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/IDocumentCategoryService.java
  38. 34 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/IDocumentService.java
  39. 17 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/IProductService.java
  40. 15 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/IProjectService.java
  41. 28 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/ITemplateCategoryService.java
  42. 165 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/impl/DcDocumentServiceImpl.java
  43. 24 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/impl/DcTemplateServiceImpl.java
  44. 55 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/impl/DocumentCategoryServiceImpl.java
  45. 4 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/impl/ProductServiceImpl.java
  46. 22 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/impl/ProjectServiceImpl.java
  47. 37 0
      ruoyi-system/src/main/java/com/ruoyi/document/service/impl/TemplateCategoryServiceImpl.java
  48. 0 123
      ruoyi-system/src/main/java/com/ruoyi/system/domain/DcDocument.java
  49. 0 61
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/DcDocumentMapper.java
  50. 0 61
      ruoyi-system/src/main/java/com/ruoyi/system/service/IDcDocumentService.java
  51. 0 96
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DcDocumentServiceImpl.java
  52. 91 0
      ruoyi-system/src/main/resources/mapper/document/ SysFileMapper.xml
  53. 97 0
      ruoyi-system/src/main/resources/mapper/document/DcDocumentMapper.xml
  54. 49 0
      ruoyi-system/src/main/resources/mapper/document/DcProductCategoryMapper.xml
  55. 71 0
      ruoyi-system/src/main/resources/mapper/document/DcTemplateMapper.xml
  56. 33 0
      ruoyi-system/src/main/resources/mapper/document/DocumentCategoryMapper.xml
  57. 114 0
      ruoyi-system/src/main/resources/mapper/document/Product.xml
  58. 81 0
      ruoyi-system/src/main/resources/mapper/document/ProjectMapper.xml
  59. 47 0
      ruoyi-system/src/main/resources/mapper/document/TemplateCategoryMapper.xml
  60. 35 0
      ruoyi-system/src/main/resources/mapper/document/TemplateMapper.xml
  61. 0 91
      ruoyi-system/src/main/resources/mapper/system/DcDocumentMapper.xml
  62. 160 0
      创建表语句.txt

+ 1 - 10
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@@ -16,15 +16,6 @@ public class RuoYiApplication
     {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(RuoYiApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
-                " .-------.       ____     __        \n" +
-                " |  _ _   \\      \\   \\   /  /    \n" +
-                " | ( ' )  |       \\  _. /  '       \n" +
-                " |(_ o _) /        _( )_ .'         \n" +
-                " | (_,_).' __  ___(_ o _)'          \n" +
-                " |  |\\ \\  |  ||   |(_,_)'         \n" +
-                " |  | \\ `'   /|   `-'  /           \n" +
-                " |  |  \\    /  \\      /           \n" +
-                " ''-'   `'-'    `-..-'              ");
+        System.out.println("(♥◠‿◠)ノ゙  瑞赢科技启动成功   ლ(´ڡ`ლ)゙  \n");
     }
 }

+ 109 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/DcDocumentController.java

@@ -0,0 +1,109 @@
+package com.ruoyi.web.controller.document;
+
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.AjaxResultCQY;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.domain.Document;
+import com.ruoyi.document.service.IDocumentService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+
+
+/**
+ * 【请填写功能名称】Controller
+ * 
+ * @author ruoyi
+ * @date 2024-10-30
+ */
+@RestController
+@RequestMapping("/document")
+public class DcDocumentController extends BaseController
+{
+
+    private static final Logger log = LoggerFactory.getLogger(DcDocumentController.class);
+
+
+    @Autowired
+    private IDocumentService documentService;
+
+    /**
+     * 创建文档
+     */
+    @PostMapping("/create")
+    @PreAuthorize("@ss.hasPermi('system:document:add')")
+    @Log(title = "文档管理", businessType = BusinessType.INSERT)
+    public AjaxResult create(HttpServletRequest request, @RequestParam(value = "file", required = false) MultipartFile file) {
+        return documentService.create(request, file);
+    }
+
+
+    /**
+     * 分页查询文档列表
+     *
+     * @param request HTTP请求对象,包含以下参数:
+     *        page: 页码(默认1)
+     *        pageSize: 每页数量(默认10)
+     *        title: 文档标题(可选)
+     *        category_id: 分类ID(可选)
+     *        user_id: 用户ID(可选)
+     * @return AjaxResult 返回结果:
+     *         status: 状态码(200成功,500失败)
+     *         message: 提示信息
+     *         data: 分页数据对象
+     */
+    @PostMapping("/pageDocument")
+    public AjaxResultCQY pageDocument(HttpServletRequest request) {
+        try {
+            // 4. 设置用户权限(非管理员只能查看自己的文档和管理员的模板)
+            LoginUser loginUser = getLoginUser();
+
+            Integer page = Convert.toInt(request.getParameter("page"), 1);
+            Integer pageSize = Convert.toInt(request.getParameter("pageSize"), 10);
+
+            // 2. 获取查询条件
+            String title = request.getParameter("title");
+            Long categoryId = Convert.toLong(request.getParameter("category_id"));
+            Long userId = loginUser.getUserId();
+
+            // 3. 构建查询对象
+            Document document = new Document();
+            document.setTitle(title);
+            document.setCategory_id(categoryId);
+            document.setUser_id(userId);
+            document.setStatus(5); // 默认查询使用中状态
+
+
+            if (!SysUser.isAdmin(loginUser.getUser().getUserId())) {
+                document.setCurrent_user_id(loginUser.getUser().getUserId());
+            }
+
+            // 5. 调用分页查询
+            PageResult pageResult = documentService.pageDocument(page, pageSize, document);
+
+            // 6. 返回成功结果
+            return AjaxResultCQY.success("查询成功", pageResult);
+
+        } catch (Exception e) {
+            log.error("查询文档列表失败", e);
+            return AjaxResultCQY.success("查询成功", new PageResult());
+        }
+    }
+
+
+}

+ 67 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/DcTemplateController.java

@@ -0,0 +1,67 @@
+package com.ruoyi.web.controller.document;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResultCQY;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.document.domain.DcTemplate;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.service.IDcTemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/template")
+public class DcTemplateController extends BaseController {
+
+    @Autowired
+    private IDcTemplateService templateService;
+
+    /**
+     * 搜索模板列表
+     * 对应Python的@require_http_methods(['POST'])
+     */
+    @PostMapping("/search")
+    @ResponseBody
+    public AjaxResultCQY search(HttpServletRequest request) {
+        // 获取表单参数
+        String name = request.getParameter("name");
+        String category_id = request.getParameter("category_id");
+        String status = request.getParameter("status");
+        String page = request.getParameter("page");
+        String page_size = request.getParameter("pageSize");
+
+        // 参数转换
+        Integer categoryId = StringUtils.isNotEmpty(category_id) ? Integer.valueOf(category_id) : null;
+        Integer statusInt = StringUtils.isNotEmpty(status) ? Integer.valueOf(status) : null;
+        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
+        Integer pageSize = StringUtils.isNotEmpty(page_size) ? Integer.valueOf(page_size) : 10;
+
+        // 分页查询
+        PageHelper.startPage(pageNum, pageSize);
+
+        List<DcTemplate> list = templateService.selectTemplateList(name, categoryId, statusInt);
+
+        // 3. 获取分页信息
+        PageInfo<DcTemplate> pageInfo = new PageInfo<>(list);
+
+        // 4. 封装并返回结果
+        PageResult PageResult=  new PageResult(
+                pageInfo.getPageNum(),
+                pageInfo.getPageSize(),
+                pageInfo.getPages(),
+                pageInfo.getTotal(),
+                pageInfo.getList());
+
+        return AjaxResultCQY.success("查询成功", PageResult);
+    }
+
+}

+ 89 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/DocumentCategoryController.java

@@ -0,0 +1,89 @@
+package com.ruoyi.web.controller.document;
+
+/**
+ *
+ */
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.AjaxResultCQY;
+import com.ruoyi.document.domain.DocumentCategory;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.service.IDocumentCategoryService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+
+@RestController
+@RequestMapping("/document")
+public class DocumentCategoryController extends BaseController {
+
+    private static final Logger log = LoggerFactory.getLogger(DocumentCategoryController.class);
+
+    @Autowired
+    private IDocumentCategoryService documentCategoryService;
+
+
+
+
+    /**
+     * 搜索文档分类列表
+     *
+     * @param request HTTP请求对象,包含以下参数:
+     *        page: 页码(默认1)
+     *        pageSize: 每页数量(默认10)
+     *        name: 分类名称,支持模糊查询(可选)
+     *        status: 状态(可选)
+     * @return AjaxResult 返回结果:
+     *         status: 状态码(200成功,500失败)
+     *         message: 提示信息
+     *         data: 分页数据对象
+     */
+    @PostMapping("/category/search")
+    @ResponseBody
+    public AjaxResultCQY search(HttpServletRequest request) {
+        try {
+            // 1. 获取分页参数(提供默认值)
+            String page = request.getParameter("page");
+            String pageSize = request.getParameter("pageSize");
+            if (page == null) {
+                page = "1";
+            }
+            if (pageSize == null) {
+                pageSize = "10";
+            }
+
+            // 2. 获取查询条件
+            String name = request.getParameter("name");
+            String status = request.getParameter("status");
+
+            // 3. 构建查询对象
+            DocumentCategory category = new DocumentCategory();
+            category.setName(name);
+            if (status != null) {
+                category.setStatus(Integer.parseInt(status));
+            }
+
+            // 4. 调用Service层的搜索方法
+            PageResult pageResult = documentCategoryService.search(
+                    Integer.parseInt(page),
+                    Integer.parseInt(pageSize),
+                    category
+            );
+
+            // 5. 返回成功结果
+            return AjaxResultCQY.success("success", pageResult);
+
+        } catch (Exception e) {
+            log.error("搜索文档分类列表失败", e);
+            return AjaxResultCQY.error("查询失败");
+        }
+    }
+
+}

+ 65 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/ProjectController.java

@@ -0,0 +1,65 @@
+package com.ruoyi.web.controller.document;
+
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.domain.AjaxResultCQY;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.document.domain.DcTemplate;
+import com.ruoyi.document.domain.Project;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.service.IProjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * 项目管理Controller
+ */
+@RestController
+@RequestMapping("/project")
+public class ProjectController {
+
+    @Autowired
+    private IProjectService projectService;
+
+    /**
+     * 搜索项目列表
+     */
+    @PostMapping("/search")
+    public AjaxResultCQY search(HttpServletRequest request) {
+        // 获取表单参数
+        String name = request.getParameter("name");
+        String status = request.getParameter("status");
+        String page = request.getParameter("page");
+        String page_size = request.getParameter("pageSize");
+
+        // 参数转换
+        Integer statusInt = StringUtils.isNotEmpty(status) ? Integer.valueOf(status) : null;
+        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
+        Integer pageSize = StringUtils.isNotEmpty(page_size) ? Integer.valueOf(page_size) : 10;
+
+        // 分页查询
+        PageHelper.startPage(pageNum, pageSize);
+        List<Project> list = projectService.selectProjectList(name, statusInt);
+        // 3. 获取分页信息
+        PageInfo<Project> pageInfo = new PageInfo<>(list);
+
+        // 4. 封装并返回结果
+        PageResult PageResult=  new PageResult(
+                pageInfo.getPageNum(),
+                pageInfo.getPageSize(),
+                pageInfo.getPages(),
+                pageInfo.getTotal(),
+                pageInfo.getList());
+
+        return AjaxResultCQY.success("查询成功", PageResult);
+
+    }
+
+
+}

+ 78 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/document/TemplateCategoryController.java

@@ -0,0 +1,78 @@
+package com.ruoyi.web.controller.document;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.domain.AjaxResultCQY;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.document.domain.Project;
+import com.ruoyi.document.domain.TemplateCategory;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.service.ITemplateCategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@RestController
+@RequestMapping("/template/category")
+public class TemplateCategoryController {
+
+    @Autowired
+    private ITemplateCategoryService templateCategoryService;
+
+    @PostMapping("/search")
+    public AjaxResultCQY search(HttpServletRequest request) {
+        // 获取表单参数
+        String name = request.getParameter("name");
+        String status = request.getParameter("status");
+        String parent_id = request.getParameter("parent_id");
+        String page = request.getParameter("page");
+        String page_size = request.getParameter("pageSize");
+        // 参数转换
+        String parentId = StringUtils.isNotEmpty(parent_id) ? parent_id : "0";
+        Integer statusInt = StringUtils.isNotEmpty(status) ? Integer.valueOf(status) : null;
+        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
+        Integer pageSize = StringUtils.isNotEmpty(page_size) ? Integer.valueOf(page_size) : 10;
+
+        // 判断是否为顶级分类查询
+        if ("0".equals(parentId)) {
+            // 分页查询顶级分类
+            PageHelper.startPage(pageNum, pageSize);
+            List<TemplateCategory> list = templateCategoryService.selectTopCategoryList(name, statusInt);
+
+            // 查询子分类数量
+            for (TemplateCategory category : list) {
+                int childCount = templateCategoryService.selectChildCount(category.getId());
+                category.setChild_count(childCount);
+            }
+            PageInfo<TemplateCategory> pageInfo = new PageInfo<>(list);
+
+            // 4. 封装并返回结果
+            PageResult PageResult=  new PageResult(
+                    pageInfo.getPageNum(),
+                    pageInfo.getPageSize(),
+                    pageInfo.getPages(),
+                    pageInfo.getTotal(),
+                    pageInfo.getList());
+
+            return AjaxResultCQY.success("查询成功", PageResult);
+        }else{
+            // 直接查询子分类列表
+            List<TemplateCategory> list = templateCategoryService.selectChildCategoryList(parentId);
+
+            // 查询子分类数量
+            for (TemplateCategory category : list) {
+                int childCount = templateCategoryService.selectChildCount(category.getId());
+                category.setChild_count(childCount);
+            }
+
+            return AjaxResultCQY.success("查询成功", list);
+        }
+
+
+    }
+
+}

+ 0 - 106
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gqy/DcDocumentController.java

@@ -1,106 +0,0 @@
-package com.ruoyi.web.controller.gqy;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.system.domain.DcDocument;
-import com.ruoyi.system.service.IDcDocumentService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
-
-/**
- * 【请填写功能名称】Controller
- * 
- * @author ruoyi
- * @date 2024-10-30
- */
-@RestController
-@RequestMapping("/document")
-public class DcDocumentController extends BaseController
-{
-    @Autowired
-    private IDcDocumentService dcDocumentService;
-
-
-
-    /**
-     * 查询【请填写功能名称】列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:document:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(DcDocument dcDocument)
-    {
-        startPage();
-        List<DcDocument> list = dcDocumentService.selectDcDocumentList(dcDocument);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出【请填写功能名称】列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:document:export')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, DcDocument dcDocument)
-    {
-        List<DcDocument> list = dcDocumentService.selectDcDocumentList(dcDocument);
-        ExcelUtil<DcDocument> util = new ExcelUtil<DcDocument>(DcDocument.class);
-        util.exportExcel(response, list, "【请填写功能名称】数据");
-    }
-
-    /**
-     * 获取【请填写功能名称】详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('system:document:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(dcDocumentService.selectDcDocumentById(id));
-    }
-
-    /**
-     * 新增【请填写功能名称】
-     */
-    @PreAuthorize("@ss.hasPermi('system:document:add')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody DcDocument dcDocument)
-    {
-        return toAjax(dcDocumentService.insertDcDocument(dcDocument));
-    }
-
-    /**
-     * 修改【请填写功能名称】
-     */
-    @PreAuthorize("@ss.hasPermi('system:document:edit')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody DcDocument dcDocument)
-    {
-        return toAjax(dcDocumentService.updateDcDocument(dcDocument));
-    }
-
-    /**
-     * 删除【请填写功能名称】
-     */
-    @PreAuthorize("@ss.hasPermi('system:document:remove')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(dcDocumentService.deleteDcDocumentByIds(ids));
-    }
-}

+ 18 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntityCQY.java

@@ -0,0 +1,18 @@
+package com.ruoyi.common.core.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class BaseEntityCQY implements Serializable {
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date update_time;
+}

+ 96 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/PageDomainGQY.java

@@ -0,0 +1,96 @@
+package com.ruoyi.common.core.page.gqy;
+
+import com.ruoyi.common.utils.StringUtils;
+
+public class PageDomainGQY {
+
+    /** 当前记录起始索引 */
+    private Integer page;
+
+    /** 每页显示记录数 */
+    private Integer pageSize;
+
+    /** 排序列 */
+    private String orderByColumn;
+
+    /** 排序的方向desc或者asc */
+    private String isAsc = "asc";
+
+    /** 分页参数合理化 */
+    private Boolean reasonable = true;
+
+    public String getOrderBy()
+    {
+        if (StringUtils.isEmpty(orderByColumn))
+        {
+            return "";
+        }
+        return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getPageSize()
+    {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize)
+    {
+        this.pageSize = pageSize;
+    }
+
+    public String getOrderByColumn()
+    {
+        return orderByColumn;
+    }
+
+    public void setOrderByColumn(String orderByColumn)
+    {
+        this.orderByColumn = orderByColumn;
+    }
+
+    public String getIsAsc()
+    {
+        return isAsc;
+    }
+
+    public void setIsAsc(String isAsc)
+    {
+        if (StringUtils.isNotEmpty(isAsc))
+        {
+            // 兼容前端排序类型
+            if ("ascending".equals(isAsc))
+            {
+                isAsc = "asc";
+            }
+            else if ("descending".equals(isAsc))
+            {
+                isAsc = "desc";
+            }
+            this.isAsc = isAsc;
+        }
+    }
+
+    public Boolean getReasonable()
+    {
+        if (StringUtils.isNull(reasonable))
+        {
+            return Boolean.TRUE;
+        }
+        return reasonable;
+    }
+
+    public void setReasonable(Boolean reasonable)
+    {
+        this.reasonable = reasonable;
+    }
+
+
+}

+ 56 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/PageGQYData.java

@@ -0,0 +1,56 @@
+package com.ruoyi.common.core.page.gqy;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
+ */
+public class PageGQYData implements Serializable {
+
+    private int page;
+    private int pageSize;
+    private int totalPage;
+    private long totalRecord;
+    private List<?> dataList;
+
+    public int getPage() {
+        return page;
+    }
+
+    public void setPage(int page) {
+        this.page = page;
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public int getTotalPage() {
+        return totalPage;
+    }
+
+    public void setTotalPage(int totalPage) {
+        this.totalPage = totalPage;
+    }
+
+    public long getTotalRecord() {
+        return totalRecord;
+    }
+
+    public void setTotalRecord(long totalRecord) {
+        this.totalRecord = totalRecord;
+    }
+
+    public List<?> getDataList() {
+        return dataList;
+    }
+
+    public void setDataList(List<?> dataList) {
+        this.dataList = dataList;
+    }
+}

+ 43 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/TableDataInfoGQY.java

@@ -0,0 +1,43 @@
+package com.ruoyi.common.core.page.gqy;
+
+import java.io.Serializable;
+
+/**
+ *  GQY 瑞赢旷视科技
+ *
+ *  分页对象
+ */
+public class TableDataInfoGQY implements Serializable {
+
+    private Integer status;
+
+    private String message;
+
+    private PageGQYData data;
+
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public PageGQYData getData() {
+        return data;
+    }
+
+    public void setData(PageGQYData data) {
+        this.data = data;
+    }
+}
+

+ 37 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/gqy/TableSupportGQY.java

@@ -0,0 +1,37 @@
+package com.ruoyi.common.core.page.gqy;
+
+import com.ruoyi.common.core.page.PageDomain;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.ServletUtils;
+
+public class TableSupportGQY {
+
+    /**
+     * 当前记录起始索引
+     */
+    public static final String PAGE_NUM = "page";
+
+    /**
+     * 每页显示记录数
+     */
+    public static final String PAGE_SIZE = "pageSize";
+
+
+    /**
+     * 封装分页对象
+     */
+    public static PageDomainGQY getPageDomain()
+    {
+        PageDomainGQY pageDomain = new PageDomainGQY();
+        pageDomain.setPage(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
+        pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
+        return pageDomain;
+    }
+
+    public static PageDomainGQY buildPageRequest()
+    {
+        return getPageDomain();
+    }
+
+
+}

+ 38 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtilsGQY.java

@@ -0,0 +1,38 @@
+package com.ruoyi.common.utils;
+
+import com.github.pagehelper.PageHelper;
+import com.ruoyi.common.core.page.PageDomain;
+import com.ruoyi.common.core.page.TableSupport;
+import com.ruoyi.common.core.page.gqy.PageDomainGQY;
+import com.ruoyi.common.core.page.gqy.TableSupportGQY;
+import com.ruoyi.common.utils.sql.SqlUtil;
+
+import java.util.Map;
+
+/**
+ * 分页工具类
+ * 
+ * @author ruoyi
+ */
+public class PageUtilsGQY extends PageHelper
+{
+    /**
+     * 设置请求分页数据
+     */
+    public static PageDomainGQY startPageGQY(Map params)
+    {
+        PageDomainGQY pageDomain = TableSupportGQY.buildPageRequest();
+        Integer pageNum =  Integer.valueOf((String) params.get("page"));
+        Integer pageSize = Integer.valueOf((String) params.get("pageSize"));
+        PageHelper.startPage(pageNum, pageSize);
+        return  pageDomain;
+    }
+
+    /**
+     * 清理分页的线程变量
+     */
+    public static void clearPage()
+    {
+        PageHelper.clearPage();
+    }
+}

+ 37 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java

@@ -6,6 +6,7 @@ import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
@@ -215,4 +216,40 @@ public class ServletUtils
             return StringUtils.EMPTY;
         }
     }
+
+
+    /**
+     * 根据http获取请求参数
+     * @param request
+     * @return
+     */
+    public static Map getParameterMap(HttpServletRequest request) {
+        // 参数Map
+        Map properties = request.getParameterMap();
+        // 返回值Map
+        Map returnMap = new HashMap();
+        Iterator entries = properties.entrySet().iterator();
+        Map.Entry entry;
+        String name = "";
+        String value = "";
+        while (entries.hasNext()) {
+            entry = (Map.Entry) entries.next();
+            name = (String) entry.getKey();
+            Object valueObj = entry.getValue();
+            if(null == valueObj){
+                value = "";
+            }else if(valueObj instanceof String[]){
+                String[] values = (String[])valueObj;
+                for(int i=0;i<values.length;i++){
+                    value = values[i] + ",";
+                }
+                value = value.substring(0, value.length()-1);
+            }else{
+                value = valueObj.toString();
+            }
+            returnMap.put(name, value);
+        }
+        return returnMap;
+    }
+
 }

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/Brand.java

@@ -0,0 +1,15 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class Brand {
+    private Integer id;
+    private String name;
+    private String intro;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+}

+ 129 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/DcTemplate.java

@@ -0,0 +1,129 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class DcTemplate {
+    private Integer id;
+    private String code;
+    private String name;
+    private Integer category_id;
+    private String lay_id;
+    private String type;
+    private String content;
+    private String attrs;
+    private String intro;
+    private Integer admin_id;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    private DcTemplateCategory category;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getCategory_id() {
+        return category_id;
+    }
+
+    public void setCategory_id(Integer category_id) {
+        this.category_id = category_id;
+    }
+
+    public String getLay_id() {
+        return lay_id;
+    }
+
+    public void setLay_id(String lay_id) {
+        this.lay_id = lay_id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getAttrs() {
+        return attrs;
+    }
+
+    public void setAttrs(String attrs) {
+        this.attrs = attrs;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public Integer getAdmin_id() {
+        return admin_id;
+    }
+
+    public void setAdmin_id(Integer admin_id) {
+        this.admin_id = admin_id;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public DcTemplateCategory getCategory() {
+        return category;
+    }
+
+    public void setCategory(DcTemplateCategory category) {
+        this.category = category;
+    }
+}

+ 64 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/DcTemplateCategory.java

@@ -0,0 +1,64 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class DcTemplateCategory {
+    private Integer id;
+    private String name;
+    private Integer parent_id;
+    private String intro;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getParent_id() {
+        return parent_id;
+    }
+
+    public void setParent_id(Integer parent_id) {
+        this.parent_id = parent_id;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+}

+ 170 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/Document.java

@@ -0,0 +1,170 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BaseEntityCQY;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import java.util.Date;
+
+/**
+ * 【请填写功能名称】对象 dc_document
+ * 
+ * @author ruoyi
+ * @date 2024-10-30
+ */
+
+public class Document extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 文档ID */
+    @Excel(name = "文档ID")
+    private Long id;
+
+    /** 文档标题 */
+    @Excel(name = "文档标题")
+    private String title;
+
+    /** 文档内容 */
+    @Excel(name = "文档内容")
+    private String data;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private Long user_id;
+
+    /** 分类ID */
+    @Excel(name = "分类ID")
+    private Long category_id;
+
+    /** 是否模板(0否 1是) */
+    @Excel(name = "是否模板", readConverterExp = "0=否,1=是")
+    private Integer is_template;
+
+    /** 状态(5-使用中 6-已停用 4-已删除) */
+    @Excel(name = "状态", readConverterExp = "5=使用中,6=已停用,4=已删除")
+    private Integer status;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date update_time;
+
+    /** 创建者 */
+    @Excel(name = "创建者")
+    private String create_by;
+
+    /** 更新者 */
+    @Excel(name = "更新者")
+    private String update_by;
+
+
+    /** 当前用户ID(用于权限控制) */
+    private Long current_user_id;
+
+    public Long getCurrent_user_id() {
+        return current_user_id;
+    }
+
+    public void setCurrent_user_id(Long current_user_id) {
+        this.current_user_id = current_user_id;
+    }
+
+    // getter和setter方法
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public Long getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(Long user_id) {
+        this.user_id = user_id;
+    }
+
+    public Long getCategory_id() {
+        return category_id;
+    }
+
+    public void setCategory_id(Long category_id) {
+        this.category_id = category_id;
+    }
+
+    public Integer getIs_template() {
+        return is_template;
+    }
+
+    public void setIs_template(Integer is_template) {
+        this.is_template = is_template;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Date getUpdate_time() {
+        return update_time;
+    }
+
+    public void setUpdate_time(Date update_time) {
+        this.update_time = update_time;
+    }
+
+    public String getCreate_by() {
+        return create_by;
+    }
+
+    public void setCreate_by(String create_by) {
+        this.create_by = create_by;
+    }
+
+    public String getUpdate_by() {
+        return update_by;
+    }
+
+    public void setUpdate_by(String update_by) {
+        this.update_by = update_by;
+    }
+
+}

+ 69 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/DocumentCategory.java

@@ -0,0 +1,69 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import java.util.Date;
+
+public class DocumentCategory extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    private Long id;
+
+    /** 分类名称 */
+    private String name;
+
+    /** 分类介绍 */
+    private String intro;
+
+    /** 状态(5-使用中 4-已删除 6-已停用) */
+    private Integer status;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    @Override
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 196 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/Product.java

@@ -0,0 +1,196 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品对象
+ */
+public class Product {
+    private Integer id;
+    private Integer category_id;
+    private Integer brand_id;
+    private Integer supplier_id;
+    private String name;
+    private String intro;
+    private BigDecimal price;
+    private String product_area;
+    private Integer is_safe;
+    private String safe_time;
+    private Integer is_package;
+    private String package_intro;
+    private String qualifications;
+    private String attrs;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    private ProductCategory category;
+    private Brand brand;
+    private Supplier supplier;
+    private List<Integer> link_doc;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getCategory_id() {
+        return category_id;
+    }
+
+    public void setCategory_id(Integer category_id) {
+        this.category_id = category_id;
+    }
+
+    public Integer getBrand_id() {
+        return brand_id;
+    }
+
+    public void setBrand_id(Integer brand_id) {
+        this.brand_id = brand_id;
+    }
+
+    public Integer getSupplier_id() {
+        return supplier_id;
+    }
+
+    public void setSupplier_id(Integer supplier_id) {
+        this.supplier_id = supplier_id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public String getProduct_area() {
+        return product_area;
+    }
+
+    public void setProduct_area(String product_area) {
+        this.product_area = product_area;
+    }
+
+    public Integer getIs_safe() {
+        return is_safe;
+    }
+
+    public void setIs_safe(Integer is_safe) {
+        this.is_safe = is_safe;
+    }
+
+    public String getSafe_time() {
+        return safe_time;
+    }
+
+    public void setSafe_time(String safe_time) {
+        this.safe_time = safe_time;
+    }
+
+    public Integer getIs_package() {
+        return is_package;
+    }
+
+    public void setIs_package(Integer is_package) {
+        this.is_package = is_package;
+    }
+
+    public String getPackage_intro() {
+        return package_intro;
+    }
+
+    public void setPackage_intro(String package_intro) {
+        this.package_intro = package_intro;
+    }
+
+    public String getQualifications() {
+        return qualifications;
+    }
+
+    public void setQualifications(String qualifications) {
+        this.qualifications = qualifications;
+    }
+
+    public String getAttrs() {
+        return attrs;
+    }
+
+    public void setAttrs(String attrs) {
+        this.attrs = attrs;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public ProductCategory getCategory() {
+        return category;
+    }
+
+    public void setCategory(ProductCategory category) {
+        this.category = category;
+    }
+
+    public Brand getBrand() {
+        return brand;
+    }
+
+    public void setBrand(Brand brand) {
+        this.brand = brand;
+    }
+
+    public Supplier getSupplier() {
+        return supplier;
+    }
+
+    public void setSupplier(Supplier supplier) {
+        this.supplier = supplier;
+    }
+
+    public List<Integer> getLink_doc() {
+        return link_doc;
+    }
+
+    public void setLink_doc(List<Integer> link_doc) {
+        this.link_doc = link_doc;
+    }
+}

+ 67 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/ProductCategory.java

@@ -0,0 +1,67 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 产品分类对象
+ */
+public class ProductCategory {
+    private Integer id;
+    private Integer parent_id;
+    private String name;
+    private String attrs;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getParent_id() {
+        return parent_id;
+    }
+
+    public void setParent_id(Integer parent_id) {
+        this.parent_id = parent_id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAttrs() {
+        return attrs;
+    }
+
+    public void setAttrs(String attrs) {
+        this.attrs = attrs;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+}

+ 103 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/Project.java

@@ -0,0 +1,103 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.entity.SysUser;
+
+import java.util.Date;
+import java.util.List;
+
+public class Project {
+    private Integer id;
+    private String name;
+    private String intro;
+    private Long user_id;
+    private Integer category_id;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    private ProjectCategory category;
+    private SysUser user;
+    private List<Integer> link_doc;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public Long getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(Long user_id) {
+        this.user_id = user_id;
+    }
+
+    public Integer getCategory_id() {
+        return category_id;
+    }
+
+    public void setCategory_id(Integer category_id) {
+        this.category_id = category_id;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public ProjectCategory getCategory() {
+        return category;
+    }
+
+    public void setCategory(ProjectCategory category) {
+        this.category = category;
+    }
+
+    public SysUser getUser() {
+        return user;
+    }
+
+    public void setUser(SysUser user) {
+        this.user = user;
+    }
+
+    public List<Integer> getLink_doc() {
+        return link_doc;
+    }
+
+    public void setLink_doc(List<Integer> link_doc) {
+        this.link_doc = link_doc;
+    }
+}

+ 55 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/ProjectCategory.java

@@ -0,0 +1,55 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class ProjectCategory {
+    private Integer id;
+    private String code;
+    private String name;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+}

+ 83 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/ProjectDocument.java

@@ -0,0 +1,83 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.util.Date;
+
+public class ProjectDocument {
+
+    /** ID */
+    @Excel(name = "ID")
+    private Long id;
+
+    /** 项目ID */
+    @Excel(name = "项目ID")
+    private Long project_id;
+
+    /** 文档ID */
+    @Excel(name = "文档ID")
+    private Long doc_id;
+
+    /** 状态(5-使用中 6-已停用 4-已删除) */
+    @Excel(name = "状态", readConverterExp = "5=使用中,6=已停用,4=已删除")
+    private Integer status;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+
+    /** 创建者 */
+    @Excel(name = "创建者")
+    private String create_by;
+
+    // getter和setter方法
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getProject_id() {
+        return project_id;
+    }
+
+    public void setProject_id(Long project_id) {
+        this.project_id = project_id;
+    }
+
+    public Long getDoc_id() {
+        return doc_id;
+    }
+
+    public void setDoc_id(Long doc_id) {
+        this.doc_id = doc_id;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public String getCreate_by() {
+        return create_by;
+    }
+
+    public void setCreate_by(String create_by) {
+        this.create_by = create_by;
+    }
+}

+ 65 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/Supplier.java

@@ -0,0 +1,65 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class Supplier {
+
+    private Integer id;
+    private String code;
+    private String name;
+    private String intro;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+}

+ 78 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/TemplateCategory.java

@@ -0,0 +1,78 @@
+package com.ruoyi.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 模板分类对象
+ */
+public class TemplateCategory {
+    private Integer id;
+    private String name;
+    private String intro;
+    private String parent_id;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+    private Integer status;
+
+    /** 子分类数量 */
+    private Integer child_count;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public String getParent_id() {
+        return parent_id;
+    }
+
+    public void setParent_id(String parent_id) {
+        this.parent_id = parent_id;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getChild_count() {
+        return child_count;
+    }
+
+    public void setChild_count(Integer child_count) {
+        this.child_count = child_count;
+    }
+}

+ 107 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/vo/PageResult.java

@@ -0,0 +1,107 @@
+package com.ruoyi.document.domain.vo;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class PageResult implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /** 当前页码 */
+    private Integer page;
+
+    /** 每页数量 */
+    private Integer pageSize;
+
+    /** 总页数 */
+    private Integer totalPage;
+
+    /** 总记录数 */
+    private Long totalRecord;
+
+    /** 数据列表 */
+    private List<?> dataList;
+
+    /**
+     * 默认构造函数
+     */
+    public PageResult() {
+        this.page = 1;
+        this.pageSize = 10;
+        this.totalPage = 0;
+        this.totalRecord = 0L;
+        this.dataList = null;
+    }
+
+    /**
+     * 分页参数构造函数
+     */
+    public PageResult(Integer page, Integer pageSize) {
+        this.page = page;
+        this.pageSize = pageSize;
+        this.totalPage = 0;
+        this.totalRecord = 0L;
+        this.dataList = null;
+    }
+
+    /**
+     * 完整分页构造函数
+     */
+    public PageResult(Integer page, Integer pageSize, Integer totalPage, Long totalRecord, List<?> dataList) {
+        this.page = page;
+        this.pageSize = pageSize;
+        this.totalPage = totalPage;
+        this.totalRecord = totalRecord;
+        this.dataList = dataList;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getTotalPage() {
+        return totalPage;
+    }
+
+    public void setTotalPage(Integer totalPage) {
+        this.totalPage = totalPage;
+    }
+
+    public Long getTotalRecord() {
+        return totalRecord;
+    }
+
+    public void setTotalRecord(Long totalRecord) {
+        this.totalRecord = totalRecord;
+    }
+
+    public List<?> getDataList() {
+        return dataList;
+    }
+
+    public void setDataList(List<?> dataList) {
+        this.dataList = dataList;
+    }
+
+    @Override
+    public String toString() {
+        return "PageResult{" +
+                "page=" + page +
+                ", pageSize=" + pageSize +
+                ", totalPage=" + totalPage +
+                ", totalRecord=" + totalRecord +
+                ", dataList=" + dataList +
+                '}';
+    }
+}

+ 59 - 0
ruoyi-system/src/main/java/com/ruoyi/document/domain/vo/TemplateSearchForm.java

@@ -0,0 +1,59 @@
+package com.ruoyi.document.domain.vo;
+
+public class TemplateSearchForm {
+
+    /** 页码 */
+    private Integer page;
+
+    /** 每页数量 */
+    private Integer pageSize;
+
+    /** 模板名称 */
+    private String name;
+
+    /** 分类ID */
+    private Long categoryId;
+
+    /** 状态 */
+    private Integer status;
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(Long categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+}

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/DcTemplateMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.document.mapper;
+
+import com.ruoyi.document.domain.DcTemplate;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface DcTemplateMapper {
+
+    /**
+     * 查询模板列表
+     */
+    public List<DcTemplate> selectTemplateList(@Param("name") String name,
+                                               @Param("category_id") Integer category_id,
+                                               @Param("status") Integer status);
+}

+ 19 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/DocumentCategoryMapper.java

@@ -0,0 +1,19 @@
+package com.ruoyi.document.mapper;
+
+import com.ruoyi.document.domain.DocumentCategory;
+
+import java.util.List;
+
+public interface DocumentCategoryMapper {
+
+    /**
+     * 搜索文档分类列表
+     *
+     * @param category 查询条件对象,包含:
+     *        name: 分类名称(模糊匹配)
+     *        status: 状态(5-使用中 6-已停用)
+     * @return List<DocumentCategory> 文档分类列表
+     */
+    List<DocumentCategory> search(DocumentCategory category);
+
+}

+ 34 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/DocumentMapper.java

@@ -0,0 +1,34 @@
+package com.ruoyi.document.mapper;
+
+
+import com.ruoyi.document.domain.Document;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-10-30
+ */
+public interface DocumentMapper
+{
+    /**
+     * 新增文档
+     */
+    public int insertDocument(Document document);
+
+    /**
+     * 校验文档标题是否唯一
+     */
+    public Document checkDocumentTitleUnique(@Param("title") String title, @Param("is_template") Integer is_template);
+
+    /**
+     * 查询文档列表
+     */
+    List<Map<String, Object>> pageDocument(Document document);
+
+
+}

+ 22 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/ProductMapper.java

@@ -0,0 +1,22 @@
+package com.ruoyi.document.mapper;
+
+import com.ruoyi.document.domain.Product;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 产品数据层
+ */
+public interface ProductMapper {
+    /**
+     * 查询产品列表
+     */
+    public List<Product> selectProductList(@Param("name") String name,
+                                           @Param("category_id") Integer categoryId,
+                                           @Param("brand_id") Integer brandId,
+                                           @Param("supplier_id") Integer supplierId,
+                                           @Param("status") Integer status,
+                                           @Param("ids") List<Integer> ids);
+
+}

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/ProjectDocumentMapper.java

@@ -0,0 +1,15 @@
+package com.ruoyi.document.mapper;
+
+import com.ruoyi.document.domain.ProjectDocument;
+
+import java.util.List;
+
+public interface ProjectDocumentMapper {
+    /**
+     * 批量新增项目文档关联
+     *
+     * @param list 项目文档关联列表
+     * @return 结果
+     */
+    public int batchInsertProjectDocument(List<ProjectDocument> list);
+}

+ 17 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/ProjectMapper.java

@@ -0,0 +1,17 @@
+package com.ruoyi.document.mapper;
+
+import com.ruoyi.document.domain.Project;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 项目数据层
+ */
+public interface ProjectMapper {
+    /**
+     * 查询项目列表
+     */
+    public List<Project> selectProjectList(@Param("name") String name,
+                                           @Param("status") Integer status);
+}

+ 26 - 0
ruoyi-system/src/main/java/com/ruoyi/document/mapper/TemplateCategoryMapper.java

@@ -0,0 +1,26 @@
+package com.ruoyi.document.mapper;
+
+import com.ruoyi.document.domain.TemplateCategory;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface TemplateCategoryMapper {
+
+    /**
+     * 查询顶级分类列表
+     */
+    public List<TemplateCategory> selectTopCategoryList(@Param("name") String name,
+                                                        @Param("status") Integer status);
+
+    /**
+     * 查询子分类列表
+     */
+    public List<TemplateCategory> selectChildCategoryList(@Param("parent_id") String parentId);
+
+    /**
+     * 查询子分类数量
+     */
+    public int selectChildCount(@Param("category_id") Integer categoryId);
+
+}

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/IDcTemplateService.java

@@ -0,0 +1,13 @@
+package com.ruoyi.document.service;
+
+import com.ruoyi.document.domain.DcTemplate;
+
+import java.util.List;
+
+public interface IDcTemplateService {
+    /**
+     * 查询模板列表
+     */
+    public List<DcTemplate> selectTemplateList(String name, Integer category_id, Integer status);
+
+}

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/IDocumentCategoryService.java

@@ -0,0 +1,16 @@
+package com.ruoyi.document.service;
+
+import com.ruoyi.document.domain.DocumentCategory;
+import com.ruoyi.document.domain.vo.PageResult;
+
+public interface IDocumentCategoryService {
+    /**
+     * 搜索文档分类列表
+     *
+     * @param page 页码
+     * @param pageSize 每页数量
+     * @param category 查询条件对象
+     * @return PageResult 分页结果对象
+     */
+    PageResult search(Integer page, Integer pageSize, DocumentCategory category);
+}

+ 34 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/IDocumentService.java

@@ -0,0 +1,34 @@
+package com.ruoyi.document.service;
+
+
+
+import com.ruoyi.common.core.domain.AjaxResult;
+
+import com.ruoyi.document.domain.Document;
+import com.ruoyi.document.domain.vo.PageResult;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 【请填写功能名称】Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-10-30
+ */
+public interface IDocumentService
+{
+    public AjaxResult create(HttpServletRequest request, MultipartFile file);
+
+    /**
+     * 分页查询文档列表
+     *
+     * @param page 页码
+     * @param pageSize 每页数量
+     * @param document 查询条件对象
+     * @return PageResult 分页结果对象
+     */
+    PageResult pageDocument(Integer page, Integer pageSize, Document document);
+
+
+}

+ 17 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/IProductService.java

@@ -0,0 +1,17 @@
+package com.ruoyi.document.service;
+
+import com.ruoyi.document.domain.Product;
+
+import java.util.List;
+
+/**
+ * 产品服务接口
+ */
+public interface IProductService {
+    /**
+     * 查询产品列表
+     */
+    public List<Product> selectProductList(String name, Integer categoryId, Integer brandId,
+                                           Integer supplierId, Integer status, List<Integer> ids);
+}
+

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/IProjectService.java

@@ -0,0 +1,15 @@
+package com.ruoyi.document.service;
+
+import com.ruoyi.document.domain.Project;
+
+import java.util.List;
+
+/**
+ * 项目服务接口
+ */
+public interface IProjectService {
+    /**
+     * 查询项目列表
+     */
+    public List<Project> selectProjectList(String name, Integer status);
+}

+ 28 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/ITemplateCategoryService.java

@@ -0,0 +1,28 @@
+package com.ruoyi.document.service;
+
+
+import com.ruoyi.document.domain.TemplateCategory;
+
+import java.util.List;
+
+/**
+ * 模板分类Service接口
+ */
+public interface ITemplateCategoryService {
+
+    /**
+     * 查询顶级分类列表
+     */
+    public List<TemplateCategory> selectTopCategoryList(String name, Integer status);
+
+    /**
+     * 查询子分类列表
+     */
+    public List<TemplateCategory> selectChildCategoryList(String parentId);
+
+    /**
+     * 查询子分类数量
+     */
+    public int selectChildCount(Integer categoryId);
+
+}

+ 165 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/impl/DcDocumentServiceImpl.java

@@ -0,0 +1,165 @@
+package com.ruoyi.document.service.impl;
+
+import java.util.*;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.*;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.domain.Document;
+import com.ruoyi.document.domain.ProjectDocument;
+import com.ruoyi.document.mapper.DocumentMapper;
+import com.ruoyi.document.mapper.ProjectDocumentMapper;
+import com.ruoyi.document.service.IDocumentService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-10-30
+ */
+@Service
+public class DcDocumentServiceImpl implements IDocumentService
+{
+
+    private static final Logger log = LoggerFactory.getLogger(DcDocumentServiceImpl.class);
+    @Autowired
+    private DocumentMapper documentMapper;
+
+    @Autowired
+    private ProjectDocumentMapper projectDocumentMapper;
+
+
+    @Override
+    @Transactional
+    public AjaxResult create(HttpServletRequest request, MultipartFile file) {
+        try {
+            // 1. 获取表单参数
+            String title = request.getParameter("title");
+            String data = request.getParameter("data");
+            String categoryId = request.getParameter("category_id");
+            String isTemplate = request.getParameter("is_template");
+            String status = request.getParameter("status");
+            String projects = request.getParameter("projects");
+
+            // 2. 参数校验
+            if (StringUtils.isEmpty(title)) {
+                return AjaxResult.error("文档标题不能为空");
+            }
+
+            Integer templateFlag = Convert.toInt(isTemplate, 0);
+            if (templateFlag == 0 && StringUtils.isEmpty(categoryId)) {
+                return AjaxResult.error("保存文档时,分类不能为空");
+            }
+
+            // 3. 检查标题是否重复
+            Document existDoc = documentMapper.checkDocumentTitleUnique(title, templateFlag);
+            if (StringUtils.isNotNull(existDoc)) {
+                String type = templateFlag == 1 ? "模板" : "文档";
+                return AjaxResult.error(String.format("%s标题 '%s' 已存在", type, title));
+            }
+
+//            // 4. 处理文件上传
+//            String fileUrl = "";
+//            if (file != null && !file.isEmpty()) {
+//                SysFile sysFile = sysFileService.uploadFile(file);
+//                if (sysFile != null) {
+//                    fileUrl = sysFile.getUrl();
+//                    // 如果是文本文件,尝试读取内容
+//                    if (FileTypeUtils.isText(file.getOriginalFilename())) {
+//                        data = FileUtils.readString(file);
+//                    }
+//                }
+//            }
+
+            // 5. 创建文档对象
+            Document document = new Document();
+            document.setTitle(title);
+//            document.setData(StringUtils.isNotEmpty(data) ? data : fileUrl);
+            document.setData(StringUtils.isNotEmpty(data) ? data : "");
+            document.setUser_id(SecurityUtils.getUserId());
+            document.setCategory_id(StringUtils.isNotEmpty(categoryId) ? Long.valueOf(categoryId) : null);
+            document.setIs_template(templateFlag);
+            document.setStatus(Convert.toInt(status, 5));
+            document.setCreateTime(DateUtils.getNowDate());
+            document.setUpdateTime(DateUtils.getNowDate());
+            document.setCreateBy(SecurityUtils.getUsername());
+
+            // 6. 保存文档
+            int rows = documentMapper.insertDocument(document);
+            if (rows <= 0) {
+                return AjaxResult.error("创建文档失败");
+            }
+
+            // 7. 处理项目关联
+            if (StringUtils.isNotEmpty(projects)) {
+                try {
+                    JSONArray projectArray = JSONArray.parseArray(projects);
+                    List<ProjectDocument> projectDocList = new ArrayList<>();
+
+                    for (int i = 0; i < projectArray.size(); i++) {
+                        ProjectDocument pd = new ProjectDocument();
+                        pd.setDoc_id(document.getId());
+                        pd.setProject_id(projectArray.getLong(i));
+                        pd.setStatus(5);
+                        pd.setCreate_time(DateUtils.getNowDate());
+                        pd.setCreate_by(SecurityUtils.getUsername());
+                        projectDocList.add(pd);
+                    }
+
+                    if (!projectDocList.isEmpty()) {
+                        projectDocumentMapper.batchInsertProjectDocument(projectDocList);
+                    }
+                } catch (Exception e) {
+                    throw new ServiceException("处理项目关联失败");
+                }
+            }
+
+            return AjaxResult.success("创建成功", document.getId());
+        } catch (Exception e) {
+            throw new ServiceException("创建文档失败:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public PageResult pageDocument(Integer page, Integer pageSize, Document document) {
+        try {
+            // 1. 设置分页参数
+            PageHelper.startPage(page, pageSize);
+
+            // 2. 执行查询
+            List<Map<String, Object>> list = documentMapper.pageDocument(document);
+
+            // 3. 获取分页信息
+            PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(list);
+
+            // 4. 封装并返回结果
+            return new PageResult(
+                    pageInfo.getPageNum(),
+                    pageInfo.getPageSize(),
+                    pageInfo.getPages(),
+                    pageInfo.getTotal(),
+                    pageInfo.getList()
+            );
+
+        } catch (Exception e) {
+            log.error("查询文档列表失败", e);
+            return new PageResult(page, pageSize);
+        }
+
+    }
+
+
+}

+ 24 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/impl/DcTemplateServiceImpl.java

@@ -0,0 +1,24 @@
+package com.ruoyi.document.service.impl;
+
+import com.ruoyi.document.domain.DcTemplate;
+import com.ruoyi.document.mapper.DcTemplateMapper;
+import com.ruoyi.document.service.IDcTemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 模板服务实现
+ */
+@Service
+public class DcTemplateServiceImpl implements IDcTemplateService {
+
+    @Autowired
+    private DcTemplateMapper templateMapper;
+
+    @Override
+    public List<DcTemplate> selectTemplateList(String name, Integer category_id, Integer status) {
+        return templateMapper.selectTemplateList(name, category_id, status);
+    }
+}

+ 55 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/impl/DocumentCategoryServiceImpl.java

@@ -0,0 +1,55 @@
+package com.ruoyi.document.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.document.domain.DocumentCategory;
+import com.ruoyi.document.domain.vo.PageResult;
+import com.ruoyi.document.mapper.DocumentCategoryMapper;
+import com.ruoyi.document.service.IDocumentCategoryService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * 文档分类Service实现类
+ *
+ */
+@Service
+public class DocumentCategoryServiceImpl implements IDocumentCategoryService {
+
+    private static final Logger log = LoggerFactory.getLogger(IDocumentCategoryService.class);
+
+    @Autowired
+    private DocumentCategoryMapper documentCategoryMapper;
+
+    @Override
+    public PageResult search(Integer page, Integer pageSize, DocumentCategory category) {
+        try {
+            // 1. 设置分页参数(PageHelper会自动添加limit语句)
+            PageHelper.startPage(page, pageSize);
+
+            // 2. 执行查询(会自动执行count查询)
+            List<DocumentCategory> list = documentCategoryMapper.search(category);
+
+            // 3. 获取分页信息
+            PageInfo<DocumentCategory> pageInfo = new PageInfo<>(list);
+
+            // 4. 封装并返回结果(注意转换为String类型)
+            return new PageResult(
+                    pageInfo.getPageNum(),    // 当前页码
+                    pageInfo.getPageSize(),   // 每页数量
+                    pageInfo.getPages(),                      // 总页数
+                    pageInfo.getTotal(),                // 总记录数
+                    pageInfo.getList()                       // 数据列表
+            );
+
+        } catch (Exception e) {
+            log.error("搜索文档分类列表失败", e);
+            return new PageResult(page,pageSize);
+        }
+    }
+}

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/impl/ProductServiceImpl.java

@@ -0,0 +1,4 @@
+package com.ruoyi.document.service.impl;
+
+public class ProductServiceImpl {
+}

+ 22 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/impl/ProjectServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ruoyi.document.service.impl;
+
+import com.ruoyi.document.domain.Project;
+import com.ruoyi.document.mapper.ProjectMapper;
+import com.ruoyi.document.service.IProjectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ProjectServiceImpl implements IProjectService {
+
+
+    @Autowired
+    private ProjectMapper projectMapper;
+
+
+    public List<Project> selectProjectList(String name, Integer status) {
+        return projectMapper.selectProjectList(name, status);
+    }
+}

+ 37 - 0
ruoyi-system/src/main/java/com/ruoyi/document/service/impl/TemplateCategoryServiceImpl.java

@@ -0,0 +1,37 @@
+package com.ruoyi.document.service.impl;
+
+import com.ruoyi.document.domain.TemplateCategory;
+import com.ruoyi.document.mapper.TemplateCategoryMapper;
+import com.ruoyi.document.service.ITemplateCategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class TemplateCategoryServiceImpl  implements ITemplateCategoryService {
+
+    @Autowired
+    private TemplateCategoryMapper templateCategoryMapper;
+
+    /**
+     * 查询顶级分类列表
+     */
+    public List<TemplateCategory> selectTopCategoryList(String name, Integer status) {
+        return templateCategoryMapper.selectTopCategoryList(name, status);
+    }
+
+    /**
+     * 查询子分类列表
+     */
+    public List<TemplateCategory> selectChildCategoryList(String parentId) {
+        return templateCategoryMapper.selectChildCategoryList(parentId);
+    }
+
+    /**
+     * 查询子分类数量
+     */
+    public int selectChildCount(Integer categoryId) {
+        return templateCategoryMapper.selectChildCount(categoryId);
+    }
+}

+ 0 - 123
ruoyi-system/src/main/java/com/ruoyi/system/domain/DcDocument.java

@@ -1,123 +0,0 @@
-package com.ruoyi.system.domain;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.annotation.Excel;
-import com.ruoyi.common.core.domain.BaseEntity;
-
-/**
- * 【请填写功能名称】对象 dc_document
- * 
- * @author ruoyi
- * @date 2024-10-30
- */
-public class DcDocument extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** $column.columnComment */
-    private Long id;
-
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    private String title;
-
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    private String data;
-
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    private Long userId;
-
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    private Long status;
-
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    private Long categoryId;
-
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    private Long isTemplate;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setTitle(String title) 
-    {
-        this.title = title;
-    }
-
-    public String getTitle() 
-    {
-        return title;
-    }
-    public void setData(String data) 
-    {
-        this.data = data;
-    }
-
-    public String getData() 
-    {
-        return data;
-    }
-    public void setUserId(Long userId) 
-    {
-        this.userId = userId;
-    }
-
-    public Long getUserId() 
-    {
-        return userId;
-    }
-    public void setStatus(Long status) 
-    {
-        this.status = status;
-    }
-
-    public Long getStatus() 
-    {
-        return status;
-    }
-    public void setCategoryId(Long categoryId) 
-    {
-        this.categoryId = categoryId;
-    }
-
-    public Long getCategoryId() 
-    {
-        return categoryId;
-    }
-    public void setIsTemplate(Long isTemplate) 
-    {
-        this.isTemplate = isTemplate;
-    }
-
-    public Long getIsTemplate() 
-    {
-        return isTemplate;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("title", getTitle())
-            .append("data", getData())
-            .append("userId", getUserId())
-            .append("createTime", getCreateTime())
-            .append("updateTime", getUpdateTime())
-            .append("status", getStatus())
-            .append("categoryId", getCategoryId())
-            .append("isTemplate", getIsTemplate())
-            .toString();
-    }
-}

+ 0 - 61
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DcDocumentMapper.java

@@ -1,61 +0,0 @@
-package com.ruoyi.system.mapper;
-
-import java.util.List;
-import com.ruoyi.system.domain.DcDocument;
-
-/**
- * 【请填写功能名称】Mapper接口
- * 
- * @author ruoyi
- * @date 2024-10-30
- */
-public interface DcDocumentMapper 
-{
-    /**
-     * 查询【请填写功能名称】
-     * 
-     * @param id 【请填写功能名称】主键
-     * @return 【请填写功能名称】
-     */
-    public DcDocument selectDcDocumentById(Long id);
-
-    /**
-     * 查询【请填写功能名称】列表
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 【请填写功能名称】集合
-     */
-    public List<DcDocument> selectDcDocumentList(DcDocument dcDocument);
-
-    /**
-     * 新增【请填写功能名称】
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 结果
-     */
-    public int insertDcDocument(DcDocument dcDocument);
-
-    /**
-     * 修改【请填写功能名称】
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 结果
-     */
-    public int updateDcDocument(DcDocument dcDocument);
-
-    /**
-     * 删除【请填写功能名称】
-     * 
-     * @param id 【请填写功能名称】主键
-     * @return 结果
-     */
-    public int deleteDcDocumentById(Long id);
-
-    /**
-     * 批量删除【请填写功能名称】
-     * 
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    public int deleteDcDocumentByIds(Long[] ids);
-}

+ 0 - 61
ruoyi-system/src/main/java/com/ruoyi/system/service/IDcDocumentService.java

@@ -1,61 +0,0 @@
-package com.ruoyi.system.service;
-
-import java.util.List;
-import com.ruoyi.system.domain.DcDocument;
-
-/**
- * 【请填写功能名称】Service接口
- * 
- * @author ruoyi
- * @date 2024-10-30
- */
-public interface IDcDocumentService 
-{
-    /**
-     * 查询【请填写功能名称】
-     * 
-     * @param id 【请填写功能名称】主键
-     * @return 【请填写功能名称】
-     */
-    public DcDocument selectDcDocumentById(Long id);
-
-    /**
-     * 查询【请填写功能名称】列表
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 【请填写功能名称】集合
-     */
-    public List<DcDocument> selectDcDocumentList(DcDocument dcDocument);
-
-    /**
-     * 新增【请填写功能名称】
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 结果
-     */
-    public int insertDcDocument(DcDocument dcDocument);
-
-    /**
-     * 修改【请填写功能名称】
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 结果
-     */
-    public int updateDcDocument(DcDocument dcDocument);
-
-    /**
-     * 批量删除【请填写功能名称】
-     * 
-     * @param ids 需要删除的【请填写功能名称】主键集合
-     * @return 结果
-     */
-    public int deleteDcDocumentByIds(Long[] ids);
-
-    /**
-     * 删除【请填写功能名称】信息
-     * 
-     * @param id 【请填写功能名称】主键
-     * @return 结果
-     */
-    public int deleteDcDocumentById(Long id);
-}

+ 0 - 96
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DcDocumentServiceImpl.java

@@ -1,96 +0,0 @@
-package com.ruoyi.system.service.impl;
-
-import java.util.List;
-import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.system.mapper.DcDocumentMapper;
-import com.ruoyi.system.domain.DcDocument;
-import com.ruoyi.system.service.IDcDocumentService;
-
-/**
- * 【请填写功能名称】Service业务层处理
- * 
- * @author ruoyi
- * @date 2024-10-30
- */
-@Service
-public class DcDocumentServiceImpl implements IDcDocumentService 
-{
-    @Autowired
-    private DcDocumentMapper dcDocumentMapper;
-
-    /**
-     * 查询【请填写功能名称】
-     * 
-     * @param id 【请填写功能名称】主键
-     * @return 【请填写功能名称】
-     */
-    @Override
-    public DcDocument selectDcDocumentById(Long id)
-    {
-        return dcDocumentMapper.selectDcDocumentById(id);
-    }
-
-    /**
-     * 查询【请填写功能名称】列表
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 【请填写功能名称】
-     */
-    @Override
-    public List<DcDocument> selectDcDocumentList(DcDocument dcDocument)
-    {
-        return dcDocumentMapper.selectDcDocumentList(dcDocument);
-    }
-
-    /**
-     * 新增【请填写功能名称】
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 结果
-     */
-    @Override
-    public int insertDcDocument(DcDocument dcDocument)
-    {
-        dcDocument.setCreateTime(DateUtils.getNowDate());
-        return dcDocumentMapper.insertDcDocument(dcDocument);
-    }
-
-    /**
-     * 修改【请填写功能名称】
-     * 
-     * @param dcDocument 【请填写功能名称】
-     * @return 结果
-     */
-    @Override
-    public int updateDcDocument(DcDocument dcDocument)
-    {
-        dcDocument.setUpdateTime(DateUtils.getNowDate());
-        return dcDocumentMapper.updateDcDocument(dcDocument);
-    }
-
-    /**
-     * 批量删除【请填写功能名称】
-     * 
-     * @param ids 需要删除的【请填写功能名称】主键
-     * @return 结果
-     */
-    @Override
-    public int deleteDcDocumentByIds(Long[] ids)
-    {
-        return dcDocumentMapper.deleteDcDocumentByIds(ids);
-    }
-
-    /**
-     * 删除【请填写功能名称】信息
-     * 
-     * @param id 【请填写功能名称】主键
-     * @return 结果
-     */
-    @Override
-    public int deleteDcDocumentById(Long id)
-    {
-        return dcDocumentMapper.deleteDcDocumentById(id);
-    }
-}

+ 91 - 0
ruoyi-system/src/main/resources/mapper/document/ SysFileMapper.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.SysFileMapper">
+
+    <resultMap type="SysFile" id="SysFileResult">
+        <id     property="file_id"        column="file_id"         />
+        <result property="file_name"      column="file_name"       />
+        <result property="original_name"  column="original_name"   />
+        <result property="file_path"      column="file_path"       />
+        <result property="url"            column="url"             />
+        <result property="file_type"      column="file_type"       />
+        <result property="file_size"      column="file_size"       />
+        <result property="storage_type"   column="storage_type"    />
+        <result property="status"         column="status"          />
+        <result property="createTime"    column="create_time"     />
+        <result property="createBy"      column="create_by"       />
+    </resultMap>
+
+    <insert id="insertSysFile" parameterType="SysFile" useGeneratedKeys="true" keyProperty="file_id">
+        insert into sys_file(
+            file_name,
+            original_name,
+            file_path,
+            url,
+            file_type,
+            file_size,
+            storage_type,
+            status,
+            create_by,
+            create_time
+        )values(
+                   #{file_name},
+                   #{original_name},
+                   #{file_path},
+                   #{url},
+                   #{file_type},
+                   #{file_size},
+                   #{storage_type},
+                   #{status},
+                   #{create_by},
+                   sysdate()
+               )
+    </insert>
+
+    <select id="selectSysFileByUrl" parameterType="String" resultMap="SysFileResult">
+        select file_id, file_name, original_name, file_path, url, file_type,
+               file_size, storage_type, status, create_time, create_by
+        from sys_file
+        where url = #{url}
+          and status = 5
+    </select>
+
+
+    <update id="updateSysFile" parameterType="SysFile">
+        update sys_file
+        <set>
+            <if test="file_name != null and file_name != ''">
+                file_name = #{file_name},
+            </if>
+            <if test="original_name != null and original_name != ''">
+                original_name = #{original_name},
+            </if>
+            <if test="file_path != null and file_path != ''">
+                file_path = #{file_path},
+            </if>
+            <if test="url != null and url != ''">
+                url = #{url},
+            </if>
+            <if test="file_type != null and file_type != ''">
+                file_type = #{file_type},
+            </if>
+            <if test="file_size != null">
+                file_size = #{file_size},
+            </if>
+            <if test="storage_type != null">
+                storage_type = #{storage_type},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="update_by != null and update_by != ''">
+                update_by = #{update_by},
+            </if>
+            update_time = sysdate()
+        </set>
+        where file_id = #{file_id}
+    </update>
+
+</mapper>

+ 97 - 0
ruoyi-system/src/main/resources/mapper/document/DcDocumentMapper.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.DocumentMapper">
+
+    <resultMap type="Document" id="DocumentResult">
+        <id     property="id"           column="id"            />
+        <result property="title"        column="title"         />
+        <result property="data"         column="data"          />
+        <result property="user_id"      column="user_id"       />
+        <result property="category_id"  column="category_id"   />
+        <result property="is_template"  column="is_template"   />
+        <result property="status"       column="status"        />
+        <result property="create_time"  column="create_time"   />
+        <result property="update_time"  column="update_time"   />
+        <result property="create_by"    column="create_by"     />
+        <result property="update_by"    column="update_by"     />
+    </resultMap>
+
+    <insert id="insertDocument" parameterType="Document" useGeneratedKeys="true" keyProperty="id">
+        insert into dc_document(
+        <if test="title != null and title != ''">title,</if>
+        <if test="data != null">data,</if>
+        <if test="user_id != null">user_id,</if>
+        <if test="category_id != null">category_id,</if>
+        <if test="is_template != null">is_template,</if>
+        <if test="status != null">status,</if>
+        <if test="create_by != null">create_by,</if>
+        create_time,
+        update_time
+        )values(
+        <if test="title != null and title != ''">#{title},</if>
+        <if test="data != null">#{data},</if>
+        <if test="user_id != null">#{user_id},</if>
+        <if test="category_id != null">#{category_id},</if>
+        <if test="is_template != null">#{is_template},</if>
+        <if test="status != null">#{status},</if>
+        <if test="create_by != null">#{create_by},</if>
+        sysdate(),
+        sysdate()
+        )
+    </insert>
+
+    <select id="checkDocumentTitleUnique" resultMap="DocumentResult">
+        select id, title, is_template
+        from dc_document
+        where title = #{title}
+          and is_template = #{is_template}
+          and status != 4
+        limit 1
+    </select>
+
+
+    <!-- 分页查询文档列表 -->
+    <select id="pageDocument" resultType="map">
+        SELECT
+        d.id,
+        d.title,
+        d.category_id,
+        d.user_id,
+        d.create_time,
+        d.status,
+        d.is_template,
+        c.name as type_name,
+        u.user_name
+        FROM dc_document d
+        LEFT JOIN dc_document_category c ON d.category_id = c.id AND c.status = 5
+        LEFT JOIN sys_user u ON d.user_id = u.user_id
+        <where>
+            AND d.status = #{status}
+            <if test="title != null and title != ''">
+                AND d.title LIKE CONCAT('%', #{title}, '%')
+            </if>
+            <if test="category_id != null">
+                AND d.category_id = #{category_id}
+            </if>
+            <if test="user_id != null">
+                AND d.user_id = #{user_id}
+            </if>
+            <if test="current_user_id != null">
+                AND (
+                d.user_id = #{current_user_id}
+                OR (
+                d.is_template = 1
+                AND d.user_id IN (
+                SELECT user_id FROM sys_user
+                WHERE is_admin = 1
+                )
+                )
+                )
+            </if>
+        </where>
+        ORDER BY d.create_time DESC
+    </select>
+
+</mapper>

+ 49 - 0
ruoyi-system/src/main/resources/mapper/document/DcProductCategoryMapper.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.ProjectDocumentMapper">
+
+    <resultMap type="ProjectDocument" id="ProjectDocumentResult">
+        <id     property="id"           column="id"            />
+        <result property="project_id"   column="project_id"    />
+        <result property="doc_id"       column="doc_id"        />
+        <result property="status"       column="status"        />
+        <result property="create_time"  column="create_time"   />
+        <result property="create_by"    column="create_by"     />
+    </resultMap>
+
+    <insert id="batchInsertProjectDocument" parameterType="java.util.List">
+        insert into dc_project_document(
+        project_id,
+        doc_id,
+        status,
+        create_time,
+        create_by
+        ) values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.project_id},
+            #{item.doc_id},
+            #{item.status},
+            #{item.create_time},
+            #{item.create_by}
+            )
+        </foreach>
+    </insert>
+
+    <delete id="deleteProjectDocumentByDocId" parameterType="Long">
+        update dc_project_document
+        set status = 4,
+            update_time = sysdate()
+        where doc_id = #{doc_id}
+    </delete>
+
+    <select id="selectProjectDocumentByDocId" parameterType="Long" resultMap="ProjectDocumentResult">
+        select id, project_id, doc_id, status, create_time, create_by
+        from dc_project_document
+        where doc_id = #{doc_id}
+          and status != 4
+    </select>
+
+</mapper>

+ 71 - 0
ruoyi-system/src/main/resources/mapper/document/DcTemplateMapper.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.DcTemplateMapper">
+
+    <!-- 结果映射 -->
+    <resultMap type="DcTemplate" id="TemplateResult">
+        <!-- 模板字段映射 -->
+        <id     property="id"          column="id"          />
+        <result property="code"        column="code"        />
+        <result property="name"        column="name"        />
+        <result property="category_id" column="category_id" />
+        <result property="lay_id"      column="lay_id"      />
+        <result property="type"        column="type"        />
+        <result property="content"     column="content"     />
+        <result property="attrs"       column="attrs"       />
+        <result property="intro"       column="intro"       />
+        <result property="admin_id"    column="admin_id"    />
+        <result property="create_time" column="create_time" />
+        <result property="status"      column="status"      />
+
+        <!-- 分类关联映射 -->
+        <association property="category" javaType="DcTemplateCategory">
+            <id     property="id"          column="c_id"          />
+            <result property="name"        column="c_name"        />
+            <result property="parent_id"   column="c_parent_id"   />
+            <result property="intro"       column="c_intro"       />
+            <result property="create_time" column="c_create_time" />
+            <result property="status"      column="c_status"      />
+        </association>
+    </resultMap>
+
+    <!-- 查询列表 -->
+    <select id="selectTemplateList" resultMap="TemplateResult">
+        select
+        t.id,
+        t.code,
+        t.name,
+        t.category_id,
+        t.lay_id,
+        t.type,
+        t.content,
+        t.attrs,
+        t.intro,
+        t.admin_id,
+        t.create_time,
+        t.status,
+        c.id as c_id,
+        c.name as c_name,
+        c.parent_id as c_parent_id,
+        c.intro as c_intro,
+        c.create_time as c_create_time,
+        c.status as c_status
+        from dc_template t
+        left join dc_template_category c on t.category_id = c.id
+        <where>
+            t.status != 4
+            <if test="name != null and name != ''">
+                AND t.name like concat('%', #{name}, '%')
+            </if>
+            <if test="category_id != null">
+                AND t.category_id = #{category_id}
+            </if>
+            <if test="status != null">
+                AND t.status = #{status}
+            </if>
+        </where>
+        order by t.create_time desc
+    </select>
+</mapper>

+ 33 - 0
ruoyi-system/src/main/resources/mapper/document/DocumentCategoryMapper.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.DocumentCategoryMapper">
+
+    <!-- 搜索文档分类列表 -->
+    <select id="search" resultType="DocumentCategory">
+        <!-- 查询字段 -->
+        SELECT
+        id,                <!-- 分类ID -->
+        name,             <!-- 分类名称 -->
+        intro,            <!-- 分类介绍 -->
+        status,           <!-- 状态 -->
+        create_time as createTime  <!-- 创建时间 -->
+        FROM dc_document_category
+        <where>
+            <!-- 排除已删除数据 -->
+            AND status != 4
+            <!-- 分类名称模糊查询 -->
+            <if test="name != null and name != ''">
+                AND name LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <!-- 状态过滤 -->
+            <if test="status != null">
+                AND status = #{status}
+            </if>
+        </where>
+        ORDER BY id DESC  <!-- 按ID倒序排序 -->
+    </select>
+
+
+</mapper>

+ 114 - 0
ruoyi-system/src/main/resources/mapper/document/Product.xml

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.ProductMapper">
+
+    <!-- 结果映射 -->
+    <resultMap type="Product" id="ProductResult">
+        <id     property="id"             column="id"             />
+        <result property="category_id"    column="category_id"    />
+        <result property="brand_id"       column="brand_id"       />
+        <result property="supplier_id"    column="supplier_id"    />
+        <result property="name"           column="name"           />
+        <result property="intro"          column="intro"          />
+        <result property="price"          column="price"          />
+        <result property="product_area"   column="product_area"   />
+        <result property="is_safe"        column="is_safe"        />
+        <result property="safe_time"      column="safe_time"      />
+        <result property="is_package"     column="is_package"     />
+        <result property="package_intro"  column="package_intro"  />
+        <result property="qualifications" column="qualifications" />
+        <result property="attrs"          column="attrs"          />
+        <result property="create_time"    column="create_time"    />
+        <result property="status"         column="status"         />
+
+        <!-- 分类关联 -->
+        <association property="category" javaType="ProductCategory">
+            <id     property="id"          column="c_id"          />
+            <result property="parent_id"   column="c_parent_id"   />
+            <result property="name"        column="c_name"        />
+            <result property="attrs"       column="c_attrs"       />
+            <result property="create_time" column="c_create_time" />
+            <result property="status"      column="c_status"      />
+        </association>
+
+        <!-- 品牌关联 -->
+        <association property="brand" javaType="Brand">
+            <id     property="id"          column="b_id"          />
+            <result property="name"        column="b_name"        />
+            <result property="intro"       column="b_intro"       />
+            <result property="create_time" column="b_create_time" />
+            <result property="status"      column="b_status"      />
+        </association>
+
+        <!-- 供应商关联 -->
+        <association property="supplier" javaType="Supplier">
+            <id     property="id"          column="s_id"          />
+            <result property="code"        column="s_code"        />
+            <result property="name"        column="s_name"        />
+            <result property="intro"       column="s_intro"       />
+            <result property="create_time" column="s_create_time" />
+            <result property="status"      column="s_status"      />
+        </association>
+
+        <!-- 关联文档 -->
+        <collection property="link_doc" ofType="Integer">
+            <result column="doc_id"/>
+        </collection>
+    </resultMap>
+
+    <!-- 查询列表 -->
+    <select id="selectProductList" resultMap="ProductResult">
+        select
+        p.*,
+        c.id as c_id,
+        c.parent_id as c_parent_id,
+        c.name as c_name,
+        c.attrs as c_attrs,
+        c.create_time as c_create_time,
+        c.status as c_status,
+        b.id as b_id,
+        b.name as b_name,
+        b.intro as b_intro,
+        b.create_time as b_create_time,
+        b.status as b_status,
+        s.id as s_id,
+        s.code as s_code,
+        s.name as s_name,
+        s.intro as s_intro,
+        s.create_time as s_create_time,
+        s.status as s_status,
+        pd.document_id as doc_id
+        from dc_product p
+        left join dc_product_category c on p.category_id = c.id
+        left join dc_brand b on p.brand_id = b.id
+        left join dc_supplier s on p.supplier_id = s.id
+        left join dc_product_document pd on p.id = pd.product_id and pd.status != 4
+        <where>
+            p.status != 4
+            <if test="name != null and name != ''">
+                AND p.name like concat('%', #{name}, '%')
+            </if>
+            <if test="category_id != null">
+                AND p.category_id = #{category_id}
+            </if>
+            <if test="brand_id != null">
+                AND p.brand_id = #{brand_id}
+            </if>
+            <if test="supplier_id != null">
+                AND p.supplier_id = #{supplier_id}
+            </if>
+            <if test="status != null">
+                AND p.status = #{status}
+            </if>
+            <if test="ids != null and ids.size() > 0">
+                AND p.id in
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by p.id desc
+    </select>
+</mapper>

+ 81 - 0
ruoyi-system/src/main/resources/mapper/document/ProjectMapper.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.ProjectMapper">
+
+    <!-- 结果映射 -->
+    <resultMap type="Project" id="ProjectResult">
+        <id     property="id"          column="id"          />
+        <result property="name"        column="name"        />
+        <result property="intro"       column="intro"       />
+        <result property="user_id"     column="user_id"     />
+        <result property="category_id" column="category_id" />
+        <result property="create_time" column="create_time" />
+        <result property="status"      column="status"      />
+
+        <!-- 分类关联 -->
+        <association property="category" javaType="ProjectCategory">
+            <id     property="id"          column="c_id"          />
+            <result property="code"        column="c_code"        />
+            <result property="name"        column="c_name"        />
+            <result property="create_time" column="c_create_time" />
+            <result property="status"      column="c_status"      />
+        </association>
+
+        <!-- 用户关联 -->
+        <association property="user" javaType="SysUser">
+            <id     property="userId"      column="user_id"      />
+            <result property="deptId"     column="dept_id"     />
+            <result property="userName"   column="user_name"   />
+            <result property="nickName"   column="nick_name"   />
+            <result property="email"       column="email"       />
+            <result property="phonenumber" column="phonenumber" />
+            <result property="sex"         column="sex"         />
+            <result property="avatar"      column="avatar"      />
+            <result property="status"      column="status"      />
+            <result property="delFlag"    column="del_flag"    />
+        </association>
+
+        <!-- 关联文档 -->
+        <collection property="link_doc" ofType="Integer">
+            <result column="doc_id"/>
+        </collection>
+    </resultMap>
+
+    <!-- 查询列表 -->
+    <select id="selectProjectList" resultMap="ProjectResult">
+        select
+        p.*,
+        c.id as c_id,
+        c.code as c_code,
+        c.name as c_name,
+        c.create_time as c_create_time,
+        c.status as c_status,
+        u.user_id as u_user_id,
+        u.dept_id as u_dept_id,
+        u.user_name as user_name,
+        u.nick_name as nick_name,
+        u.email as email,
+        u.phonenumber as phonenumber,
+        u.sex as sex,
+        u.avatar as avatar,
+        u.status as status,
+        u.del_flag as del_flag,
+        pd.doc_id
+        from dc_project p
+        left join dc_project_category c on p.category_id = c.id
+        left join sys_user u on p.user_id = u.user_id
+        left join dc_project_document pd on p.id = pd.project_id and pd.status != 4
+        <where>
+            p.status != 4
+            <if test="name != null and name != ''">
+                AND p.name like concat('%', #{name}, '%')
+            </if>
+            <if test="status != null">
+                AND p.status = #{status}
+            </if>
+        </where>
+        order by p.id desc
+    </select>
+</mapper>

+ 47 - 0
ruoyi-system/src/main/resources/mapper/document/TemplateCategoryMapper.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.document.mapper.TemplateCategoryMapper">
+
+    <!-- 结果映射 -->
+    <resultMap type="TemplateCategory" id="TemplateCategoryResult">
+        <id     property="id"          column="id"          />
+        <result property="name"        column="name"        />
+        <result property="intro"       column="intro"       />
+        <result property="parent_id"   column="parent_id"   />
+        <result property="create_time" column="create_time" />
+        <result property="status"      column="status"      />
+    </resultMap>
+
+    <!-- 查询顶级分类列表 -->
+    <select id="selectTopCategoryList" resultMap="TemplateCategoryResult">
+        select * from dc_template_category
+        <where>
+            parent_id = '0'
+            and status != 4
+            <if test="name != null and name != ''">
+                AND name like concat('%', #{name}, '%')
+            </if>
+            <if test="status != null">
+                AND status = #{status}
+            </if>
+        </where>
+        order by id desc
+    </select>
+
+    <!-- 查询子分类列表 -->
+    <select id="selectChildCategoryList" resultMap="TemplateCategoryResult">
+        select * from dc_template_category
+        where parent_id = #{parent_id}
+          and status != 4
+        order by id desc
+    </select>
+
+    <!-- 查询子分类数量 -->
+    <select id="selectChildCount" resultType="int">
+        select count(*) from dc_template_category
+        where parent_id = #{category_id}
+          and status != 4
+    </select>
+</mapper>

+ 35 - 0
ruoyi-system/src/main/resources/mapper/document/TemplateMapper.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.project.system.mapper.DcTemplateMapper">
+
+    <select id="selectTemplateList" resultType="DcTemplate">
+        SELECT
+        id,
+        code,
+        name,
+        intro,
+        content,
+        attrs,
+        category_id,
+        lay_id,
+        type,
+        user_id,
+        status,
+        create_time
+        FROM dc_template
+        <where>
+            AND status != 4
+            <if test="name != null and name != ''">
+                AND name LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <if test="categoryId != null">
+                AND category_id = #{categoryId}
+            </if>
+            <if test="status != null">
+                AND status = #{status}
+            </if>
+        </where>
+        ORDER BY id DESC
+    </select>
+
+</mapper>

+ 0 - 91
ruoyi-system/src/main/resources/mapper/system/DcDocumentMapper.xml

@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.system.mapper.DcDocumentMapper">
-    
-    <resultMap type="DcDocument" id="DcDocumentResult">
-        <result property="id"    column="id"    />
-        <result property="title"    column="title"    />
-        <result property="data"    column="data"    />
-        <result property="userId"    column="user_id"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="status"    column="status"    />
-        <result property="categoryId"    column="category_id"    />
-        <result property="isTemplate"    column="is_template"    />
-    </resultMap>
-
-    <sql id="selectDcDocumentVo">
-        select id, title, data, user_id, create_time, update_time, status, category_id, is_template from dc_document
-    </sql>
-
-    <select id="selectDcDocumentList" parameterType="DcDocument" resultMap="DcDocumentResult">
-        <include refid="selectDcDocumentVo"/>
-        <where>  
-            <if test="title != null  and title != ''"> and title = #{title}</if>
-            <if test="data != null  and data != ''"> and data = #{data}</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
-            <if test="status != null "> and status = #{status}</if>
-            <if test="categoryId != null "> and category_id = #{categoryId}</if>
-            <if test="isTemplate != null "> and is_template = #{isTemplate}</if>
-        </where>
-    </select>
-    
-    <select id="selectDcDocumentById" parameterType="Long" resultMap="DcDocumentResult">
-        <include refid="selectDcDocumentVo"/>
-        where id = #{id}
-    </select>
-
-    <insert id="insertDcDocument" parameterType="DcDocument">
-        insert into dc_document
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">id,</if>
-            <if test="title != null">title,</if>
-            <if test="data != null">data,</if>
-            <if test="userId != null">user_id,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="status != null">status,</if>
-            <if test="categoryId != null">category_id,</if>
-            <if test="isTemplate != null">is_template,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">#{id},</if>
-            <if test="title != null">#{title},</if>
-            <if test="data != null">#{data},</if>
-            <if test="userId != null">#{userId},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="status != null">#{status},</if>
-            <if test="categoryId != null">#{categoryId},</if>
-            <if test="isTemplate != null">#{isTemplate},</if>
-         </trim>
-    </insert>
-
-    <update id="updateDcDocument" parameterType="DcDocument">
-        update dc_document
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="title != null">title = #{title},</if>
-            <if test="data != null">data = #{data},</if>
-            <if test="userId != null">user_id = #{userId},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="status != null">status = #{status},</if>
-            <if test="categoryId != null">category_id = #{categoryId},</if>
-            <if test="isTemplate != null">is_template = #{isTemplate},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteDcDocumentById" parameterType="Long">
-        delete from dc_document where id = #{id}
-    </delete>
-
-    <delete id="deleteDcDocumentByIds" parameterType="String">
-        delete from dc_document where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 160 - 0
创建表语句.txt

@@ -0,0 +1,160 @@
+-- ----------------------------
+-- 1. 模板分类表
+-- ----------------------------
+CREATE TABLE `dc_template_category` (
+  `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '分类ID',
+  `name` VARCHAR(60) NOT NULL COMMENT '分类名称',
+  `parent_id` INT(11) DEFAULT '0' COMMENT '父级ID',
+  `intro` TEXT COMMENT '分类介绍',
+  `create_time` DATETIME DEFAULT NULL COMMENT '创建日期',
+  `status` SMALLINT(6) NOT NULL COMMENT '状态(5-使用中 6-已停用 4-已删除)',
+  PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COMMENT='模板分类表';
+
+-- ----------------------------
+-- 2. 模板表
+-- ----------------------------
+CREATE TABLE `dc_template` (
+  `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '模板ID',
+  `code` VARCHAR(60) NOT NULL COMMENT '模板编码',
+  `name` VARCHAR(60) NOT NULL COMMENT '模板名称',
+  `category_id` INT(11) DEFAULT '0' COMMENT '分类ID',
+  `lay_id` VARCHAR(60) DEFAULT NULL COMMENT '布局ID',
+  `type` VARCHAR(60) DEFAULT NULL COMMENT '模板类型',
+  `content` TEXT COMMENT '模板内容',
+  `attrs` TEXT  COMMENT '模板属性',
+  `intro` TEXT COMMENT '模板介绍',
+  `admin_id` INT(11) DEFAULT '0' COMMENT '管理员ID',
+  `create_time` DATETIME DEFAULT NULL COMMENT '创建日期',
+  `status` SMALLINT(6) NOT NULL COMMENT '状态(5-使用中 6-已停用 4-已删除)',
+  PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COMMENT='模板表';
+
+
+-- ----------------------------
+-- 1. 项目分类表
+-- ----------------------------
+CREATE TABLE dc_project_category (
+  id int NOT NULL AUTO_INCREMENT,
+  code varchar(60) NOT NULL COMMENT '分类编码',
+  name varchar(255) NOT NULL COMMENT '分类名称',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- 2. 项目表
+-- ----------------------------
+CREATE TABLE dc_project (
+  id int NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL COMMENT '项目名称',
+  intro text COMMENT '项目介绍',
+  user_id bigint COMMENT '用户ID',
+  category_id int COMMENT '分类ID',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- 3. 项目文档关联表
+-- ----------------------------
+CREATE TABLE dc_project_document (
+  id int NOT NULL AUTO_INCREMENT,
+  project_id int COMMENT '项目ID',
+  doc_id int COMMENT '文档ID',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+
+
+
+-- ----------------------------
+-- 1. 产品分类表
+-- ----------------------------
+CREATE TABLE dc_product_category (
+  id int NOT NULL AUTO_INCREMENT,
+  parent_id int COMMENT '父级ID',
+  name varchar(255) NOT NULL COMMENT '分类名称',
+  attrs text COMMENT '属性配置',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- 2. 品牌表
+-- ----------------------------
+CREATE TABLE dc_brand (
+  id int NOT NULL AUTO_INCREMENT,
+  name varchar(255) NOT NULL COMMENT '品牌名称',
+  intro text COMMENT '品牌介绍',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- 3. 供应商表
+-- ----------------------------
+CREATE TABLE dc_supplier (
+  id int NOT NULL AUTO_INCREMENT,
+  code varchar(255) NOT NULL COMMENT '供应商编码',
+  name varchar(255) NOT NULL COMMENT '供应商名称',
+  intro text COMMENT '供应商介绍',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id),
+  UNIQUE KEY (code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- 4. 产品表
+-- ----------------------------
+CREATE TABLE dc_product (
+  id int NOT NULL AUTO_INCREMENT,
+  category_id int COMMENT '分类ID',
+  brand_id int COMMENT '品牌ID',
+  supplier_id int COMMENT '供应商ID',
+  name varchar(255) NOT NULL COMMENT '产品名称',
+  intro text COMMENT '产品介绍',
+  price decimal(10,2) COMMENT '产品价格',
+  product_area varchar(255) COMMENT '产地',
+  is_safe smallint COMMENT '是否安全',
+  safe_time varchar(255) COMMENT '安全期',
+  is_package smallint COMMENT '是否包装',
+  package_intro text COMMENT '包装说明',
+  qualifications text COMMENT '资质说明',
+  attrs text COMMENT '属性配置',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- 5. 产品文档关联表
+-- ----------------------------
+CREATE TABLE dc_product_document (
+  id int NOT NULL AUTO_INCREMENT,
+  product_id int COMMENT '产品ID',
+  document_id int COMMENT '文档ID',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+-- ----------------------------
+-- 1. 模板分类表
+-- ----------------------------
+CREATE TABLE dc_template_category (
+  id int NOT NULL AUTO_INCREMENT COMMENT '分类ID',
+  name varchar(255) NOT NULL COMMENT '分类名称',
+  intro text COMMENT '分类介绍',
+  parent_id varchar(100) DEFAULT '0' COMMENT '父类ID',
+  create_time datetime COMMENT '创建时间',
+  status smallint COMMENT '状态',
+  PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='模板分类';
+