Explorar el Código

提交代码(新增参数配置功能)

cxd hace 7 meses
padre
commit
5b45a9c2f9
Se han modificado 22 ficheros con 567 adiciones y 27 borrados
  1. 19 2
      gqy-admin/src/main/java/com/gqy/web/controller/document/DcDocumentController.java
  2. 14 4
      gqy-admin/src/main/java/com/gqy/web/controller/document/DocumentCategoryController.java
  3. 16 4
      gqy-admin/src/main/java/com/gqy/web/controller/document/TemplateCategoryController.java
  4. 173 5
      gqy-common/src/main/java/com/gqy/common/utils/bean/BeanUtils.java
  5. 29 3
      gqy-system/src/main/java/com/gqy/document/domain/Document.java
  6. 8 0
      gqy-system/src/main/java/com/gqy/document/mapper/DocumentCategoryMapper.java
  7. 9 1
      gqy-system/src/main/java/com/gqy/document/mapper/DocumentMapper.java
  8. 24 0
      gqy-system/src/main/java/com/gqy/document/mapper/ProductDocumentMapper.java
  9. 8 0
      gqy-system/src/main/java/com/gqy/document/mapper/TemplateCategoryMapper.java
  10. 11 0
      gqy-system/src/main/java/com/gqy/document/service/IDocumentCategoryService.java
  11. 10 1
      gqy-system/src/main/java/com/gqy/document/service/IDocumentService.java
  12. 10 0
      gqy-system/src/main/java/com/gqy/document/service/ITemplateCategoryService.java
  13. 75 5
      gqy-system/src/main/java/com/gqy/document/service/impl/DcDocumentServiceImpl.java
  14. 26 0
      gqy-system/src/main/java/com/gqy/document/service/impl/DcParamsServiceImpl.java
  15. 12 0
      gqy-system/src/main/java/com/gqy/document/service/impl/DocumentCategoryServiceImpl.java
  16. 10 0
      gqy-system/src/main/java/com/gqy/document/service/impl/TemplateCategoryServiceImpl.java
  17. 23 0
      gqy-system/src/main/java/com/gqy/system/mapper/DcParamsMapper.java
  18. 13 0
      gqy-system/src/main/resources/mapper/document/DcDocumentMapper.xml
  19. 43 0
      gqy-system/src/main/resources/mapper/document/DcParamsMapper.xml
  20. 8 1
      gqy-system/src/main/resources/mapper/document/DocumentCategoryMapper.xml
  21. 10 1
      gqy-system/src/main/resources/mapper/document/TemplateCategoryMapper.xml
  22. 16 0
      创建表语句.txt

+ 19 - 2
gqy-admin/src/main/java/com/gqy/web/controller/document/DcDocumentController.java

@@ -1,6 +1,7 @@
 package com.gqy.web.controller.document;
 
 
+import com.alibaba.fastjson2.JSON;
 import com.gqy.common.core.domain.AjaxResult;
 import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.common.core.domain.entity.SysUser;
@@ -42,17 +43,33 @@ public class DcDocumentController extends BaseController
     @Autowired
     private IDocumentService documentService;
 
+    @PostMapping("/test001")
+    public String test001(@RequestBody Map map)
+    {
+        System.out.println(JSON.toJSONString(map));
+        return "succ";
+    }
+
+
+
     /**
      * 创建文档
      */
     @PostMapping("/create")
     @PreAuthorize("@ss.hasPermi('system:document:add')")
     @Log(title = "文档管理", businessType = BusinessType.INSERT)
-    public AjaxResult create(@RequestBody  Map request, @RequestParam(value = "file", required = false) MultipartFile file) {
+    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);
+    }
 
 
     /**
@@ -151,7 +168,7 @@ public class DcDocumentController extends BaseController
      */
     @PostMapping("/info")
     public @ResponseBody  AjaxResultCQY info(@RequestBody  Map map) {
-        String id = (String) map.get("id");
+        String id = map.get("id").toString();
         if (id == null || "".equals(id)) {
             return AjaxResultCQY.error("文档ID不能为空");
         }

+ 14 - 4
gqy-admin/src/main/java/com/gqy/web/controller/document/DocumentCategoryController.java

@@ -11,10 +11,7 @@ import com.gqy.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 org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -85,4 +82,17 @@ public class DocumentCategoryController extends BaseController {
         }
     }
 
+
+    /**
+     * 获取模板分类信息
+     *
+     * @param id 模板分类ID
+     * @return 返回结果对象,成功则包含模板分类信息
+     */
+    @PostMapping("/info")
+    public AjaxResultCQY info(@RequestParam Long id)
+    {
+        return AjaxResultCQY.success("查询成功",documentCategoryService.info(id));
+    }
+
 }

+ 16 - 4
gqy-admin/src/main/java/com/gqy/web/controller/document/TemplateCategoryController.java

@@ -10,10 +10,7 @@ import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.service.ITemplateCategoryService;
 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.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -40,6 +37,8 @@ public class TemplateCategoryController {
 
 
 
+
+
     /**
      * 模板树查询
      * @return
@@ -109,4 +108,17 @@ public class TemplateCategoryController {
 
     }
 
+    /**
+     * 获取模板分类信息
+     *
+     * @param id 模板分类ID
+     * @return 返回结果对象,成功则包含模板分类信息
+     */
+    @PostMapping("/info")
+//    @PreAuthorize("@ss.hasPermi('system:category:query')")
+    public AjaxResultCQY info(@RequestParam Long id)
+    {
+        return templateCategoryService.selectTemplateCategoryById(id);
+    }
+
 }

+ 173 - 5
gqy-common/src/main/java/com/gqy/common/utils/bean/BeanUtils.java

@@ -1,14 +1,23 @@
 package com.gqy.common.utils.bean;
 
+import java.beans.BeanInfo;
+import java.beans.Introspector;
 import java.lang.reflect.Method;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.beans.PropertyDescriptor;
+import java.util.*;
+
 
 /**
  * Bean 工具类
- * 
+ *
  * @author raycos
  */
 public class BeanUtils extends org.springframework.beans.BeanUtils
@@ -24,7 +33,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils
 
     /**
      * Bean属性复制工具方法。
-     * 
+     *
      * @param dest 目标对象
      * @param src 源对象
      */
@@ -42,7 +51,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils
 
     /**
      * 获取对象的setter方法。
-     * 
+     *
      * @param obj 对象
      * @return 对象的setter方法列表
      */
@@ -70,7 +79,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils
 
     /**
      * 获取对象的getter方法。
-     * 
+     *
      * @param obj 对象
      * @return 对象的getter方法列表
      */
@@ -97,7 +106,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils
     /**
      * 检查Bean方法名中的属性名是否相等。<br>
      * 如getName()和setName()属性名一样,getName()和setAge()属性名不一样。
-     * 
+     *
      * @param m1 方法名1
      * @param m2 方法名2
      * @return 属性名一样返回true,否则返回false
@@ -107,4 +116,163 @@ public class BeanUtils extends org.springframework.beans.BeanUtils
     {
         return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX));
     }
+
+    /**
+     * Map转Bean
+     *
+     * @param map Map对象
+     * @param clazz 目标Bean类型
+     * @return Bean对象
+     */
+    public static <T> T mapToBean(Map<String, Object> map, Class<T> clazz) {
+        try {
+            T bean = clazz.newInstance();
+            if (map != null) {
+                for (Map.Entry<String, Object> entry : map.entrySet()) {
+                    String propertyName = entry.getKey();
+                    Object value = entry.getValue();
+                    if (value != null) {
+                        // 处理日期类型
+                        if (value instanceof String) {
+                            String strValue = (String) value;
+                            if (isDateString(strValue)) {
+                                value = parseDate(strValue);
+                            }
+                        }
+                        setProperty(bean, propertyName, value);
+                    }
+                }
+            }
+            return bean;
+        } catch (Exception e) {
+            throw new RuntimeException("Map转Bean异常", e);
+        }
+    }
+
+    /**
+     * Bean转Map
+     *
+     * @param bean Bean对象
+     * @return Map对象
+     */
+    public static Map<String, Object> beanToMap(Object bean) {
+        if (bean == null) {
+            return null;
+        }
+        Map<String, Object> map = new HashMap<>();
+        try {
+            BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
+            PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+            for (PropertyDescriptor property : propertyDescriptors) {
+                String key = property.getName();
+                if (key.compareToIgnoreCase("class") == 0) {
+                    continue;
+                }
+                Method getter = property.getReadMethod();
+                Object value = getter != null ? getter.invoke(bean) : null;
+                map.put(key, value);
+            }
+            return map;
+        } catch (Exception e) {
+            throw new RuntimeException("Bean转Map异常", e);
+        }
+    }
+
+    /**
+     * 设置Bean属性值
+     */
+    private static void setProperty(Object bean, String propertyName, Object value) throws Exception {
+        PropertyDescriptor property = new PropertyDescriptor(propertyName, bean.getClass());
+        Method setter = property.getWriteMethod();
+        if (setter != null) {
+            Class<?> paramType = setter.getParameterTypes()[0];
+            Object convertedValue = convertValue(value, paramType);
+            setter.invoke(bean, convertedValue);
+        }
+    }
+
+    /**
+     * 转换值类型
+     */
+    private static Object convertValue(Object value, Class<?> targetType) {
+        if (value == null) {
+            return null;
+        }
+
+        try {
+            // 处理基本数据类型
+            if (targetType == Integer.class || targetType == int.class) {
+                return Integer.parseInt(value.toString());
+            }
+            if (targetType == Long.class || targetType == long.class) {
+                return Long.parseLong(value.toString());
+            }
+            if (targetType == Double.class || targetType == double.class) {
+                return Double.parseDouble(value.toString());
+            }
+            if (targetType == Float.class || targetType == float.class) {
+                return Float.parseFloat(value.toString());
+            }
+            if (targetType == Boolean.class || targetType == boolean.class) {
+                return Boolean.parseBoolean(value.toString());
+            }
+            if (targetType == Date.class && value instanceof String) {
+                return parseDate((String) value);
+            }
+            // 如果目标类型就是String,直接返回toString结果
+            if (targetType == String.class) {
+                return value.toString();
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("类型转换异常: " + value + " to " + targetType, e);
+        }
+        return value;
+    }
+
+    /**
+     * 判断是否为日期字符串
+     */
+    private static boolean isDateString(String str) {
+        return str.matches("\\d{4}-\\d{2}-\\d{2}") ||
+                str.matches("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}");
+    }
+
+    /**
+     * 解析日期字符串
+     */
+    private static Date parseDate(String dateStr) {
+        try {
+            if (dateStr.length() == 10) {
+                return new SimpleDateFormat("yyyy-MM-dd").parse(dateStr);
+            }
+            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr);
+        } catch (Exception e) {
+            throw new RuntimeException("日期解析异常: " + dateStr, e);
+        }
+    }
+
+    /**
+     * List<Map>转List<Bean>
+     */
+    public static <T> List<T> mapListToBeanList(List<Map<String, Object>> mapList, Class<T> clazz) {
+        if (mapList == null || mapList.isEmpty()) {
+            return new ArrayList<>();
+        }
+        return mapList.stream()
+                .map(map -> mapToBean(map, clazz))
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * List<Bean>转List<Map>
+     */
+    public static <T> List<Map<String, Object>> beanListToMapList(List<T> beanList) {
+        if (beanList == null || beanList.isEmpty()) {
+            return new ArrayList<>();
+        }
+        return beanList.stream()
+                .map(BeanUtils::beanToMap)
+                .collect(Collectors.toList());
+    }
+
 }

+ 29 - 3
gqy-system/src/main/java/com/gqy/document/domain/Document.java

@@ -1,15 +1,19 @@
 package com.gqy.document.domain;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 import com.gqy.common.annotation.Excel;
+import com.gqy.common.config.LinksDeserializer;
 import com.gqy.common.core.domain.BaseEntity;
+import com.microsoft.schemas.office.office.STInsetMode;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 /**
  * 【请填写功能名称】对象 dc_document
- * 
+ *
  * @author raycos
  * @date 2024-10-30
  */
@@ -64,7 +68,6 @@ public class Document extends BaseEntity
     @Excel(name = "更新者")
     private String update_by;
 
-
     /** 当前用户ID(用于权限控制) */
     private Long current_user_id;
 
@@ -74,10 +77,33 @@ public class Document extends BaseEntity
     /** 用户名称(非数据库字段) */
     private String user_name;
 
-
     /** 分类名称 */
     private String type_name;
 
+    /** 关联产品ID列表 */
+    @JsonDeserialize(using = LinksDeserializer.class)
+    private List<String> links = new ArrayList<>();
+
+    /** 关联项目ID列表 */
+    @JsonDeserialize(using = LinksDeserializer.class)
+    private List<String> projects = new ArrayList<>();
+
+    public List<String> getLinks() {
+        return links;
+    }
+
+    public void setLinks(List<String> links) {
+        this.links = links;
+    }
+
+    public List<String> getProjects() {
+        return projects;
+    }
+
+    public void setProjects(List<String> projects) {
+        this.projects = projects;
+    }
+
     public String getType_name() {
         return type_name;
     }

+ 8 - 0
gqy-system/src/main/java/com/gqy/document/mapper/DocumentCategoryMapper.java

@@ -16,4 +16,12 @@ public interface DocumentCategoryMapper {
      */
     List<DocumentCategory> search(DocumentCategory category);
 
+    /**
+     * 查询文档分类信息
+     *
+     * @param id 文档分类ID
+     * @return 结果
+     */
+    public DocumentCategory selectDocumentCategoryById(Long id);
+
 }

+ 9 - 1
gqy-system/src/main/java/com/gqy/document/mapper/DocumentMapper.java

@@ -10,7 +10,7 @@ import java.util.Map;
 
 /**
  * 【请填写功能名称】Mapper接口
- * 
+ *
  * @author raycos
  * @date 2024-10-30
  */
@@ -71,4 +71,12 @@ public interface DocumentMapper
      */
     public List<Document> searchList(Document template);
 
+    /**
+     * 更新文档信息
+     *
+     * @param document 文档信息
+     * @return 结果
+     */
+    public int updateDocument(Document document);
+
 }

+ 24 - 0
gqy-system/src/main/java/com/gqy/document/mapper/ProductDocumentMapper.java

@@ -1,4 +1,28 @@
 package com.gqy.document.mapper;
 
+import com.gqy.document.domain.ProductDocument;
+
+import java.util.List;
+
+/**
+ * 文档产品关联对象
+ */
 public interface ProductDocumentMapper {
+
+    /**
+     * 删除文档关联的产品信息
+     *
+     * @param documentId 文档ID
+     * @return 结果
+     */
+    public int deleteProductDocumentByDocId(Long documentId);
+
+    /**
+     * 批量新增文档产品关联
+     *
+     * @param list 文档产品关联列表
+     * @return 结果
+     */
+    public int batchInsertProductDocument(List<ProductDocument> list);
+
 }

+ 8 - 0
gqy-system/src/main/java/com/gqy/document/mapper/TemplateCategoryMapper.java

@@ -40,4 +40,12 @@ public interface TemplateCategoryMapper {
     public int insertTemplateCategory(TemplateCategory templateCategory);
 
 
+    /**
+     * 根据ID查询模板分类
+     *
+     * @param id 模板分类ID
+     * @return 模板分类信息
+     */
+    public TemplateCategory selectTemplateCategoryById(Long id);
+
 }

+ 11 - 0
gqy-system/src/main/java/com/gqy/document/service/IDocumentCategoryService.java

@@ -1,5 +1,7 @@
 package com.gqy.document.service;
 
+import com.gqy.common.core.domain.AjaxResult;
+import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.document.domain.DocumentCategory;
 import com.gqy.document.domain.vo.PageResult;
 
@@ -13,4 +15,13 @@ public interface IDocumentCategoryService {
      * @return PageResult 分页结果对象
      */
     PageResult search(Integer page, Integer pageSize, DocumentCategory category);
+
+
+    /**
+     * 查询文档分类信息
+     *
+     * @param id 文档分类ID
+     * @return 结果
+     */
+    public AjaxResultCQY info(Long id);
 }

+ 10 - 1
gqy-system/src/main/java/com/gqy/document/service/IDocumentService.java

@@ -4,6 +4,7 @@ package com.gqy.document.service;
 
 import com.gqy.common.core.domain.AjaxResult;
 
+import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.vo.PageResult;
 import org.springframework.web.multipart.MultipartFile;
@@ -19,13 +20,21 @@ import java.util.Map;
  */
 public interface IDocumentService
 {
+
+    /**
+     * 更新文档
+     * @param document
+     * @return
+     */
+    public AjaxResultCQY updateDocument(Document document);
+
     /**
      * 创建文档
      * @param request
      * @param file
      * @return
      */
-    public AjaxResult create(Map request, MultipartFile file);
+    public AjaxResultCQY create(Map request, MultipartFile file);
 
     /**
      * 分页查询文档列表

+ 10 - 0
gqy-system/src/main/java/com/gqy/document/service/ITemplateCategoryService.java

@@ -43,4 +43,14 @@ public interface ITemplateCategoryService {
     public AjaxResultCQY create(TemplateCategory templateCategory);
 
 
+    /**
+     * 根据ID查询模板分类
+     *
+     * @param id 模板分类ID
+     * @return 模板分类信息
+     */
+    public AjaxResultCQY selectTemplateCategoryById(Long id);
+
+
+
 }

+ 75 - 5
gqy-system/src/main/java/com/gqy/document/service/impl/DcDocumentServiceImpl.java

@@ -1,20 +1,25 @@
 package com.gqy.document.service.impl;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 import com.alibaba.fastjson2.JSONArray;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.gqy.common.core.domain.AjaxResult;
+import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.common.core.text.Convert;
 import com.gqy.common.exception.ServiceException;
 import com.gqy.common.utils.*;
+import com.gqy.document.domain.ProductDocument;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.ProjectDocument;
 import com.gqy.document.mapper.DocumentMapper;
+import com.gqy.document.mapper.ProductDocumentMapper;
 import com.gqy.document.mapper.ProjectDocumentMapper;
 import com.gqy.document.service.IDocumentService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,10 +46,75 @@ public class DcDocumentServiceImpl implements IDocumentService
     @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());
+        }
+    }
 
+    /**
+     * 创建文档
+     * @param request
+     * @param file
+     * @return
+     */
     @Transactional
-    public AjaxResult create(Map request, MultipartFile file) {
+    public AjaxResultCQY create(Map request, MultipartFile file) {
         try {
             // 1. 获取表单参数
             String title = (String) request.get("title");
@@ -55,7 +125,7 @@ public class DcDocumentServiceImpl implements IDocumentService
 
             // 2. 参数校验
             if (StringUtils.isEmpty(title)) {
-                return AjaxResult.error("文档标题不能为空");
+                return AjaxResultCQY.error("文档标题不能为空");
             }
 
             Integer templateFlag = Convert.toInt(isTemplate, 0);
@@ -70,7 +140,7 @@ public class DcDocumentServiceImpl implements IDocumentService
             Document existDoc = documentMapper.checkDocumentTitleUnique(title, templateFlag);
             if (StringUtils.isNotNull(existDoc)) {
                 String type = templateFlag == 1 ? "模板" : "文档";
-                return AjaxResult.error(String.format("%s标题 '%s' 已存在", type, title));
+                return AjaxResultCQY.error(String.format("%s标题 '%s' 已存在", type, title));
             }
 
 //            // 4. 处理文件上传
@@ -102,7 +172,7 @@ public class DcDocumentServiceImpl implements IDocumentService
             // 6. 保存文档
             int rows = documentMapper.insertDocument(document);
             if (rows <= 0) {
-                return AjaxResult.error("创建文档失败");
+                return AjaxResultCQY.error("创建文档失败");
             }
 
             // 7. 处理项目关联
@@ -129,7 +199,7 @@ public class DcDocumentServiceImpl implements IDocumentService
                 }
             }
 
-            return AjaxResult.success("创建成功", document.getId());
+            return AjaxResultCQY.success("创建成功", document.getId());
         } catch (Exception e) {
             e.printStackTrace();
             throw new ServiceException("创建文档失败:" + e.getMessage());

+ 26 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/DcParamsServiceImpl.java

@@ -0,0 +1,26 @@
+package com.gqy.document.service.impl;
+
+import com.gqy.document.domain.DcParams;
+import com.gqy.document.service.IDcParamsService;
+import com.gqy.system.mapper.DcParamsMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 参数配置管理 控制层
+ *
+ *
+ */
+@Service
+public class DcParamsServiceImpl implements IDcParamsService {
+
+    @Autowired
+    private DcParamsMapper dcParamsMapper;
+
+    @Override
+    public List<DcParams> search(DcParams params) {
+        return dcParamsMapper.selectParamsList(params);
+    }
+}

+ 12 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/DocumentCategoryServiceImpl.java

@@ -2,6 +2,7 @@ package com.gqy.document.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.document.domain.DocumentCategory;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.mapper.DocumentCategoryMapper;
@@ -52,4 +53,15 @@ public class DocumentCategoryServiceImpl implements IDocumentCategoryService {
             return new PageResult(page,pageSize);
         }
     }
+
+
+    /**
+     * 查询文档分类信息
+     *
+     * @param id 文档分类ID
+     * @return 结果
+     */
+    public AjaxResultCQY info(Long id) {
+        return AjaxResultCQY.success("查询成功",documentCategoryMapper.selectDocumentCategoryById(id));
+    }
 }

+ 10 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/TemplateCategoryServiceImpl.java

@@ -75,6 +75,16 @@ public class TemplateCategoryServiceImpl  implements ITemplateCategoryService {
         }
     }
 
+    /**
+     * 查询模板分类信息
+     *
+     * @param id 模板分类ID
+     * @return 返回结果对象,成功则包含模板分类信息
+     */
+    public AjaxResultCQY selectTemplateCategoryById(Long id) {
+       return AjaxResultCQY.success("查询成功",templateCategoryMapper.selectTemplateCategoryById(id));
+    }
+
 
     /**
      * 递归构建树形结构

+ 23 - 0
gqy-system/src/main/java/com/gqy/system/mapper/DcParamsMapper.java

@@ -0,0 +1,23 @@
+package com.gqy.system.mapper;
+
+
+import com.gqy.document.domain.DcParams;
+
+import java.util.List;
+
+/**
+ * 参数配置服务层接口
+ *
+ * @author ruoyi
+ */
+public interface DcParamsMapper {
+
+    /**
+     * 查询参数列表
+     *
+     * @param params 查询参数
+     * @return 分页结果
+     */
+    public List<DcParams> selectParamsList(DcParams params);
+
+}

+ 13 - 0
gqy-system/src/main/resources/mapper/document/DcDocumentMapper.xml

@@ -239,4 +239,17 @@
         ORDER BY d.id DESC
     </select>
 
+
+    <!-- 更新文档信息 -->
+    <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>

+ 43 - 0
gqy-system/src/main/resources/mapper/document/DcParamsMapper.xml

@@ -0,0 +1,43 @@
+<?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.gqy.system.mapper.DcParamsMapper">
+
+    <!-- 参数配置表结果映射 -->
+    <resultMap type="DcParams" id="ParamsResult">
+        <id     property="id"          column="id"/>
+        <result property="code"        column="code"/>
+        <result property="type"        column="type"/>
+        <result property="name"        column="name"/>
+        <result property="intro"       column="intro"/>
+        <result property="value_type"  column="value_type"/>
+        <result property="value_item"  column="value_item"/>
+        <result property="value"       column="value"/>
+        <result property="create_time" column="create_time"/>
+        <result property="status"      column="status"/>
+    </resultMap>
+
+    <!-- 查询参数列表 -->
+    <select id="selectParamsList" parameterType="DcParams" resultMap="ParamsResult">
+        select id, code, type, name, intro, value_type, value_item, value, create_time, status
+        from dc_params
+        <where>
+            and status != 4
+            <if test="code != null and code != ''">
+                AND code like concat('%', #{code}, '%')
+            </if>
+            <if test="type != null">
+                AND type = #{type}
+            </if>
+            <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>
+
+</mapper>

+ 8 - 1
gqy-system/src/main/resources/mapper/document/DocumentCategoryMapper.xml

@@ -33,5 +33,12 @@
         ORDER BY id DESC  <!-- 按ID倒序排序 -->
     </select>
 
+    <!-- 根据ID查询文档分类信息 -->
+    <select id="selectDocumentCategoryById" parameterType="Long" resultType="DocumentCategory">
+        select id, name, intro, create_time, status
+        from dc_document_category
+        where id = #{id}
+    </select>
+
 
-</mapper>
+</mapper>

+ 10 - 1
gqy-system/src/main/resources/mapper/document/TemplateCategoryMapper.xml

@@ -77,6 +77,15 @@
           and status != 4
     </select>
 
+    <!-- 根据ID查询模板分类信息 -->
+    <select id="selectTemplateCategoryById" parameterType="Long" resultMap="TemplateCategoryResult">
+        select id, name, intro, create_time, status, parent_id
+        from dc_template_category
+        where id = #{id}
+    </select>
+
+
+
 
 
-</mapper>
+</mapper>

+ 16 - 0
创建表语句.txt

@@ -255,3 +255,19 @@ CREATE TABLE dc_formula (
     point smallint DEFAULT '0' COMMENT '小数点标识',
     PRIMARY KEY (id)
 ) ENGINE=InnoDB COMMENT='公式管理表';
+
+
+
+CREATE TABLE `dc_params` (
+  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+  `code` varchar(255) NOT NULL COMMENT '参数编码',
+  `type` smallint NOT NULL COMMENT '参数类型(1-变量 2-常量)',
+  `name` varchar(255) NOT NULL COMMENT '参数名称',
+  `intro` text COMMENT '参数介绍',
+  `value_type` smallint NOT NULL COMMENT '值类型(1-输入框 2-下拉选择 3-小数 4-百分比 5-分数)',
+  `value_item` text COMMENT '值选项',
+  `value` varchar(255) DEFAULT NULL COMMENT '参数值',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `status` smallint NOT NULL COMMENT '状态(5-使用中 6-已停用 4-已删除)',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='参数配置表';