Ver Fonte

代码提交

cxd há 6 meses atrás
pai
commit
f370d270c0

+ 167 - 131
gqy-admin/src/main/java/com/gqy/web/controller/document/DcDocumentController.java

@@ -9,6 +9,9 @@ import com.gqy.common.core.domain.model.LoginUser;
 import com.gqy.common.core.text.Convert;
 import com.gqy.common.core.text.Convert;
 import com.gqy.common.enums.BusinessType;
 import com.gqy.common.enums.BusinessType;
 import com.gqy.common.utils.SecurityUtils;
 import com.gqy.common.utils.SecurityUtils;
+import com.gqy.common.utils.bean.BeanUtils;
+import com.gqy.document.domain.DcDocument;
+import com.gqy.document.domain.DcbBlock;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.Document;
 import com.gqy.document.service.IDocumentService;
 import com.gqy.document.service.IDocumentService;
@@ -44,153 +47,186 @@ public class DcDocumentController extends BaseController
     @Autowired
     @Autowired
     private IDocumentService documentService;
     private IDocumentService documentService;
 
 
-    @PostMapping("/test001")
-    public String test001(@RequestBody Map map)
-    {
-        System.out.println(JSON.toJSONString(map));
-        return "succ";
-    }
-
-    @Autowired
-    private IExportService exportService;
 
 
     /**
     /**
-     * 导出文档
-     * @param content
-     * @return
+     * 获取数据块列表
      */
      */
-    @PostMapping("/export")
-    public AjaxResultCQY export(@RequestBody  Map content) {
-        String contentStr = (String) content.get("content");
-        return exportService.export(contentStr);
+    @PostMapping("/list")
+    public @ResponseBody AjaxResultCQY list(@RequestBody Map maps) {
+
+        Integer page = (Integer) maps.get("page");
+        Integer pageSize =(Integer) maps.get("pageSize");
+        DcDocument dcDocument = new DcDocument();
+        BeanUtils.mapToBean(maps, dcDocument);
+        PageResult pageResult =  documentService.selectDcDocumentList(page,pageSize,dcDocument);
+        return AjaxResultCQY.success("查询成功", pageResult);
     }
     }
 
 
     /**
     /**
-     * 创建文档
+     * 创建文档信息
+     * @param document
+     * @return
      */
      */
-    @PostMapping("/create")
-    @PreAuthorize("@ss.hasPermi('system:document:add')")
-    @Log(title = "文档管理", businessType = BusinessType.INSERT)
-    public AjaxResultCQY create(@RequestBody  Map request, @RequestParam(value = "file", required = false) MultipartFile file) {
-        return documentService.create(request, file);
-    }
+    @PostMapping("/add")
+    public AjaxResultCQY add(@RequestBody DcDocument document) {
 
 
+        documentService.insertDcDocument(document);
 
 
-    /**
-     * 更新文档
-     */
-    @PostMapping("/update")
-    public AjaxResultCQY update(@RequestBody Document document) {
-        return documentService.updateDocument(document);
+        return null;
     }
     }
 
 
-
     /**
     /**
-     * 分页查询文档列表
      *
      *
-     * @param request HTTP请求对象,包含以下参数:
-     *        page: 页码(默认1)
-     *        pageSize: 每页数量(默认10)
-     *        title: 文档标题(可选)
-     *        category_id: 分类ID(可选)
-     *        user_id: 用户ID(可选)
-     * @return AjaxResult 返回结果:
-     *         status: 状态码(200成功,500失败)
-     *         message: 提示信息
-     *         data: 分页数据对象
+     * @param document
+     * @return
      */
      */
-    @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());
-        }
-    }
-
-    @PostMapping("/searchlistDoc")
-    public @ResponseBody AjaxResultCQY searchlistDoc(@RequestBody Map maps){
-
-        try {
-            // 获取请求参数
-            Integer page = (Integer) maps.get("page");
-            Integer pageSize =(Integer) maps.get("pageSize");
-            String title =(String) maps.get("title");
-            String category_id = (String) maps.get("category_id");
-
-            // 构建查询对象
-            Document document = new Document();
-            document.setTitle(title);
-            if (category_id != null && !"".equals(category_id)) {
-                document.setCategory_id(Long.valueOf(category_id));
-            }
-            // 获取当前登录用户信息
-            Long loginUserId = SecurityUtils.getUserId();
-            // 判断是否为管理员
-            boolean isAdmin = SecurityUtils.isAdmin(loginUserId);
-
-            // 设置权限过滤
-            if (isAdmin) {
-                document.getParams().put("is_admin", true);
-            } else {
-                document.getParams().put("is_admin", false);
-                document.getParams().put("login_user_id", loginUserId);
-            }
-            PageResult pageResult = documentService.searchlistDoc(page, pageSize, document);
-
-            // 6. 返回成功结果
-            return AjaxResultCQY.success("查询成功", pageResult);
-        }catch(Exception e){
-            log.error("查询文档列表失败", e);
-            return AjaxResultCQY.success("查询成功", new PageResult());
-        }
+    @PostMapping("/update")
+    public AjaxResultCQY update(@RequestBody DcDocument document){
+        documentService.updateDcDocument(document);
+        return null;
     }
     }
 
 
-
-    /**
-     * 获取文档详细信息
-     */
-    @PostMapping("/info")
-    public @ResponseBody  AjaxResultCQY info(@RequestBody  Map map) {
-        String id = map.get("id").toString();
-        if (id == null || "".equals(id)) {
-            return AjaxResultCQY.error("文档ID不能为空");
-        }
-        Map<String, Object>  document = documentService.info(Long.valueOf(id));
-        if (document == null) {
-            return AjaxResultCQY.error("文档不存在或无权限访问");
-        }
-        return AjaxResultCQY.success(document);
-    }
+//
+//    @Autowired
+//    private IExportService exportService;
+
+//    /**
+//     * 导出文档
+//     * @param content
+//     * @return
+//     */
+//    @PostMapping("/export")
+//    public AjaxResultCQY export(@RequestBody  Map content) {
+//        String contentStr = (String) content.get("content");
+//        return exportService.export(contentStr);
+//    }
+//
+//    /**
+//     * 创建文档
+//     */
+//    @PostMapping("/create")
+//    @PreAuthorize("@ss.hasPermi('system:document:add')")
+//    @Log(title = "文档管理", businessType = BusinessType.INSERT)
+//    public AjaxResultCQY create(@RequestBody  Map request, @RequestParam(value = "file", required = false) MultipartFile file) {
+//        return documentService.create(request, file);
+//    }
+//
+//
+//    /**
+//     * 更新文档
+//     */
+//    @PostMapping("/update")
+//    public AjaxResultCQY update(@RequestBody Document document) {
+//        return documentService.updateDocument(document);
+//    }
+//
+//
+//    /**
+//     * 分页查询文档列表
+//     *
+//     * @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());
+//        }
+//    }
+//
+//    @PostMapping("/searchlistDoc")
+//    public @ResponseBody AjaxResultCQY searchlistDoc(@RequestBody Map maps){
+//
+//        try {
+//            // 获取请求参数
+//            Integer page = (Integer) maps.get("page");
+//            Integer pageSize =(Integer) maps.get("pageSize");
+//            String title =(String) maps.get("title");
+//            String category_id = (String) maps.get("category_id");
+//
+//            // 构建查询对象
+//            Document document = new Document();
+//            document.setTitle(title);
+//            if (category_id != null && !"".equals(category_id)) {
+//                document.setCategory_id(Long.valueOf(category_id));
+//            }
+//            // 获取当前登录用户信息
+//            Long loginUserId = SecurityUtils.getUserId();
+//            // 判断是否为管理员
+//            boolean isAdmin = SecurityUtils.isAdmin(loginUserId);
+//
+//            // 设置权限过滤
+//            if (isAdmin) {
+//                document.getParams().put("is_admin", true);
+//            } else {
+//                document.getParams().put("is_admin", false);
+//                document.getParams().put("login_user_id", loginUserId);
+//            }
+//            PageResult pageResult = documentService.searchlistDoc(page, pageSize, document);
+//
+//            // 6. 返回成功结果
+//            return AjaxResultCQY.success("查询成功", pageResult);
+//        }catch(Exception e){
+//            log.error("查询文档列表失败", e);
+//            return AjaxResultCQY.success("查询成功", new PageResult());
+//        }
+//    }
+//
+//
+//    /**
+//     * 获取文档详细信息
+//     */
+//    @PostMapping("/info")
+//    public @ResponseBody  AjaxResultCQY info(@RequestBody  Map map) {
+//        String id = map.get("id").toString();
+//        if (id == null || "".equals(id)) {
+//            return AjaxResultCQY.error("文档ID不能为空");
+//        }
+//        Map<String, Object>  document = documentService.info(Long.valueOf(id));
+//        if (document == null) {
+//            return AjaxResultCQY.error("文档不存在或无权限访问");
+//        }
+//        return AjaxResultCQY.success(document);
+//    }
 
 
 
 
 
 

+ 26 - 25
gqy-admin/src/main/java/com/gqy/web/controller/document/DcTemplateController.java

@@ -38,31 +38,32 @@ public class DcTemplateController extends BaseController {
      */
      */
     @PostMapping("/searchList")
     @PostMapping("/searchList")
     public @ResponseBody  AjaxResultCQY searchList(@RequestBody  Map request) {
     public @ResponseBody  AjaxResultCQY searchList(@RequestBody  Map request) {
-        String page = request.get("page").toString();
-        String pageSizeStr = request.get("pageSize").toString();
-        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
-        Integer pageSize = StringUtils.isNotEmpty(pageSizeStr) ? Integer.valueOf(pageSizeStr) : 10;
-        String category_id = request.get("category_id").toString();
-        Document dcTemplateQuery = new Document();
-        if(StringUtils.isNotEmpty(category_id)){
-            dcTemplateQuery.setCategory_id(Long.valueOf(category_id));
-
-        }
-        PageHelper.startPage(pageNum, pageSize);
-
-        List<Document> list = iDocumentService.searchList(dcTemplateQuery);
-        // 3. 获取分页信息
-        PageInfo<Document> pageInfo = new PageInfo<>(list);
-
-        // 4. 封装并返回结果
-        PageResult PageResult=  new PageResult(
-                pageInfo.getPageNum(),
-                pageInfo.getPageSize(),
-                pageInfo.getPages(),
-                pageInfo.getTotal(),
-                pageInfo.getList());
-
-        return AjaxResultCQY.success("查询成功", PageResult);
+//        String page = request.get("page").toString();
+//        String pageSizeStr = request.get("pageSize").toString();
+//        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
+//        Integer pageSize = StringUtils.isNotEmpty(pageSizeStr) ? Integer.valueOf(pageSizeStr) : 10;
+//        String category_id = request.get("category_id").toString();
+//        Document dcTemplateQuery = new Document();
+//        if(StringUtils.isNotEmpty(category_id)){
+//            dcTemplateQuery.setCategory_id(Long.valueOf(category_id));
+//
+//        }
+//        PageHelper.startPage(pageNum, pageSize);
+//
+//        List<Document> list = iDocumentService.searchList(dcTemplateQuery);
+//        // 3. 获取分页信息
+//        PageInfo<Document> pageInfo = new PageInfo<>(list);
+//
+//        // 4. 封装并返回结果
+//        PageResult PageResult=  new PageResult(
+//                pageInfo.getPageNum(),
+//                pageInfo.getPageSize(),
+//                pageInfo.getPages(),
+//                pageInfo.getTotal(),
+//                pageInfo.getList());
+
+//        return AjaxResultCQY.success("查询成功", PageResult);
+        return null;
     }
     }
 
 
 
 

+ 87 - 0
gqy-system/src/main/java/com/gqy/document/domain/DcDocument.java

@@ -0,0 +1,87 @@
+package com.gqy.document.domain;
+
+/**
+ * 文档信息对象 dc_document
+ *
+ * @author gqy
+ */
+public class DcDocument {
+
+
+    /** 主键ID */
+    private Long dcmId;
+
+    /** 状态(5-使用中 4-已删除 6-已归档) */
+    private Integer dcmStatus;
+
+    /** 文档标题 */
+    private String dcmTitle;
+
+    /** 创建人ID */
+    private Long dcmOwner;
+
+    /** 文档模板类型(1.官方模板 2.自定义模板) */
+    private Integer dcmType;
+
+    /** 修改标记 */
+    private Integer dcmXbj;
+
+    /** 文档内容 */
+    private String dcmData;
+
+    public Long getDcmId() {
+        return dcmId;
+    }
+
+    public void setDcmId(Long dcmId) {
+        this.dcmId = dcmId;
+    }
+
+    public Integer getDcmStatus() {
+        return dcmStatus;
+    }
+
+    public void setDcmStatus(Integer dcmStatus) {
+        this.dcmStatus = dcmStatus;
+    }
+
+    public String getDcmTitle() {
+        return dcmTitle;
+    }
+
+    public void setDcmTitle(String dcmTitle) {
+        this.dcmTitle = dcmTitle;
+    }
+
+    public Long getDcmOwner() {
+        return dcmOwner;
+    }
+
+    public void setDcmOwner(Long dcmOwner) {
+        this.dcmOwner = dcmOwner;
+    }
+
+    public Integer getDcmType() {
+        return dcmType;
+    }
+
+    public void setDcmType(Integer dcmType) {
+        this.dcmType = dcmType;
+    }
+
+    public Integer getDcmXbj() {
+        return dcmXbj;
+    }
+
+    public void setDcmXbj(Integer dcmXbj) {
+        this.dcmXbj = dcmXbj;
+    }
+
+    public String getDcmData() {
+        return dcmData;
+    }
+
+    public void setDcmData(String dcmData) {
+        this.dcmData = dcmData;
+    }
+}

+ 81 - 42
gqy-system/src/main/java/com/gqy/document/mapper/DocumentMapper.java

@@ -1,6 +1,7 @@
 package com.gqy.document.mapper;
 package com.gqy.document.mapper;
 
 
 
 
+import com.gqy.document.domain.DcDocument;
 import com.gqy.document.domain.DcTemplate;
 import com.gqy.document.domain.DcTemplate;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.Document;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -16,67 +17,105 @@ import java.util.Map;
  */
  */
 public interface DocumentMapper
 public interface DocumentMapper
 {
 {
-    /**
-     * 新增文档
-     */
-    public int insertDocument(Document document);
 
 
     /**
     /**
-     * 校验文档标题是否唯一
+     * 查询文档信息
      */
      */
-    public Document checkDocumentTitleUnique(@Param("title") String title, @Param("is_template") Integer is_template);
+    public DcDocument selectDcDocumentByDcmId(Long dcmId);
 
 
     /**
     /**
-     * 查询文档列表
+     * 查询文档信息列表
      */
      */
-    List<Map<String, Object>> pageDocument(Document document);
+    public List<DcDocument> selectDcDocumentList(DcDocument dcDocument);
 
 
     /**
     /**
-     * 查询文档列表
-     *
-     * @param document 文档信息
-     * @return 文档集合
+     * 新增文档信息
      */
      */
-    public List<Document> selectDocumentList(Document document);
+    public int insertDcDocument(DcDocument dcDocument);
 
 
     /**
     /**
-     * 查询文档详情
-     *
-     * @param id 文档ID
-     * @return 文档信息
+     * 修改文档信息
      */
      */
-    public Document info(Long id);
+    public int updateDcDocument(DcDocument dcDocument);
 
 
     /**
     /**
-     * 获取文档关联的产品ID列表
-     *
-     * @param documentId 文档ID
-     * @return 关联的产品ID列表
+     * 删除文档信息
      */
      */
-    List<Long> selectProductDocumentsByDocId(Long documentId);
+    public int deleteDcDocumentByDcmId(Long dcmId);
 
 
     /**
     /**
-     * 获取文档关联的项目ID列表
-     *
-     * @param documentId 文档ID
-     * @return 关联的项目ID列表
+     * 批量删除文档信息
      */
      */
-    List<Long> selectProjectDocumentsByDocId(Long documentId);
+    public int deleteDcDocumentByDcmIds(Long[] dcmIds);
+
+
+//    /**
+//     * 新增文档
+//     */
+//    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);
+//
+//    /**
+//     * 查询文档列表
+//     *
+//     * @param document 文档信息
+//     * @return 文档集合
+//     */
+//    public List<Document> selectDocumentList(Document document);
+//
+//    /**
+//     * 查询文档详情
+//     *
+//     * @param id 文档ID
+//     * @return 文档信息
+//     */
+//    public Document info(Long id);
+//
+//    /**
+//     * 获取文档关联的产品ID列表
+//     *
+//     * @param documentId 文档ID
+//     * @return 关联的产品ID列表
+//     */
+//    List<Long> selectProductDocumentsByDocId(Long documentId);
+//
+//    /**
+//     * 获取文档关联的项目ID列表
+//     *
+//     * @param documentId 文档ID
+//     * @return 关联的项目ID列表
+//     */
+//    List<Long> selectProjectDocumentsByDocId(Long documentId);
+//
+//    /**
+//     * 查询模板列表
+//     *
+//     * @param template 模板信息
+//     * @return 模板集合
+//     */
+//    public List<Document> searchList(Document template);
+//
+//    /**
+//     * 更新文档信息
+//     *
+//     * @param document 文档信息
+//     * @return 结果
+//     */
+//    public int updateDocument(Document document);
+
+
+
+
 
 
-    /**
-     * 查询模板列表
-     *
-     * @param template 模板信息
-     * @return 模板集合
-     */
-    public List<Document> searchList(Document template);
 
 
-    /**
-     * 更新文档信息
-     *
-     * @param document 文档信息
-     * @return 结果
-     */
-    public int updateDocument(Document document);
 
 
 }
 }

+ 74 - 0
gqy-system/src/main/java/com/gqy/document/service/IDcbBlockService.java

@@ -0,0 +1,74 @@
+package com.gqy.document.service;
+
+
+import com.gqy.document.domain.DcbBlock;
+import com.gqy.document.domain.vo.PageResult;
+
+import java.util.List;
+
+/**
+ * 数据块服务接口
+ *
+ * @author gqy
+ */
+public interface IDcbBlockService {
+
+
+    /**
+     * 查询块列表信息
+     * @param page
+     * @param pageSize
+     * @param document
+     * @return
+     */
+    public PageResult searchlistDoc(Integer page, Integer pageSize, DcbBlock document);
+
+    /**
+     * 查询数据块列表
+     *
+     * @param dcbBlock 数据块信息
+     * @return 数据块集合
+     */
+    List<DcbBlock> selectDcbBlockList(DcbBlock dcbBlock);
+
+    /**
+     * 根据ID查询数据块
+     *
+     * @param dcbId 数据块ID
+     * @return 数据块信息
+     */
+    DcbBlock selectDcbBlockById(Long dcbId);
+
+    /**
+     * 新增数据块
+     *
+     * @param dcbBlock 数据块信息
+     * @return 结果
+     */
+    int insertDcbBlock(DcbBlock dcbBlock);
+
+    /**
+     * 修改数据块
+     *
+     * @param dcbBlock 数据块信息
+     * @return 结果
+     */
+    int updateDcbBlock(DcbBlock dcbBlock);
+
+    /**
+     * 删除数据块信息
+     *
+     * @param dcbId 数据块ID
+     * @return 结果
+     */
+    int deleteDcbBlockById(Long dcbId);
+
+    /**
+     * 批量删除数据块
+     *
+     * @param dcbIds 需要删除的数据ID数组
+     * @return 结果
+     */
+    int deleteDcbBlockByIds(Long[] dcbIds);
+
+}

+ 65 - 35
gqy-system/src/main/java/com/gqy/document/service/IDocumentService.java

@@ -5,6 +5,8 @@ package com.gqy.document.service;
 import com.gqy.common.core.domain.AjaxResult;
 import com.gqy.common.core.domain.AjaxResult;
 
 
 import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.common.core.domain.AjaxResultCQY;
+import com.gqy.document.domain.DcDocument;
+import com.gqy.document.domain.DcbBlock;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.vo.PageResult;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
@@ -21,53 +23,81 @@ import java.util.Map;
 public interface IDocumentService
 public interface IDocumentService
 {
 {
 
 
-    /**
-     * 更新文档
-     * @param document
-     * @return
-     */
-    public AjaxResultCQY updateDocument(Document document);
 
 
     /**
     /**
-     * 创建文档
-     * @param request
-     * @param file
+     * 获取 文档信息列表
+     * @param page
+     * @param pageSize
+     * @param dcDocument
      * @return
      * @return
      */
      */
-    public AjaxResultCQY create(Map request, MultipartFile file);
-
-    /**
-     * 分页查询文档列表
-     *
-     * @param page 页码
-     * @param pageSize 每页数量
-     * @param document 查询条件对象
-     * @return PageResult 分页结果对象
-     */
-    PageResult pageDocument(Integer page, Integer pageSize, Document document);
+    public PageResult selectDcDocumentList(Integer page, Integer pageSize, DcDocument dcDocument);
 
 
 
 
     /**
     /**
-     * 查询文档列表
-     *
-     * @param document 文档信息
-     * @return 文档集合
+     * 查询文档信息列表
      */
      */
-    PageResult searchlistDoc(Integer page, Integer pageSize,Document document);
+    public List<DcDocument> selectDcDocumentList(DcDocument dcDocument);
 
 
     /**
     /**
-     * 查询文档详情
-     *
-     * @param id 文档ID
-     * @return 文档信息
+     * 新增文档信息
      */
      */
-    public Map<String, Object>  info(Long id);
+    public int insertDcDocument(DcDocument dcDocument);
 
 
     /**
     /**
-     * 查询文档列表
-     *
-     * @param document 文档信息
-     * @return 文档集合
+     * 修改文档信息
      */
      */
-    public List<Document> searchList(Document document);
+    public int updateDcDocument(DcDocument dcDocument);
+
+
+
+//    /**
+//     * 更新文档
+//     * @param document
+//     * @return
+//     */
+//    public AjaxResultCQY updateDocument(Document document);
+//
+//    /**
+//     * 创建文档
+//     * @param request
+//     * @param file
+//     * @return
+//     */
+//    public AjaxResultCQY create(Map request, MultipartFile file);
+//
+//    /**
+//     * 分页查询文档列表
+//     *
+//     * @param page 页码
+//     * @param pageSize 每页数量
+//     * @param document 查询条件对象
+//     * @return PageResult 分页结果对象
+//     */
+//    PageResult pageDocument(Integer page, Integer pageSize, Document document);
+//
+//
+//    /**
+//     * 查询文档列表
+//     *
+//     * @param document 文档信息
+//     * @return 文档集合
+//     */
+//    PageResult searchlistDoc(Integer page, Integer pageSize,Document document);
+//
+//    /**
+//     * 查询文档详情
+//     *
+//     * @param id 文档ID
+//     * @return 文档信息
+//     */
+//    public Map<String, Object>  info(Long id);
+//
+//    /**
+//     * 查询文档列表
+//     *
+//     * @param document 文档信息
+//     * @return 文档集合
+//     */
+//    public List<Document> searchList(Document document);
 }
 }

+ 295 - 247
gqy-system/src/main/java/com/gqy/document/service/impl/DcDocumentServiceImpl.java

@@ -11,10 +11,12 @@ import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.common.core.text.Convert;
 import com.gqy.common.core.text.Convert;
 import com.gqy.common.exception.ServiceException;
 import com.gqy.common.exception.ServiceException;
 import com.gqy.common.utils.*;
 import com.gqy.common.utils.*;
+import com.gqy.document.domain.DcDocument;
 import com.gqy.document.domain.ProductDocument;
 import com.gqy.document.domain.ProductDocument;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.ProjectDocument;
 import com.gqy.document.domain.ProjectDocument;
+import com.gqy.document.mapper.DcProductMapper;
 import com.gqy.document.mapper.DocumentMapper;
 import com.gqy.document.mapper.DocumentMapper;
 import com.gqy.document.mapper.ProductDocumentMapper;
 import com.gqy.document.mapper.ProductDocumentMapper;
 import com.gqy.document.mapper.ProjectDocumentMapper;
 import com.gqy.document.mapper.ProjectDocumentMapper;
@@ -40,271 +42,317 @@ public class DcDocumentServiceImpl implements IDocumentService
 {
 {
 
 
     private static final Logger log = LoggerFactory.getLogger(DcDocumentServiceImpl.class);
     private static final Logger log = LoggerFactory.getLogger(DcDocumentServiceImpl.class);
-    @Autowired
-    private DocumentMapper documentMapper;
 
 
-    @Autowired
-    private ProjectDocumentMapper projectDocumentMapper;
+
 
 
     @Autowired
     @Autowired
-    private ProductDocumentMapper productDocumentMapper;
+    private DocumentMapper documentMapper;
 
 
     /**
     /**
-     * 更新文档
-     * @param document
+     *
+     * @param page
+     * @param pageSize
+     * @param dcDocument
      * @return
      * @return
      */
      */
-    @Transactional
-    public AjaxResultCQY updateDocument(Document document) {
-        try {
-            log.info("开始更新文档信息, 文档ID: {}", document.getId());
-            // 1. 检查文档是否存在
-            Document existDoc = documentMapper.info(document.getId());
-            if (existDoc == null) {
-                log.warn("文档不存在, 文档ID: {}", document.getId());
-                return AjaxResultCQY.error("更新文档信息失败:文档不存在");
-            }
-            // 2. 更新文档基本信息
-            log.info("更新文档基本信息: {}", document);
-            int rows = documentMapper.updateDocument(document);
-            if (rows <= 0) {
-                return AjaxResultCQY.error("更新文档基本信息失败");
-            }
-            // 3. 更新产品关联
-            log.info("开始更新文档产品关联, 文档ID: {}", document.getId());
-            productDocumentMapper.deleteProductDocumentByDocId(document.getId());
-            if (CollectionUtils.isNotEmpty(document.getLinks())) {
-
-                List<ProductDocument> productDocs = document.getLinks().stream()
-                        .map(productId -> {
-                            ProductDocument pd = new ProductDocument();
-                            pd.setDocument_id(document.getId());
-                            pd.setProduct_id(Long.valueOf(productId));
-                            pd.setStatus(5);
-                            return pd;
-                        })
-                        .collect(Collectors.toList());
-                productDocumentMapper.batchInsertProductDocument(productDocs);
-            }
-
-            log.info("开始更新文档项目关联, 文档ID: {}", document.getId());
-            projectDocumentMapper.deleteProjectDocumentByDocId(document.getId());
-            if (CollectionUtils.isNotEmpty(document.getProjects())) {
-                List<ProjectDocument> projectDocs = document.getProjects().stream().map(projectId -> {
-                            ProjectDocument pd = new ProjectDocument();
-                            pd.setDoc_id(document.getId());
-                            pd.setProject_id(Long.valueOf(projectId));
-                            pd.setStatus(5);
-                            return pd;
-                        }).collect(Collectors.toList());
-                projectDocumentMapper.batchInsertProjectDocument(projectDocs);
-            }
-            log.info("文档更新成功, 文档ID: {}", document.getId());
-            return AjaxResultCQY.success(document.getId());
-        }catch (Exception e){
-            log.error("更新文档失败, 文档ID: {}, 错误信息: {}", document.getId(), e.getMessage(), e);
-            return AjaxResultCQY.error("更新文档失败:" + e.getMessage());
-        }
+    public PageResult selectDcDocumentList(Integer page, Integer pageSize, DcDocument dcDocument){
+        PageHelper.startPage(page, pageSize);
+        List<DcDocument> list = documentMapper.selectDcDocumentList(dcDocument);
+        PageInfo<DcDocument> pageInfo = new PageInfo<>(list);
+        return new PageResult(
+                pageInfo.getPageNum(),
+                pageInfo.getPageSize(),
+                pageInfo.getPages(),
+                pageInfo.getTotal(),
+                pageInfo.getList()
+        );
     }
     }
 
 
-    /**
-     * 创建文档
-     * @param request
-     * @param file
-     * @return
-     */
-    @Transactional
-    public AjaxResultCQY create(Map request, MultipartFile file) {
-        try {
-            // 1. 获取表单参数
-            String title = (String) request.get("title");
-            String data = (String)request.get("data");
-            Integer isTemplate = (Integer)request.get("is_template");
-            Integer status = (Integer)request.get("status");
-            String projects = (String)request.get("projects");
-
-            // 2. 参数校验
-            if (StringUtils.isEmpty(title)) {
-                return AjaxResultCQY.error("文档标题不能为空");
-            }
-
-            Integer templateFlag = Convert.toInt(isTemplate, 0);
-//            if (templateFlag == 0 && StringUtils.isEmpty(request.get("category_id").toString())) {
-//                return AjaxResult.error("保存文档时,分类不能为空");
-//            }
-
-          //  Integer categoryId = Integer.valueOf(request.get("category_id").toString());
-
-
-            // 3. 检查标题是否重复
-            Document existDoc = documentMapper.checkDocumentTitleUnique(title, templateFlag);
-            if (StringUtils.isNotNull(existDoc)) {
-                String type = templateFlag == 1 ? "模板" : "文档";
-                return AjaxResultCQY.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( Long.valueOf(categoryId));
-            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 AjaxResultCQY.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 AjaxResultCQY.success("创建成功", document.getId());
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new ServiceException("创建文档失败:" + e.getMessage());
-        }
+    @Override
+    public List<DcDocument> selectDcDocumentList(DcDocument dcDocument) {
+        return documentMapper.selectDcDocumentList(dcDocument);
     }
     }
 
 
     @Override
     @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);
-        }
-
+    public int insertDcDocument(DcDocument dcDocument) {
+        return 0;
     }
     }
 
 
-    /**
-     * 查询文档列表
-     * @param page
-     * @param pageSize
-     * @param document
-     * @return
-     */
-    public PageResult searchlistDoc(Integer page, Integer pageSize,Document document) {
-
-        try {
-            // 1. 设置分页参数
-            PageHelper.startPage(page, pageSize);
-            // 2. 执行查询
-            List<Document> list = documentMapper.selectDocumentList(document);
-            // 3. 获取分页信息
-            PageInfo<Document> 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);
-        }
+    @Override
+    public int updateDcDocument(DcDocument dcDocument) {
+        return 0;
     }
     }
 
 
 
 
-    /**
-     * 查询文档详情
-     *
-     * @param id 文档ID
-     * @return 文档信息
-     */
-    public Map<String, Object>  info(Long id) {
-        Document doc = documentMapper.info(id);
-        Map<String, Object> result = new HashMap<>();
-        result.put("id", doc.getId());
-        result.put("title", doc.getTitle());
-        result.put("data", doc.getData());
-      //  result.put("user_id", doc.getUserId());
-
-        // 获取关联产品
-        result.put("linkProduct", documentMapper.selectProductDocumentsByDocId(id));
-        result.put("links", "");
-
-        // 获取关联项目
-        result.put("linkProject", documentMapper.selectProjectDocumentsByDocId(id));
-        result.put("projects", "");
-
-        result.put("category_id", doc.getCategory_id());
-        result.put("createTime", doc.getCreateTime());
-        result.put("status", doc.getStatus());
-        result.put("is_template", doc.getIs_template());
-
-        return result;
-    }
-
-    /**
-     * 查询文档列表
-     *
-     * @param document 文档信息
-     * @return 文档集合
-     */
-    public List<Document> searchList(Document document){
-        return documentMapper.searchList(document);
-    }
+//    @Autowired
+//    private DocumentMapper documentMapper;
+//
+//    @Autowired
+//    private ProjectDocumentMapper projectDocumentMapper;
+//
+//    @Autowired
+//    private ProductDocumentMapper productDocumentMapper;
+//
+//    /**
+//     * 更新文档
+//     * @param document
+//     * @return
+//     */
+//    @Transactional
+//    public AjaxResultCQY updateDocument(Document document) {
+////        try {
+////            log.info("开始更新文档信息, 文档ID: {}", document.getId());
+////            // 1. 检查文档是否存在
+////            Document existDoc = documentMapper.info(document.getId());
+////            if (existDoc == null) {
+////                log.warn("文档不存在, 文档ID: {}", document.getId());
+////                return AjaxResultCQY.error("更新文档信息失败:文档不存在");
+////            }
+////            // 2. 更新文档基本信息
+////            log.info("更新文档基本信息: {}", document);
+////            int rows = documentMapper.updateDocument(document);
+////            if (rows <= 0) {
+////                return AjaxResultCQY.error("更新文档基本信息失败");
+////            }
+////            // 3. 更新产品关联
+////            log.info("开始更新文档产品关联, 文档ID: {}", document.getId());
+////            productDocumentMapper.deleteProductDocumentByDocId(document.getId());
+////            if (CollectionUtils.isNotEmpty(document.getLinks())) {
+////
+////                List<ProductDocument> productDocs = document.getLinks().stream()
+////                        .map(productId -> {
+////                            ProductDocument pd = new ProductDocument();
+////                            pd.setDocument_id(document.getId());
+////                            pd.setProduct_id(Long.valueOf(productId));
+////                            pd.setStatus(5);
+////                            return pd;
+////                        })
+////                        .collect(Collectors.toList());
+////                productDocumentMapper.batchInsertProductDocument(productDocs);
+////            }
+////
+////            log.info("开始更新文档项目关联, 文档ID: {}", document.getId());
+////            projectDocumentMapper.deleteProjectDocumentByDocId(document.getId());
+////            if (CollectionUtils.isNotEmpty(document.getProjects())) {
+////                List<ProjectDocument> projectDocs = document.getProjects().stream().map(projectId -> {
+////                            ProjectDocument pd = new ProjectDocument();
+////                            pd.setDoc_id(document.getId());
+////                            pd.setProject_id(Long.valueOf(projectId));
+////                            pd.setStatus(5);
+////                            return pd;
+////                        }).collect(Collectors.toList());
+////                projectDocumentMapper.batchInsertProjectDocument(projectDocs);
+////            }
+////            log.info("文档更新成功, 文档ID: {}", document.getId());
+////            return AjaxResultCQY.success(document.getId());
+////        }catch (Exception e){
+////            log.error("更新文档失败, 文档ID: {}, 错误信息: {}", document.getId(), e.getMessage(), e);
+////            return AjaxResultCQY.error("更新文档失败:" + e.getMessage());
+////        }
+//        return null;
+//    }
+//
+//    /**
+//     * 创建文档
+//     * @param request
+//     * @param file
+//     * @return
+//     */
+//    @Transactional
+//    public AjaxResultCQY create(Map request, MultipartFile file) {
+////        try {
+////            // 1. 获取表单参数
+////            String title = (String) request.get("title");
+////            String data = (String)request.get("data");
+////            Integer isTemplate = (Integer)request.get("is_template");
+////            Integer status = (Integer)request.get("status");
+////            String projects = (String)request.get("projects");
+////
+////            // 2. 参数校验
+////            if (StringUtils.isEmpty(title)) {
+////                return AjaxResultCQY.error("文档标题不能为空");
+////            }
+////
+////            Integer templateFlag = Convert.toInt(isTemplate, 0);
+//////            if (templateFlag == 0 && StringUtils.isEmpty(request.get("category_id").toString())) {
+//////                return AjaxResult.error("保存文档时,分类不能为空");
+//////            }
+////
+////          //  Integer categoryId = Integer.valueOf(request.get("category_id").toString());
+////
+////
+////            // 3. 检查标题是否重复
+////            Document existDoc = documentMapper.checkDocumentTitleUnique(title, templateFlag);
+////            if (StringUtils.isNotNull(existDoc)) {
+////                String type = templateFlag == 1 ? "模板" : "文档";
+////                return AjaxResultCQY.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( Long.valueOf(categoryId));
+////            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 AjaxResultCQY.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 AjaxResultCQY.success("创建成功", document.getId());
+////        } catch (Exception e) {
+////            e.printStackTrace();
+////            throw new ServiceException("创建文档失败:" + e.getMessage());
+////        }
+//        return null;
+//    }
+//
+//    @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);
+//        }
+//
+//    }
+//
+//    /**
+//     * 查询文档列表
+//     * @param page
+//     * @param pageSize
+//     * @param document
+//     * @return
+//     */
+//    public PageResult searchlistDoc(Integer page, Integer pageSize,Document document) {
+////
+////        try {
+////            // 1. 设置分页参数
+////            PageHelper.startPage(page, pageSize);
+////            // 2. 执行查询
+////            List<Document> list = documentMapper.selectDocumentList(document);
+////            // 3. 获取分页信息
+////            PageInfo<Document> 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);
+////        }
+//        return null;
+//    }
+//
+//
+//    /**
+//     * 查询文档详情
+//     *
+//     * @param id 文档ID
+//     * @return 文档信息
+//     */
+//    public Map<String, Object>  info(Long id) {
+//        Document doc = documentMapper.info(id);
+//        Map<String, Object> result = new HashMap<>();
+//        result.put("id", doc.getId());
+//        result.put("title", doc.getTitle());
+//        result.put("data", doc.getData());
+//      //  result.put("user_id", doc.getUserId());
+//
+//        // 获取关联产品
+//        result.put("linkProduct", documentMapper.selectProductDocumentsByDocId(id));
+//        result.put("links", "");
+//
+//        // 获取关联项目
+//        result.put("linkProject", documentMapper.selectProjectDocumentsByDocId(id));
+//        result.put("projects", "");
+//
+//        result.put("category_id", doc.getCategory_id());
+//        result.put("createTime", doc.getCreateTime());
+//        result.put("status", doc.getStatus());
+//        result.put("is_template", doc.getIs_template());
+//
+//        return result;
+//    }
+//
+//    /**
+//     * 查询文档列表
+//     *
+//     * @param document 文档信息
+//     * @return 文档集合
+//     */
+//    public List<Document> searchList(Document document){
+//        return documentMapper.searchList(document);
+//    }
 
 
 
 
 
 

+ 116 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/DcbBlockServiceImpl.java

@@ -0,0 +1,116 @@
+package com.gqy.document.service.impl;
+
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.gqy.document.domain.DcbBlock;
+import com.gqy.document.domain.vo.PageResult;
+import com.gqy.document.mapper.DcbBlockMapper;
+import com.gqy.document.service.IDcbBlockService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 数据块服务实现类
+ *
+ * @author gqy
+ */
+@Service
+public class DcbBlockServiceImpl implements IDcbBlockService {
+
+    @Autowired
+    private DcbBlockMapper dcbBlockMapper;
+
+    /**
+     * 查询块列表信息
+     * @param page
+     * @param pageSize
+     * @param dcbBlock
+     * @return
+     */
+    public PageResult searchlistDoc(Integer page, Integer pageSize, DcbBlock dcbBlock){
+        PageHelper.startPage(page, pageSize);
+
+        List<DcbBlock> list = dcbBlockMapper.selectDcbBlockList(dcbBlock);
+
+        PageInfo<DcbBlock> pageInfo = new PageInfo<>(list);
+
+
+        return new PageResult(
+                pageInfo.getPageNum(),
+                pageInfo.getPageSize(),
+                pageInfo.getPages(),
+                pageInfo.getTotal(),
+                pageInfo.getList()
+        );
+    }
+
+    /**
+     * 查询数据块列表
+     *
+     * @param dcbBlock 数据块信息
+     * @return 数据块集合
+     */
+    @Override
+    public List<DcbBlock> selectDcbBlockList(DcbBlock dcbBlock) {
+        return dcbBlockMapper.selectDcbBlockList(dcbBlock);
+    }
+
+    /**
+     * 根据ID查询数据块
+     *
+     * @param dcbId 数据块ID
+     * @return 数据块信息
+     */
+    @Override
+    public DcbBlock selectDcbBlockById(Long dcbId) {
+        return dcbBlockMapper.selectDcbBlockById(dcbId);
+    }
+
+    /**
+     * 新增数据块
+     *
+     * @param dcbBlock 数据块信息
+     * @return 结果
+     */
+    @Override
+    public int insertDcbBlock(DcbBlock dcbBlock) {
+        return dcbBlockMapper.insertDcbBlock(dcbBlock);
+    }
+
+    /**
+     * 修改数据块
+     *
+     * @param dcbBlock 数据块信息
+     * @return 结果
+     */
+    @Override
+    public int updateDcbBlock(DcbBlock dcbBlock) {
+        return dcbBlockMapper.updateDcbBlock(dcbBlock);
+    }
+
+    /**
+     * 删除数据块信息
+     *
+     * @param dcbId 数据块ID
+     * @return 结果
+     */
+    @Override
+    public int deleteDcbBlockById(Long dcbId) {
+        return dcbBlockMapper.deleteDcbBlockById(dcbId);
+    }
+
+    /**
+     * 批量删除数据块
+     *
+     * @param dcbIds 需要删除的数据ID数组
+     * @return 结果
+     */
+    @Override
+    public int deleteDcbBlockByIds(Long[] dcbIds) {
+        return dcbBlockMapper.deleteDcbBlockByIds(dcbIds);
+    }
+
+}

+ 306 - 225
gqy-system/src/main/resources/mapper/document/DcDocumentMapper.xml

@@ -4,252 +4,333 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.gqy.document.mapper.DocumentMapper">
 <mapper namespace="com.gqy.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"     />
-
-        <result property="type_name"    column="type_name"     />
-
 
 
+    <resultMap type="DcDocument" id="DcDocumentResult">
+        <id     property="dcmId"       column="dcm_id"      />
+        <result property="dcmStatus"   column="dcm_status"  />
+        <result property="dcmTitle"    column="dcm_title"   />
+        <result property="dcmOwner"    column="dcm_owner"   />
+        <result property="dcmType"     column="dcm_type"    />
+        <result property="dcmXbj"      column="dcm_xbj"     />
+        <result property="dcmData"     column="dcm_data"    />
     </resultMap>
     </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
+    <sql id="selectDcDocumentVo">
+        select dcm_id, dcm_status, dcm_title, dcm_owner, dcm_type, dcm_xbj, dcm_data
         from dc_document
         from dc_document
-        where title = #{title}
-          and is_template = #{is_template}
-          and status != 4
-        limit 1
+    </sql>
+
+    <select id="selectDcDocumentList" parameterType="DcDocument" resultMap="DcDocumentResult">
+        <include refid="selectDcDocumentVo"/>
+        <where>
+            <if test="dcmStatus != null "> and dcm_status = #{dcmStatus}</if>
+            <if test="dcmTitle != null  and dcmTitle != ''"> and dcm_title like concat('%', #{dcmTitle}, '%')</if>
+            <if test="dcmOwner != null "> and dcm_owner = #{dcmOwner}</if>
+            <if test="dcmType != null "> and dcm_type = #{dcmType}</if>
+            <if test="dcmXbj != null "> and dcm_xbj = #{dcmXbj}</if>
+        </where>
     </select>
     </select>
 
 
+    <select id="selectDcDocumentByDcmId" parameterType="Long" resultMap="DcDocumentResult">
+        <include refid="selectDcDocumentVo"/>
+        where dcm_id = #{dcmId}
+    </select>
 
 
+    <insert id="insertDcDocument" parameterType="DcDocument" useGeneratedKeys="true" keyProperty="dcmId">
+        insert into dc_document
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            dcm_status,
+            <if test="dcmTitle != null">dcm_title,</if>
+            <if test="dcmOwner != null">dcm_owner,</if>
+            <if test="dcmType != null">dcm_type,</if>
+            <if test="dcmXbj != null">dcm_xbj,</if>
+            <if test="dcmData != null">dcm_data,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            #{dcmStatus},
+            <if test="dcmTitle != null">#{dcmTitle},</if>
+            <if test="dcmOwner != null">#{dcmOwner},</if>
+            <if test="dcmType != null">#{dcmType},</if>
+            <if test="dcmXbj != null">#{dcmXbj},</if>
+            <if test="dcmData != null">#{dcmData},</if>
+         </trim>
+    </insert>
 
 
 
 
-    <sql id="selectDocumentVo">
-        SELECT d.id, d.title, d.data, d.user_id, d.create_time, d.update_time,
-               d.status, d.category_id, 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
-                 LEFT JOIN sys_user u ON d.user_id = u.user_id
-    </sql>
+    <update id="updateDcDocument" parameterType="DcDocument">
+        update dc_document
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="dcmStatus != null">dcm_status = #{dcmStatus},</if>
+            <if test="dcmTitle != null">dcm_title = #{dcmTitle},</if>
+            <if test="dcmOwner != null">dcm_owner = #{dcmOwner},</if>
+            <if test="dcmType != null">dcm_type = #{dcmType},</if>
+            <if test="dcmXbj != null">dcm_xbj = #{dcmXbj},</if>
+            <if test="dcmData != null">dcm_data = #{dcmData},</if>
+        </trim>
+        where dcm_id = #{dcmId}
+    </update>
 
 
-    <select id="selectDocumentList" parameterType="Document" resultMap="DocumentResult">
-        <include refid="selectDocumentVo"/>
-        <where>
-            AND d.status = 5
-            <if test="title != null and title != ''">
-                AND d.title like concat('%', #{title}, '%')
-            </if>
-            <if test="category_id != null">
-                AND d.category_id = #{categoryId}
-            </if>
-            <if test="user_id != null">
-                AND d.user_id = #{userId}
-            </if>
-            <if test="params.isAdmin != null and params.isAdmin == true">
-                AND d.is_template = 0
-            </if>
-            <if test="params.isAdmin != null and params.isAdmin == false">
-                AND d.is_template = 0 AND d.user_id = #{params.loginUserId}
-            </if>
-        </where>
-        ORDER BY d.id DESC
-    </select>
+    <delete id="deleteDcDocumentByDcmId" parameterType="Long">
+        delete from dc_document where dcm_id = #{dcmId}
+    </delete>
 
 
+    <delete id="deleteDcDocumentByDcmIds" parameterType="String">
+        delete from dc_document where dcm_id in
+        <foreach item="dcmId" collection="array" open="(" separator="," close=")">
+            #{dcmId}
+        </foreach>
+    </delete>
 
 
 
 
 
 
-    <!-- 分页查询文档列表 -->
-    <select id="pageDocument" resultType="map" parameterType="Document">
-        SELECT
-        d.id,
-        d.title,
-        d.category_id,
-        d.user_id,
-        DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') as 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-->
-<!--                )-->
-<!--                )-->
-<!--                )-->
+
+
+<!--    <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"     />-->
+
+<!--        <result property="type_name"    column="type_name"     />-->
+
+
+<!--    </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>-->
+
+
+
+
+<!--    <sql id="selectDocumentVo">-->
+<!--        SELECT d.id, d.title, d.data, d.user_id, d.create_time, d.update_time,-->
+<!--               d.status, d.category_id, 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-->
+<!--                 LEFT JOIN sys_user u ON d.user_id = u.user_id-->
+<!--    </sql>-->
+
+<!--    <select id="selectDocumentList" parameterType="Document" resultMap="DocumentResult">-->
+<!--        <include refid="selectDocumentVo"/>-->
+<!--        <where>-->
+<!--            AND d.status = 5-->
+<!--            <if test="title != null and title != ''">-->
+<!--                AND d.title like concat('%', #{title}, '%')-->
 <!--            </if>-->
 <!--            </if>-->
-        </where>
-        ORDER BY d.create_time DESC
-    </select>
+<!--            <if test="category_id != null">-->
+<!--                AND d.category_id = #{categoryId}-->
+<!--            </if>-->
+<!--            <if test="user_id != null">-->
+<!--                AND d.user_id = #{userId}-->
+<!--            </if>-->
+<!--            <if test="params.isAdmin != null and params.isAdmin == true">-->
+<!--                AND d.is_template = 0-->
+<!--            </if>-->
+<!--            <if test="params.isAdmin != null and params.isAdmin == false">-->
+<!--                AND d.is_template = 0 AND d.user_id = #{params.loginUserId}-->
+<!--            </if>-->
+<!--        </where>-->
+<!--        ORDER BY d.id DESC-->
+<!--    </select>-->
 
 
-    <!-- ================  info  -->
-    <resultMap type="Document" id="DocumentResultInfo">
-        <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="create_time"  column="create_time"  />
-        <result property="update_time"  column="update_time"  />
-        <result property="status"       column="status"       />
-        <result property="is_template"  column="is_template"  />
-        <!-- 非数据库字段 -->
-        <result property="category_name" column="category_name"/>
-        <result property="user_name"    column="user_name"    />
-    </resultMap>
 
 
-    <sql id="selectDocumentVoInfo">
-        SELECT d.id, d.title, d.data, d.user_id, d.category_id,
-               d.create_time, d.update_time, d.status, d.is_template,
-               c.name as category_name,
-               u.user_name as user_name
-        FROM dc_document d
-                 LEFT JOIN dc_document_category c ON d.category_id = c.id
-                 LEFT JOIN sys_user u ON d.user_id = u.user_id
-    </sql>
-    <select id="info" parameterType="Long" resultMap="DocumentResult">
-        <include refid="selectDocumentVoInfo"/>
-        <where>
-            AND d.id = #{id}
-            AND d.status != 4
-        </where>
-    </select>
-    <!-- ================  info  -->
 
 
 
 
-    <!-- 获取文档关联的产品ID列表 -->
-    <select id="selectProductDocumentsByDocId" parameterType="Long" resultType="Long">
-        select product_id
-        from dc_product_document
-        where document_id = #{documentId}
-          and status != 4
-    </select>
+<!--    &lt;!&ndash; 分页查询文档列表 &ndash;&gt;-->
+<!--    <select id="pageDocument" resultType="map" parameterType="Document">-->
+<!--        SELECT-->
+<!--        d.id,-->
+<!--        d.title,-->
+<!--        d.category_id,-->
+<!--        d.user_id,-->
+<!--        DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') as 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>-->
+<!--&lt;!&ndash;            <if test="current_user_id != null">&ndash;&gt;-->
+<!--&lt;!&ndash;                AND (&ndash;&gt;-->
+<!--&lt;!&ndash;                d.user_id = #{current_user_id}&ndash;&gt;-->
+<!--&lt;!&ndash;                OR (&ndash;&gt;-->
+<!--&lt;!&ndash;                d.is_template = 1&ndash;&gt;-->
+<!--&lt;!&ndash;                AND d.user_id IN (&ndash;&gt;-->
+<!--&lt;!&ndash;                SELECT user_id FROM sys_user&ndash;&gt;-->
+<!--&lt;!&ndash;                WHERE is_admin = 1&ndash;&gt;-->
+<!--&lt;!&ndash;                )&ndash;&gt;-->
+<!--&lt;!&ndash;                )&ndash;&gt;-->
+<!--&lt;!&ndash;                )&ndash;&gt;-->
+<!--&lt;!&ndash;            </if>&ndash;&gt;-->
+<!--        </where>-->
+<!--        ORDER BY d.create_time DESC-->
+<!--    </select>-->
 
 
-    <!-- 获取文档关联的项目ID列表 -->
-    <select id="selectProjectDocumentsByDocId" parameterType="Long" resultType="Long">
-        select project_id
-        from dc_project_document
-        where doc_id = #{documentId}
-          and status != 4
-    </select>
-    <!-- 获取文档关联的项目ID列表 -->
-
-    <!-- 查询文档列表 -->
-    <select id="searchList" parameterType="Document" resultMap="DocumentResult">
-        SELECT d.id,
-        d.title,
-        d.category_id,
-        d.create_time,
-        d.status,
-        d.is_template,
-        d.user_id,
-        dc.name as type_name
-        <!--
-         su.user_name,
-                ar.is_admin
-                -->
-        FROM dc_document d
-        LEFT JOIN dc_document_category dc ON d.category_id = dc.id
-        <where>
-            d.status = 5
-            AND d.is_template = 1
-<!--            <choose>-->
-<!--                <when test="is_admin != null and is_admin == 1">-->
-<!--                    &lt;!&ndash; 管理员可以看到所有模板 &ndash;&gt;-->
-<!--                </when>-->
-<!--                <otherwise>-->
-<!--                    &lt;!&ndash; 普通用户只能看到自己的和管理员的模板 &ndash;&gt;-->
-<!--                    AND (-->
-<!--                    d.user_id = #{user_id}-->
-<!--                    OR d.user_id IN (-->
-<!--                    SELECT u.user_id-->
-<!--                    FROM sys_user u-->
-<!--                    INNER JOIN sys_admin_role ar ON u.role_id = ar.id-->
-<!--                    WHERE ar.is_admin = 1-->
-<!--                    )-->
-<!--                    )-->
-<!--                </otherwise>-->
-<!--            </choose>-->
-            <!-- 按标题模糊查询 -->
-            <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>
-        </where>
-        ORDER BY d.id DESC
-    </select>
+<!--    &lt;!&ndash; ================  info  &ndash;&gt;-->
+<!--    <resultMap type="Document" id="DocumentResultInfo">-->
+<!--        <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="create_time"  column="create_time"  />-->
+<!--        <result property="update_time"  column="update_time"  />-->
+<!--        <result property="status"       column="status"       />-->
+<!--        <result property="is_template"  column="is_template"  />-->
+<!--        &lt;!&ndash; 非数据库字段 &ndash;&gt;-->
+<!--        <result property="category_name" column="category_name"/>-->
+<!--        <result property="user_name"    column="user_name"    />-->
+<!--    </resultMap>-->
 
 
+<!--    <sql id="selectDocumentVoInfo">-->
+<!--        SELECT d.id, d.title, d.data, d.user_id, d.category_id,-->
+<!--               d.create_time, d.update_time, d.status, d.is_template,-->
+<!--               c.name as category_name,-->
+<!--               u.user_name as user_name-->
+<!--        FROM dc_document d-->
+<!--                 LEFT JOIN dc_document_category c ON d.category_id = c.id-->
+<!--                 LEFT JOIN sys_user u ON d.user_id = u.user_id-->
+<!--    </sql>-->
+<!--    <select id="info" parameterType="Long" resultMap="DocumentResult">-->
+<!--        <include refid="selectDocumentVoInfo"/>-->
+<!--        <where>-->
+<!--            AND d.id = #{id}-->
+<!--            AND d.status != 4-->
+<!--        </where>-->
+<!--    </select>-->
+<!--    &lt;!&ndash; ================  info  &ndash;&gt;-->
 
 
-    <!-- 更新文档信息 -->
-    <update id="updateDocument" parameterType="Document">
-        update dc_document
-        <set>
-            <if test="title != null">title = #{title},</if>
-            <if test="data != null">data = #{data},</if>
-            <if test="status != null">status = #{status},</if>
-            update_time = sysdate()
-        </set>
-        where id = #{id}
-    </update>
+
+<!--    &lt;!&ndash; 获取文档关联的产品ID列表 &ndash;&gt;-->
+<!--    <select id="selectProductDocumentsByDocId" parameterType="Long" resultType="Long">-->
+<!--        select product_id-->
+<!--        from dc_product_document-->
+<!--        where document_id = #{documentId}-->
+<!--          and status != 4-->
+<!--    </select>-->
+
+<!--    &lt;!&ndash; 获取文档关联的项目ID列表 &ndash;&gt;-->
+<!--    <select id="selectProjectDocumentsByDocId" parameterType="Long" resultType="Long">-->
+<!--        select project_id-->
+<!--        from dc_project_document-->
+<!--        where doc_id = #{documentId}-->
+<!--          and status != 4-->
+<!--    </select>-->
+<!--    &lt;!&ndash; 获取文档关联的项目ID列表 &ndash;&gt;-->
+
+<!--    &lt;!&ndash; 查询文档列表 &ndash;&gt;-->
+<!--    <select id="searchList" parameterType="Document" resultMap="DocumentResult">-->
+<!--        SELECT d.id,-->
+<!--        d.title,-->
+<!--        d.category_id,-->
+<!--        d.create_time,-->
+<!--        d.status,-->
+<!--        d.is_template,-->
+<!--        d.user_id,-->
+<!--        dc.name as type_name-->
+<!--        &lt;!&ndash;-->
+<!--         su.user_name,-->
+<!--                ar.is_admin-->
+<!--                &ndash;&gt;-->
+<!--        FROM dc_document d-->
+<!--        LEFT JOIN dc_document_category dc ON d.category_id = dc.id-->
+<!--        <where>-->
+<!--            d.status = 5-->
+<!--            AND d.is_template = 1-->
+<!--&lt;!&ndash;            <choose>&ndash;&gt;-->
+<!--&lt;!&ndash;                <when test="is_admin != null and is_admin == 1">&ndash;&gt;-->
+<!--&lt;!&ndash;                    &lt;!&ndash; 管理员可以看到所有模板 &ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                </when>&ndash;&gt;-->
+<!--&lt;!&ndash;                <otherwise>&ndash;&gt;-->
+<!--&lt;!&ndash;                    &lt;!&ndash; 普通用户只能看到自己的和管理员的模板 &ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                    AND (&ndash;&gt;-->
+<!--&lt;!&ndash;                    d.user_id = #{user_id}&ndash;&gt;-->
+<!--&lt;!&ndash;                    OR d.user_id IN (&ndash;&gt;-->
+<!--&lt;!&ndash;                    SELECT u.user_id&ndash;&gt;-->
+<!--&lt;!&ndash;                    FROM sys_user u&ndash;&gt;-->
+<!--&lt;!&ndash;                    INNER JOIN sys_admin_role ar ON u.role_id = ar.id&ndash;&gt;-->
+<!--&lt;!&ndash;                    WHERE ar.is_admin = 1&ndash;&gt;-->
+<!--&lt;!&ndash;                    )&ndash;&gt;-->
+<!--&lt;!&ndash;                    )&ndash;&gt;-->
+<!--&lt;!&ndash;                </otherwise>&ndash;&gt;-->
+<!--&lt;!&ndash;            </choose>&ndash;&gt;-->
+<!--            &lt;!&ndash; 按标题模糊查询 &ndash;&gt;-->
+<!--            <if test="title != null and title != ''">-->
+<!--                AND d.title like concat('%', #{title}, '%')-->
+<!--            </if>-->
+<!--            &lt;!&ndash; 按分类查询 &ndash;&gt;-->
+<!--            <if test="category_id != null">-->
+<!--                AND d.category_id = #{category_id}-->
+<!--            </if>-->
+<!--            &lt;!&ndash; 按用户查询 &ndash;&gt;-->
+<!--            <if test="user_id != null">-->
+<!--                AND d.user_id = #{user_id}-->
+<!--            </if>-->
+<!--        </where>-->
+<!--        ORDER BY d.id DESC-->
+<!--    </select>-->
+
+
+<!--    &lt;!&ndash; 更新文档信息 &ndash;&gt;-->
+<!--    <update id="updateDocument" parameterType="Document">-->
+<!--        update dc_document-->
+<!--        <set>-->
+<!--            <if test="title != null">title = #{title},</if>-->
+<!--            <if test="data != null">data = #{data},</if>-->
+<!--            <if test="status != null">status = #{status},</if>-->
+<!--            update_time = sysdate()-->
+<!--        </set>-->
+<!--        where id = #{id}-->
+<!--    </update>-->
 
 
 </mapper>
 </mapper>