3 Commits c430404629 ... 9f3c2b05ca

Tác giả SHA1 Thông báo Ngày
  cxd 9f3c2b05ca 代码提交 10 tháng trước cách đây
  cxd 50445946e7 代码提交 10 tháng trước cách đây
  cxd e2fe3897da 代码提交 10 tháng trước cách đây

+ 20 - 0
gqy-admin/src/main/java/com/gqy/web/controller/document/DesigerController.java

@@ -0,0 +1,20 @@
+package com.gqy.web.controller.document;
+
+import com.gqy.common.core.controller.BaseController;
+import com.gqy.common.core.domain.AjaxResultCQY;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+
+@RestController
+@RequestMapping("/desiger")
+public class DesigerController extends BaseController {
+
+    @RequestMapping("/add")
+    public AjaxResultCQY add(@RequestBody Map map){
+        return  AjaxResultCQY.success();
+    }
+}

+ 7 - 6
gqy-admin/src/main/resources/application-druid.yml

@@ -6,17 +6,18 @@ spring:
         druid:
         druid:
             # 主库数据源
             # 主库数据源
             master:
             master:
-#                url: jdbc:mysql://120.46.190.49:3306/rouyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                #url: jdbc:mysql://60.204.236.53:3306/gqynew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                #username: root
-                #password: TZPpsyFWLSMTzzFE
-                #password: Gd8XCWEef72GerxE
+##                url: jdbc:mysql://120.46.190.49:3306/rouyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+#                url: jdbc:mysql://60.204.236.53:3306/gqynew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+#                username: root
+#                password: TZPpsyFWLSMTzzFE
+#                password: Gd8XCWEef72GerxE
 
 
                 url: jdbc:mysql://localhost:3306/rouyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 url: jdbc:mysql://localhost:3306/rouyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 username: root
                 username: root
                 password: root
                 password: root
 
 
-            # 从库数据源
+
+            # 从库数据源  600315
             slave:
             slave:
                 # 从数据源开关/默认关闭
                 # 从数据源开关/默认关闭
                 enabled: false
                 enabled: false

+ 13 - 2
gqy-admin/src/main/resources/application.yml

@@ -64,7 +64,7 @@ spring:
   devtools:
   devtools:
     restart:
     restart:
       # 热部署开关
       # 热部署开关
-      enabled: true
+      enabled: false
   # redis 配置
   # redis 配置
   redis:
   redis:
     # 地址
     # 地址
@@ -75,7 +75,7 @@ spring:
     # 数据库索引
     # 数据库索引
     database: 13
     database: 13
     # 密码
     # 密码
-    #password: Iayq@742295
+   # password: Iayq@742295
     # 连接超时时间
     # 连接超时时间
     timeout: 10s
     timeout: 10s
     lettuce:
     lettuce:
@@ -89,6 +89,17 @@ spring:
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
         max-wait: -1ms
 
 
+
+  mvc:
+    static-path-pattern: /**
+
+  web:
+    resources:
+      static-locations:
+        - file:${user.dir}/static/
+        - classpath:/static/
+
+
 # token配置
 # token配置
 token:
 token:
   # 令牌自定义标识
   # 令牌自定义标识

+ 35 - 0
gqy-common/pom.xml

@@ -127,6 +127,41 @@
             <artifactId>javax.servlet-api</artifactId>
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
         </dependency>
 
 
+
+        <dependency>
+            <groupId>org.deeplearning4j</groupId>
+            <artifactId>deeplearning4j-core</artifactId>
+            <version>1.0.0-beta7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.nd4j</groupId>
+            <artifactId>nd4j-native-platform</artifactId>
+            <version>1.0.0-beta7</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.deeplearning4j</groupId>
+            <artifactId>deeplearning4j-nlp</artifactId>
+            <version>1.0.0-beta7</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.hankcs</groupId>
+            <artifactId>hanlp</artifactId>
+            <version>portable-1.8.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.36</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.2.11</version>
+        </dependency>
+
     </dependencies>
     </dependencies>
 
 
 </project>
 </project>

+ 35 - 0
gqy-common/src/main/java/com/gqy/common/config/LinksDeserializer.java

@@ -0,0 +1,35 @@
+package com.gqy.common.config;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 序列化代码
+ */
+public class LinksDeserializer extends JsonDeserializer<List<String>> {
+    @Override
+    public List<String> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
+        JsonNode node = p.getCodec().readTree(p);
+
+        // 处理字符串形式的空数组 ("[]")
+        if (node.isTextual() && "[]".equals(node.asText())) {
+            return new ArrayList<>();
+        }
+
+        // 处理正常的 JSON 数组
+        if (node.isArray()) {
+            List<String> result = new ArrayList<>();
+            node.forEach(element -> result.add(element.asText()));
+            return result;
+        }
+
+        // 其他情况返回空列表
+        return new ArrayList<>();
+    }
+}

+ 4 - 0
gqy-common/src/main/java/com/gqy/common/constant/Constants.java

@@ -1,6 +1,9 @@
 package com.gqy.common.constant;
 package com.gqy.common.constant;
 
 
+import java.util.HashMap;
 import java.util.Locale;
 import java.util.Locale;
+import java.util.Map;
+
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.Claims;
 
 
 /**
 /**
@@ -188,4 +191,5 @@ public class Constants
     public static int status_4=4;
     public static int status_4=4;
 
 
 
 
+
 }
 }

+ 560 - 0
gqy-common/src/main/java/com/gqy/common/utils/hanlp/Word2VecWordSimilarity.java

@@ -0,0 +1,560 @@
+package com.gqy.common.utils.hanlp;
+
+import javafx.util.Pair;
+import org.deeplearning4j.models.word2vec.Word2Vec;
+import org.deeplearning4j.models.word2vec.VocabWord;
+import org.deeplearning4j.models.word2vec.wordstore.inmemory.AbstractCache;
+import org.deeplearning4j.models.word2vec.wordstore.VocabCache;
+import org.nd4j.linalg.api.ndarray.INDArray;
+import org.nd4j.linalg.factory.Nd4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.hankcs.hanlp.HanLP;
+import com.hankcs.hanlp.seg.common.Term;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * Word2Vec 词语相似度计算工具类
+ */
+public class Word2VecWordSimilarity {
+    private static final Logger log = LoggerFactory.getLogger(Word2VecWordSimilarity.class);
+    private static Word2Vec vec;
+    private static final String FASTTEXT_PATH = "D:\\word2\\wiki.zh.vec"; // 修改为你的实际路径
+
+    // 添加静态Map来存储词向量
+    static Map<String, INDArray> wordVectorsMap = new HashMap<>();
+
+    static {
+        try {
+            initializeModel();
+        } catch (Exception e) {
+            log.error("FastText模型初始化失败", e);
+            throw new RuntimeException("FastText模型初始化失败", e);
+        }
+    }
+
+    /**
+     * 初始化FastText模型
+     */
+    private static void initializeModel() throws IOException {
+        log.info("开始加载FastText模型...");
+        File vectorFile = new File(FASTTEXT_PATH);
+        if (!vectorFile.exists()) {
+            throw new FileNotFoundException("FastText向量文件不存在: " + FASTTEXT_PATH);
+        }
+
+        try (BufferedReader reader = new BufferedReader(new FileReader(vectorFile), 8 * 1024 * 1024)) {
+            log.info("成功打开文件,开始读取...");
+
+            // 读取第一行获取维度信息
+            String firstLine = reader.readLine();
+            String[] dims = firstLine.split(" ");
+            int vocabSize = Integer.parseInt(dims[0]);
+            int vectorSize = Integer.parseInt(dims[1]);
+            log.info("词汇量: {}, 向量维度: {}", vocabSize, vectorSize);
+
+            // 预分配容量
+            wordVectorsMap = new ConcurrentHashMap<>(vocabSize);
+
+            // 读取所有行到内存
+            log.info("开始读取词向量...");
+            String line;
+            int lineCount = 0;
+            int successCount = 0;
+
+            while ((line = reader.readLine()) != null) {
+                lineCount++;
+                try {
+                    String[] tokens = line.trim().split("\\s+");
+                    if (tokens.length != vectorSize + 1) {
+                        continue;
+                    }
+
+                    float[] vector = new float[vectorSize];
+                    for (int j = 0; j < vectorSize; j++) {
+                        vector[j] = Float.parseFloat(tokens[j + 1]);
+                    }
+                    wordVectorsMap.put(tokens[0], Nd4j.create(vector));
+                    successCount++;
+
+                    if (lineCount % 10000 == 0) {
+                        log.info("已处理 {} 行,成功加载 {} 个词向量", lineCount, successCount);
+                    }
+                } catch (Exception e) {
+                    log.warn("处理第 {} 行时发生错误: {}", lineCount, e.getMessage());
+                }
+            }
+
+            log.info("FastText模型加载完成,总行数: {},成功加载词向量: {}", lineCount, successCount);
+
+            // 创建Word2Vec实例
+            vec = new Word2Vec.Builder()
+                    .layerSize(vectorSize)
+                    .minWordFrequency(1)
+                    .iterations(1)
+                    .epochs(1)
+                    .learningRate(0.025)
+                    .windowSize(5)
+                    .build();
+
+            // 设置词汇表
+            VocabCache<VocabWord> vocabCache = new AbstractCache<>();
+            for (String word : wordVectorsMap.keySet()) {
+                VocabWord vocabWord = new VocabWord(1.0, word);
+                vocabCache.addToken(vocabWord);
+                vocabCache.addWordToIndex(vocabCache.numWords(), word);
+            }
+            vec.setVocab(vocabCache);
+
+        } catch (Exception e) {
+            log.error("加载FastText模型失败", e);
+            throw new RuntimeException("加载FastText模型失败", e);
+        }
+    }
+
+    /**
+     * 计算两个词的相似度
+     */
+    public static double calculateSimilarity(String text1, String text2) {
+        try {
+            log.info("开始计算文本相似度: '{}' vs '{}'", text1, text2);
+
+            // 对输入文本进行分词,并过滤掉标点符号和停用词
+            List<Term> terms1 = HanLP.segment(text1).stream()
+                    .filter(term -> !term.nature.startsWith("w")  // 过滤标点符号
+                            && !isStopWord(term.word))           // 过滤停用词
+                    .collect(Collectors.toList());
+
+            List<Term> terms2 = HanLP.segment(text2).stream()
+                    .filter(term -> !term.nature.startsWith("w")
+                            && !isStopWord(term.word))
+                    .collect(Collectors.toList());
+
+            log.info("分词结果(过滤后): text1={}, text2={}", terms1, terms2);
+
+            // 获取所有词的向量并计算加权平均值
+            INDArray vector1 = getWeightedAverageVector(terms1);
+            INDArray vector2 = getWeightedAverageVector(terms2);
+
+            if (vector1 == null || vector2 == null) {
+                log.warn("无法为文本生成有效的向量表示: text1={}, text2={}",
+                        vector1 == null ? "null" : "valid",
+                        vector2 == null ? "null" : "valid");
+                return 0.0;
+            }
+
+            // 计算余弦相似度
+            double similarity = calculateCosineSimilarity(vector1, vector2);
+
+            // 应用长度惩罚因子
+            double lengthPenalty = calculateLengthPenalty(terms1.size(), terms2.size());
+            similarity *= lengthPenalty;
+
+            log.info("最终相似度计算完成: rawSimilarity={}, lengthPenalty={}, finalSimilarity={}",
+                    similarity/lengthPenalty, lengthPenalty, similarity);
+            return similarity;
+        } catch (Exception e) {
+            log.error("计算文本相似度失败: {} vs {}", text1, text2, e);
+            return 0.0;
+        }
+    }
+
+    private static boolean isStopWord(String word) {
+        // 扩展停用词表
+        Set<String> stopWords = new HashSet<>(Arrays.asList(
+            "的", "了", "和", "是", "就", "都", "而", "及", "与", "着",
+            "之", "用", "其", "中", "你", "我", "他", "她", "它", "要",
+            "把", "被", "让", "在", "有", "个", "好", "这", "那", "什么",
+            "啊", "哦", "呢", "吧", "啦", "么", "呀", "嘛", "哪", "那么",
+            "这么", "怎么", "为", "以", "到", "得", "着", "过", "很", "对",
+            "真", "的话", "所以", "因为", "但是", "不过", "可以", "现在"
+        ));
+        return stopWords.contains(word);
+    }
+
+    private static INDArray getWeightedAverageVector(List<Term> terms) {
+        try {
+            log.debug("开始计算加权平均向量,输入词项数: {}", terms.size());
+            List<Pair<INDArray, Double>> vectorsWithWeights = new ArrayList<>();
+            double totalWeight = 0.0;
+
+            for (Term term : terms) {
+                String word = term.word;
+                INDArray vector = wordVectorsMap.get(word);
+                if (vector != null) {
+                    // 根据词性赋予不同权重
+                    double weight = getTermWeight(term);
+                    vectorsWithWeights.add(new Pair<>(vector, weight));
+                    totalWeight += weight;
+                    log.debug("找到词 '{}' 的向量,权重: {}", word, weight);
+                } else {
+                    log.debug("词 '{}' 不在词向量表中", word);
+                }
+            }
+
+            if (vectorsWithWeights.isEmpty()) {
+                log.warn("没有找到任何有效的词向量,输入词项: {}", terms);
+                return null;
+            }
+
+            // 计算加权平均
+            INDArray weightedSum = Nd4j.zeros(vectorsWithWeights.get(0).getKey().shape());
+            for (Pair<INDArray, Double> pair : vectorsWithWeights) {
+                weightedSum.addi(pair.getKey().mul(pair.getValue()));
+            }
+            return weightedSum.divi(totalWeight);
+        } catch (Exception e) {
+            log.error("计算加权平均向量失败,输入词项: {}", terms, e);
+            return null;
+        }
+    }
+
+    private static double getTermWeight(Term term) {
+        // 根据词性赋予权重
+        switch (term.nature.toString()) {
+            case "n":   // 名词
+            case "v":   // 动词
+            case "a":   // 形容词
+                return 1.0;
+            case "t":   // 时间词
+            case "s":   // 处所词
+                return 0.8;
+            case "f":   // 方位词
+            case "b":   // 区别词
+                return 0.6;
+            default:
+                return 0.4;
+        }
+    }
+
+    private static double calculateCosineSimilarity(INDArray vector1, INDArray vector2) {
+        double dotProduct = vector1.mul(vector2).sumNumber().doubleValue();
+        double norm1 = vector1.norm2Number().doubleValue();
+        double norm2 = vector2.norm2Number().doubleValue();
+        return dotProduct / (norm1 * norm2);
+    }
+
+    private static double calculateLengthPenalty(int len1, int len2) {
+        // 对长度差异进行惩罚
+        double ratio = Math.min(len1, len2) / (double) Math.max(len1, len2);
+        return Math.pow(ratio, 0.5);  // 使用平方根来减轻惩罚程度
+    }
+
+
+    /**
+     * 判断两个词是否相似
+     */
+    public static boolean areWordsSimilar(String word1, String word2, double threshold) {
+        try {
+            log.info("开始判断词语相似性: word1='{}', word2='{}', threshold={}", word1, word2, threshold);
+
+            if (word1 == null || word2 == null) {
+                log.warn("输入词语为null: word1={}, word2={}", word1, word2);
+                return false;
+            }
+
+            if (word1.equals(word2)) {
+                log.info("词语完全相同,直接返回true");
+                return true;
+            }
+
+            // 预处理:去除标点符号
+            word1 = word1.replaceAll("[\\p{P}\\p{S}]", "");
+            word2 = word2.replaceAll("[\\p{P}\\p{S}]", "");
+
+            if (word1.isEmpty() || word2.isEmpty()) {
+                log.warn("清理标点符号后文本为空: word1='{}', word2='{}'", word1, word2);
+                return false;
+            }
+
+            // 获取词性
+            List<Term> terms1 = HanLP.segment(word1);
+            List<Term> terms2 = HanLP.segment(word2);
+
+            log.info("分词结果: terms1={}, terms2={}", terms1, terms2);
+
+            // 提取谓语动词和核心名词
+            Map<String, String> keyTerms1 = extractKeyTerms(terms1);
+            Map<String, String> keyTerms2 = extractKeyTerms(terms2);
+
+            log.info("核心词分析: keyTerms1={}, keyTerms2={}", keyTerms1, keyTerms2);
+
+            // 检查谓语动词的相似性
+            boolean verbSimilar = checkVerbSimilarity(keyTerms1.get("verb"), keyTerms2.get("verb"));
+
+            // 检查核心名词的重叠
+            Set<String> nouns1 = Arrays.stream(keyTerms1.getOrDefault("noun", "").split(","))
+                    .filter(s -> !s.isEmpty())
+                    .collect(Collectors.toSet());
+            Set<String> nouns2 = Arrays.stream(keyTerms2.getOrDefault("noun", "").split(","))
+                    .filter(s -> !s.isEmpty())
+                    .collect(Collectors.toSet());
+            Set<String> commonNouns = new HashSet<>(nouns1);
+            commonNouns.retainAll(nouns2);
+
+            // 计算相似度
+            double similarity = calculateSimilarity(word1, word2);
+
+            // 动态调整阈值
+            double adjustedThreshold = threshold;
+
+            // 问句和陈述句的处理
+            boolean isQuestion1 = isQuestion(word1);
+            boolean isQuestion2 = isQuestion(word2);
+
+            // 如果一个是问句一个是陈述句,且谓语动词不相似,提高阈值
+            if (isQuestion1 != isQuestion2 && !verbSimilar) {
+                adjustedThreshold *= 1.3;
+            }
+
+            // 如果谓语动词不相似,提高阈值
+            if (!verbSimilar) {
+                adjustedThreshold *= 1.2;
+            }
+
+            // 长度差异调整
+            int lenDiff = Math.abs(terms1.size() - terms2.size());
+            if (lenDiff > 2) {
+                adjustedThreshold *= (1.0 + lenDiff * 0.1);
+            }
+
+            boolean isSimilar = similarity >= adjustedThreshold &&
+                               (verbSimilar || !commonNouns.isEmpty());
+
+            log.info("相似度判断完成: rawSimilarity={}, adjustedThreshold={}, verbSimilar={}, " +
+                    "commonNouns={}, isQuestion1={}, isQuestion2={}, isSimilar={}",
+                    similarity, adjustedThreshold, verbSimilar,
+                    commonNouns, isQuestion1, isQuestion2, isSimilar);
+
+            return isSimilar;
+        } catch (Exception e) {
+            log.error("判断词语相似性失败: {} vs {}", word1, word2, e);
+            return false;
+        }
+    }
+
+    private static Map<String, String> extractKeyTerms(List<Term> terms) {
+        Map<String, String> keyTerms = new HashMap<>();
+        List<String> nouns = new ArrayList<>();
+        String mainVerb = null;
+
+        for (Term term : terms) {
+            String nature = term.nature.toString();
+            if (nature.startsWith("v") && mainVerb == null) {
+                mainVerb = term.word;
+            } else if (nature.startsWith("n")) {
+                nouns.add(term.word);
+            }
+        }
+
+        keyTerms.put("verb", mainVerb);
+        keyTerms.put("noun", String.join(",", nouns));
+        return keyTerms;
+    }
+
+    private static boolean checkVerbSimilarity(String verb1, String verb2) {
+        if (verb1 == null || verb2 == null) {
+            return false;
+        }
+
+        // 定义一些同义动词组
+        Set<Set<String>> synonymGroups = new HashSet<>();
+        synonymGroups.add(new HashSet<>(Arrays.asList("穿", "戴", "套")));
+        synonymGroups.add(new HashSet<>(Arrays.asList("买", "购买", "选购")));
+        synonymGroups.add(new HashSet<>(Arrays.asList("洗", "清洗", "淋")));
+
+        // 检查两个动词是否属于同一个同义组
+        return verb1.equals(verb2) ||
+               synonymGroups.stream().anyMatch(group -> group.contains(verb1) && group.contains(verb2));
+    }
+
+    /**
+     * 获取与给定词最相似的N个词
+     */
+    public static Collection<String> findSimilarWords(String text, int n) {
+        try {
+            log.info("开始查找与文本 '{}' 相似的 {} 个词", text, n);
+
+            List<Term> terms = HanLP.segment(text);
+            log.info("分词结果: {}", terms);
+
+            INDArray queryVector = getWeightedAverageVector(terms);
+            if (queryVector == null) {
+                log.warn("无法为文本 '{}' 生成有效的向量表示", text);
+                return Collections.emptyList();
+            }
+            log.info("成功生成查询向量");
+
+            // 使用并行流和ConcurrentHashMap来加速计算
+            log.info("开始并行计算相似度...");
+            ConcurrentHashMap<String, Double> similarities = new ConcurrentHashMap<>(wordVectorsMap.size());
+            AtomicInteger processedCount = new AtomicInteger(0);
+
+            // 将词向量分批处理
+            int batchSize = 1000;
+            List<List<Map.Entry<String, INDArray>>> batches = new ArrayList<>();
+            List<Map.Entry<String, INDArray>> currentBatch = new ArrayList<>();
+
+            for (Map.Entry<String, INDArray> entry : wordVectorsMap.entrySet()) {
+                currentBatch.add(entry);
+                if (currentBatch.size() == batchSize) {
+                    batches.add(new ArrayList<>(currentBatch));
+                    currentBatch.clear();
+                }
+            }
+            if (!currentBatch.isEmpty()) {
+                batches.add(currentBatch);
+            }
+
+            // 并行处理每个批次
+            batches.parallelStream().forEach(batch -> {
+                for (Map.Entry<String, INDArray> entry : batch) {
+                    String word = entry.getKey();
+                    INDArray vector = entry.getValue();
+
+                    // 批量计算相似度
+                    double similarity = queryVector.mul(vector).sumNumber().doubleValue() /
+                            (queryVector.norm2Number().doubleValue() * vector.norm2Number().doubleValue());
+                    similarities.put(word, similarity);
+
+                    int count = processedCount.incrementAndGet();
+                    if (count % 10000 == 0) {
+                        log.info("已处理 {} / {} 个词向量", count, wordVectorsMap.size());
+                    }
+                }
+            });
+
+            log.info("相似度计算完成,开始排序...");
+
+            // 使用优先队列来获取top N,避免全量排序
+            PriorityQueue<Map.Entry<String, Double>> topN = new PriorityQueue<>(
+                n + 1, Map.Entry.<String, Double>comparingByValue()
+            );
+
+            for (Map.Entry<String, Double> entry : similarities.entrySet()) {
+                topN.offer(entry);
+                if (topN.size() > n) {
+                    topN.poll();
+                }
+            }
+
+            // 转换结果
+            List<String> result = new ArrayList<>(n);
+            while (!topN.isEmpty()) {
+                result.add(0, topN.poll().getKey());
+            }
+
+            log.info("找到 {} 个相似词: {}", result.size(), result);
+            return result;
+        } catch (Exception e) {
+            log.error("查找相似词失败: {}", text, e);
+            return Collections.emptyList();
+        }
+    }
+
+    /**
+     * 检查词是否在词汇表中
+     */
+    public static boolean hasWord(String word) {
+        return vec.hasWord(word);
+    }
+
+    /**
+     * 获取词向量
+     */
+    public static double[] getWordVector(String word) {
+        try {
+            return vec.getWordVector(word);
+        } catch (Exception e) {
+            log.error("获取词向量失败: {}", word, e);
+            return null;
+        }
+    }
+
+    private static boolean isQuestion(String text) {
+        // 问号判断
+        if (text.contains("?") || text.contains("?")) {
+            return true;
+        }
+
+        // 疑问词判断
+        Set<String> questionWords = new HashSet<>(Arrays.asList(
+            "什么", "怎么", "怎样", "如何", "哪", "谁", "为什么", "几",
+            "多少", "是否", "能否", "可否", "吗", "呢", "吧", "啊",
+            "嘛", "呀", "哪里", "哪儿", "何时", "为何", "多久"
+        ));
+
+        // 分词后检查是否包含疑问词
+        List<Term> terms = HanLP.segment(text);
+        for (Term term : terms) {
+            if (questionWords.contains(term.word)) {
+                log.debug("检测到疑问词: {}", term.word);
+                return true;
+            }
+        }
+
+        // 语气词判断(句尾)
+        if (terms.size() > 0) {
+            String lastWord = terms.get(terms.size() - 1).word;
+            Set<String> questionTones = new HashSet<>(Arrays.asList(
+                "吗", "呢", "吧", "啊", "嘛", "呀", "么"
+            ));
+            if (questionTones.contains(lastWord)) {
+                log.debug("检测到句尾疑问语气词: {}", lastWord);
+                return true;
+            }
+        }
+
+        // 特殊句式判断
+        String[] questionPatterns = {
+            "是不是", "对不对", "行不行", "要不要", "能不能", "可不可以",
+            "有没有", "对吧", "是吧", "好吧"
+        };
+        for (String pattern : questionPatterns) {
+            if (text.contains(pattern)) {
+                log.debug("检测到疑问句式: {}", pattern);
+                return true;
+            }
+        }
+
+        log.debug("未检测到问句特征");
+        return false;
+    }
+
+
+
+    // 使用示例
+    public static void main(String[] args) {
+        try {
+            // 计算相似度
+            String word1 = "你要选择什么产品?";
+            String word2 = "产品名称";
+          //  double similarity = calculateSimilarity(word1, word2);
+            //System.out.println("相似度: " + similarity);
+
+            // 查找相似词
+//            Collection<String> similarWords = findSimilarWords(word1, 5);
+//            System.out.println("相似词: " + similarWords);
+
+            // 判断是否相似
+            boolean isSimilar = areWordsSimilar(word1, word2, 0.7);
+            System.out.println("是否相似: " + isSimilar);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 38 - 0
gqy-framework/src/main/java/com/gqy/framework/config/StaticResourceConfig.java

@@ -0,0 +1,38 @@
+package com.gqy.framework.config;
+
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ResourceLoader;
+
+import java.io.File;
+
+@Configuration
+public class StaticResourceConfig {
+
+    @Bean
+    public CommandLineRunner initStaticDirectories(ResourceLoader resourceLoader) {
+        return args -> {
+            try {
+                // 获取项目根目录
+                String projectRoot = System.getProperty("user.dir");
+                
+                // 创建静态资源目录
+                File staticDir = new File(projectRoot + "/static");
+                if (!staticDir.exists()) {
+                    staticDir.mkdirs();
+                }
+                
+                // 创建水印图片目录
+                File watermarkDir = new File(staticDir, "watermark");
+                if (!watermarkDir.exists()) {
+                    watermarkDir.mkdirs();
+                }
+                
+                System.out.println("静态资源目录创建成功:" + watermarkDir.getAbsolutePath());
+            } catch (Exception e) {
+                System.err.println("创建静态资源目录失败:" + e.getMessage());
+            }
+        };
+    }
+} 

+ 199 - 0
gqy-system/src/main/java/com/gqy/document/domain/DcDesign.java

@@ -0,0 +1,199 @@
+package com.gqy.document.domain;
+
+public class DcDesign {
+
+    /**
+     * 设计表id
+     */
+    private String deId;
+
+    /**
+     * 系统识别码/系统id
+     */
+    private String deSysId;
+
+    /**
+     * 产品识别码/产品id
+     */
+    private String dePId;
+
+    /**
+     * 问题编号
+     */
+    private String deQaNo;
+
+    /**
+     * 问答版本条件
+     */
+    private String deQaTj;
+
+    /**
+     * 问答返回位置
+     */
+    private String deQaFn;
+
+    /**
+     * 问题内容
+     */
+    private String deQaQNr;
+
+    /**
+     * 问题结果类型
+     */
+    private String deQaAType;
+
+    /**
+     * 问题结果表名/结果名
+     */
+    private String deQaABl;
+
+    /**
+     * 问题结果表类型
+     */
+    private String deQaABltb;
+
+    /**
+     * 问题结果表类型说明
+     */
+    private String deQaABlsm;
+
+    /**
+     * 问题结果值(默认值)
+     */
+    private String deQaABlz;
+
+    /**
+     * 合法性要求(约束条件)
+     */
+    private String deQaHf;
+
+    /**
+     * 操作(选择分支、计算、筛选函数)
+     */
+    private String deQaCz;
+
+    /**
+     * 前置条件
+     */
+    private String dePre;
+
+    public String getDeId() {
+        return deId;
+    }
+
+    public void setDeId(String deId) {
+        this.deId = deId;
+    }
+
+    public String getDeSysId() {
+        return deSysId;
+    }
+
+    public void setDeSysId(String deSysId) {
+        this.deSysId = deSysId;
+    }
+
+    public String getDePId() {
+        return dePId;
+    }
+
+    public void setDePId(String dePId) {
+        this.dePId = dePId;
+    }
+
+    public String getDeQaNo() {
+        return deQaNo;
+    }
+
+    public void setDeQaNo(String deQaNo) {
+        this.deQaNo = deQaNo;
+    }
+
+    public String getDeQaTj() {
+        return deQaTj;
+    }
+
+    public void setDeQaTj(String deQaTj) {
+        this.deQaTj = deQaTj;
+    }
+
+    public String getDeQaFn() {
+        return deQaFn;
+    }
+
+    public void setDeQaFn(String deQaFn) {
+        this.deQaFn = deQaFn;
+    }
+
+    public String getDeQaQNr() {
+        return deQaQNr;
+    }
+
+    public void setDeQaQNr(String deQaQNr) {
+        this.deQaQNr = deQaQNr;
+    }
+
+    public String getDeQaAType() {
+        return deQaAType;
+    }
+
+    public void setDeQaAType(String deQaAType) {
+        this.deQaAType = deQaAType;
+    }
+
+    public String getDeQaABl() {
+        return deQaABl;
+    }
+
+    public void setDeQaABl(String deQaABl) {
+        this.deQaABl = deQaABl;
+    }
+
+    public String getDeQaABltb() {
+        return deQaABltb;
+    }
+
+    public void setDeQaABltb(String deQaABltb) {
+        this.deQaABltb = deQaABltb;
+    }
+
+    public String getDeQaABlsm() {
+        return deQaABlsm;
+    }
+
+    public void setDeQaABlsm(String deQaABlsm) {
+        this.deQaABlsm = deQaABlsm;
+    }
+
+    public String getDeQaABlz() {
+        return deQaABlz;
+    }
+
+    public void setDeQaABlz(String deQaABlz) {
+        this.deQaABlz = deQaABlz;
+    }
+
+    public String getDeQaHf() {
+        return deQaHf;
+    }
+
+    public void setDeQaHf(String deQaHf) {
+        this.deQaHf = deQaHf;
+    }
+
+    public String getDeQaCz() {
+        return deQaCz;
+    }
+
+    public void setDeQaCz(String deQaCz) {
+        this.deQaCz = deQaCz;
+    }
+
+    public String getDePre() {
+        return dePre;
+    }
+
+    public void setDePre(String dePre) {
+        this.dePre = dePre;
+    }
+}

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

@@ -0,0 +1,8 @@
+package com.gqy.document.mapper;
+
+import com.gqy.document.domain.DcDesign;
+
+public interface DcDesignMapper {
+
+    public int insertDcDesign(DcDesign dcDesign);
+}

+ 139 - 63
gqy-system/src/main/java/com/gqy/document/service/impl/DcProductServiceImpl.java

@@ -7,9 +7,13 @@ import com.gqy.common.utils.bean.BeanUtils;
 import com.gqy.document.domain.*;
 import com.gqy.document.domain.*;
 import com.gqy.document.mapper.*;
 import com.gqy.document.mapper.*;
 import com.gqy.document.service.IDcProductService;
 import com.gqy.document.service.IDcProductService;
+import com.gqy.document.service.IDocumentCategoryService;
 import com.gqy.system.mapper.DcPsParamMapper;
 import com.gqy.system.mapper.DcPsParamMapper;
 import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
@@ -26,6 +30,9 @@ import java.util.stream.Collectors;
 @Service
 @Service
 public class DcProductServiceImpl implements IDcProductService {
 public class DcProductServiceImpl implements IDcProductService {
 
 
+    private static final Logger log = LoggerFactory.getLogger(DcProductServiceImpl.class);
+
+
     @Autowired
     @Autowired
     private DcProductMapper dcProductMapper;
     private DcProductMapper dcProductMapper;
 
 
@@ -404,78 +411,147 @@ public class DcProductServiceImpl implements IDcProductService {
     }
     }
 
 
     private int processAndSaveProduct(String context) {
     private int processAndSaveProduct(String context) {
-        // 解析JSON
-        Map mapResult = CustomJsonParser.getParam(context);
-
-        // 获取系统信息
-        String sys_name = mapResult.get("sys_name").toString();
-        // 查询系统信息
-       // DcSystem dcSystem = dcSystemMapper.selectDcSystemByName(sys_name);
-        DcSystem dcSystem = dcSystemMapper.selectDcSystemBySysNo(sys_name);
-        mapResult.put("sys_no", dcSystem.getSysId());
-        // 获取工程信息
-        String wk_name = mapResult.get("wk_name").toString();
-        DcWork  dcWork = workMapper.selectWorkByName(wk_name);
-        mapResult.put("wr_id", dcWork.getWkId());
-
-//        workMapper.selectWorkByName()
-
-//        DcWorkSystem dcWorkSystemQuery = new DcWorkSystem();
-//        dcWorkSystemQuery.setSys_id(dcSystem.getSysId().intValue());
-//        List<DcWorkSystem> dcWorkSystemList = dcWorkSystemMapper.selectDcWorkSystemList(dcWorkSystemQuery);
-//        if(!CollectionUtils.isEmpty(dcWorkSystemList)){
-//            DcWorkSystem dcWorkSystem = dcWorkSystemList.get(0);
-//            mapResult.put("wr_id", dcWorkSystem.getWr_id());
-//
-//        }
-        // 查询规格参数
-        DcPsParam queryDcPsParam = new DcPsParam();
-        List<DcPsParam> listDcPsParam = dcPsParamMapper.selectDcPsParamList(queryDcPsParam);
+        log.info("开始处理产品导入数据...");
+        int totalLines = 0;
+        int successCount = 0;
+        int failCount = 0;
 
 
-        // 保存产品基本信息
-        int dcpId = getDcpIdAdd(mapResult);
-
-        // 处理规格信息
-        List<Map> specs = new ArrayList<>();
-        for (DcPsParam dcPsParam : listDcPsParam) {
-            if (ObjectUtils.isNotEmpty(mapResult.get(dcPsParam.getPsp_mode()))) {
-                Map maps = new HashMap();
-                maps.put("ps_no", dcPsParam.getPsp_mode());
-                maps.put("psp_name", dcPsParam.getPsp_name());
-                maps.put("ps_name", mapResult.get(dcPsParam.getPsp_mode()));
-                maps.put("psp_type",dcPsParam.getPsp_type());
-                specs.add(maps);
-            }
-        }
-        mapResult.put("specs", specs);
+        try {
+            // 按行分割内容
+            String[] lines = context.split("\n");
+            totalLines = lines.length;
+            log.info("共读取到 {} 行数据", totalLines);
+
+            for (String line : lines) {
+                if (StringUtils.isBlank(line)) {
+                    log.warn("跳过空行数据");
+                    continue;
+                }
 
 
-        // 保存产品信息
-        extractedAdd(specs, dcpId);
+                try {
+                    log.info("开始处理第 {} 行数据: {}", successCount + failCount + 1, line);
+
+                    // 解析JSON数据
+                    log.debug("正在解析JSON数据...");
+                    Map mapResult = CustomJsonParser.getParam(line);
+                    log.debug("JSON解析结果: {}", mapResult);
+
+                    // 获取系统信息
+                    String sys_name = mapResult.get("sys_name").toString();
+                    log.debug("获取系统信息, 系统名称: {}", sys_name);
+                    DcSystem dcSystem = dcSystemMapper.selectDcSystemBySysNo(sys_name);
+                    if (dcSystem == null) {
+                        log.error("未找到对应的系统信息: {}", sys_name);
+                        throw new RuntimeException("系统信息不存在");
+                    }
+                    mapResult.put("sys_no", dcSystem.getSysId());
+                    log.debug("系统信息获取成功, 系统ID: {}", dcSystem.getSysId());
+
+                    // 获取工程信息
+                    String wk_name = mapResult.get("wk_name").toString();
+                    log.debug("获取工程信息, 工程名称: {}", wk_name);
+                    DcWork dcWork = workMapper.selectWorkByName(wk_name);
+                    if (dcWork == null) {
+                        log.error("未找到对应的工程信息: {}", wk_name);
+                        throw new RuntimeException("工程信息不存在");
+                    }
+                    mapResult.put("wr_id", dcWork.getWkId());
+                    log.debug("工程信息获取成功, 工程ID: {}", dcWork.getWkId());
+
+                    // 查询规格参数
+                    log.debug("开始查询规格参数...");
+                    DcPsParam queryDcPsParam = new DcPsParam();
+                    List<DcPsParam> listDcPsParam = dcPsParamMapper.selectDcPsParamList(queryDcPsParam);
+                    log.debug("查询到 {} 个规格参数", listDcPsParam.size());
+
+                    // 保存产品基本信息
+                    log.info("开始保存产品基本信息...");
+                    int dcpId = getDcpIdAdd(mapResult);
+                    log.info("产品基本信息保存成功, 产品ID: {}", dcpId);
+
+                    // 处理规格信息
+                    log.debug("开始处理规格信息...");
+                    List<Map> specs = new ArrayList<>();
+                    for (DcPsParam dcPsParam : listDcPsParam) {
+                        if (ObjectUtils.isNotEmpty(mapResult.get(dcPsParam.getPsp_mode()))) {
+                            Map maps = new HashMap();
+                            maps.put("ps_no", dcPsParam.getPsp_mode());
+                            maps.put("psp_name", dcPsParam.getPsp_name());
+                            maps.put("ps_name", mapResult.get(dcPsParam.getPsp_mode()));
+                            maps.put("psp_type", dcPsParam.getPsp_type());
+                            specs.add(maps);
+                            log.debug("添加规格信息: {}", maps);
+                        }
+                    }
+                    mapResult.put("specs", specs);
+                    log.debug("规格信息处理完成, 共 {} 个规格", specs.size());
 
 
+                    // 保存产品规格信息
+                    log.info("开始保存产品规格信息...");
+                    extractedAdd(specs, dcpId);
+                    log.info("产品规格信息保存成功");
 
 
-        // 创建新的规格列表用于JSON序列化
-        List<Map<String, String>> newSpecs = new ArrayList<>();
+                    // 更新产品规格JSON
+                    log.debug("开始更新产品规格JSON...");
+                    updateProductSpecsJson(specs, dcpId);
+                    log.info("产品规格JSON更新成功");
 
 
-        // 遍历specs并构建新的JSON格式
-        for (Map spec : specs) {
-            Map<String, String> newSpec = new HashMap<>();
-            newSpec.put("ps_no", String.valueOf(spec.get("ps_no")));
-            newSpec.put("psp_name", String.valueOf(spec.get("psp_name")));
-            newSpec.put("psp_type", String.valueOf(spec.get("psp_type")));
-            newSpec.put("ps_name", String.valueOf(spec.get("ps_name")));
-            newSpecs.add(newSpec);
-        }
+                    successCount++;
+                    log.info("第 {} 行数据处理成功", successCount + failCount);
 
 
-        // 将新的规格列表转换为JSON字符串
-        String specsJson = JSON.toJSONString(newSpecs);
+                } catch (Exception e) {
+                    failCount++;
+                    log.error("处理第 {} 行数据失败: {}", successCount + failCount, line, e);
+                }
+            }
 
 
-        // 更新产品基本信息
-        DcProduct dcProduct = dcProductMapper.selectDcProductById(new Long(dcpId));
-        dcProduct.setDcp_p_no(specsJson);
-        dcProductMapper.updateDcProduct(dcProduct);
+            // 处理完成,输出统计信息
+            log.info("数据处理完成 ======================");
+            log.info("总行数: {}", totalLines);
+            log.info("成功处理: {}", successCount);
+            log.info("处理失败: {}", failCount);
+            
+            return successCount > 0 ? 1 : 0;
 
 
-        return 1;
+        } catch (Exception e) {
+            log.error("处理产品导入数据时发生异常", e);
+            return 0;
+        }
     }
     }
 
 
+    /**
+     * 更新产品规格JSON
+     */
+    private void updateProductSpecsJson(List<Map> specs, int dcpId) {
+        try {
+            log.debug("开始构建规格JSON数据...");
+            List<Map<String, String>> newSpecs = new ArrayList<>();
+            
+            for (Map spec : specs) {
+                Map<String, String> newSpec = new HashMap<>();
+                newSpec.put("ps_no", String.valueOf(spec.get("ps_no")));
+                newSpec.put("psp_name", String.valueOf(spec.get("psp_name")));
+                newSpec.put("psp_type", String.valueOf(spec.get("psp_type")));
+                newSpec.put("ps_name", String.valueOf(spec.get("ps_name")));
+                newSpecs.add(newSpec);
+                log.debug("添加规格JSON: {}", newSpec);
+            }
+            
+            String specsJson = JSON.toJSONString(newSpecs);
+            log.debug("规格JSON生成完成: {}", specsJson);
+            
+            DcProduct dcProduct = dcProductMapper.selectDcProductById(new Long(dcpId));
+            if (dcProduct != null) {
+                dcProduct.setDcp_p_no(specsJson);
+                dcProductMapper.updateDcProduct(dcProduct);
+                log.info("更新产品规格JSON成功, 产品ID: {}", dcpId);
+            } else {
+                log.error("未找到产品信息, 产品ID: {}", dcpId);
+            }
+        } catch (Exception e) {
+            log.error("更新产品规格JSON失败, 产品ID: {}", dcpId, e);
+            throw e;
+        }
+    }
 
 
 }
 }

+ 34 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/IDcDesigerServiceImpl.java

@@ -0,0 +1,34 @@
+package com.gqy.document.service.impl;
+
+import com.gqy.document.domain.DcDesign;
+import com.gqy.document.mapper.DcDesignMapper;
+import com.gqy.document.service.IDcDesigerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * @author gqy
+ *
+ * 添加设计
+ */
+@Service
+public class IDcDesigerServiceImpl implements IDcDesigerService {
+
+    @Autowired
+    private DcDesignMapper dcDesignMapper;
+
+    /**
+     *
+     * @param map
+     */
+    public void add(Map map) {
+        DcDesign  dcDesign = new DcDesign();
+        dcDesign.setDeSysId(map.get("deSysId").toString());
+        dcDesign.setDePId(map.get("dePId").toString());
+        dcDesign.setDeQaNo(map.get("deQaNo").toString());
+        dcDesign.setDeQaTj(map.get("deQaTj").toString());
+        dcDesignMapper.insertDcDesign(dcDesign);
+    }
+}

+ 128 - 0
gqy-system/src/main/resources/mapper/document/DcDesignMapper.xml

@@ -0,0 +1,128 @@
+<?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.document.mapper.DcDesignMapper">
+
+    <resultMap type="DcDesign" id="DcDesignResult">
+        <id     property="deId"       column="de_id"        />
+        <result property="deSysId"    column="de_sys_id"    />
+        <result property="dePId"      column="de_p_id"      />
+        <result property="deQaNo"     column="de_qa_no"     />
+        <result property="deQaTj"     column="de_qa_tj"     />
+        <result property="deQaFn"     column="de_qa_fn"     />
+        <result property="deQaQNr"    column="de_qa_q_nr"   />
+        <result property="deQaAType"  column="de_qa_a_type" />
+        <result property="deQaABl"    column="de_qa_a_bl"   />
+        <result property="deQaABltb"  column="de_qa_a_bltb" />
+        <result property="deQaABlsm"  column="de_qa_a_blsm" />
+        <result property="deQaABlz"   column="de_qa_a_blz"  />
+        <result property="deQaHf"     column="de_qa_hf"     />
+        <result property="deQaCz"     column="de_qa_cz"     />
+        <result property="dePre"      column="de_pre"       />
+    </resultMap>
+
+    <sql id="selectDcDesignVo">
+        select de_id, de_sys_id, de_p_id, de_qa_no, de_qa_tj, de_qa_fn, de_qa_q_nr,
+               de_qa_a_type, de_qa_a_bl, de_qa_a_bltb, de_qa_a_blsm, de_qa_a_blz, de_qa_hf,
+               de_qa_cz, de_pre
+        from dc_design
+    </sql>
+
+    <select id="selectDcDesignById" parameterType="String" resultMap="DcDesignResult">
+        <include refid="selectDcDesignVo"/>
+        where de_id = #{deId}
+    </select>
+
+    <select id="selectDcDesignList" parameterType="DcDesign" resultMap="DcDesignResult">
+        <include refid="selectDcDesignVo"/>
+        <where>
+            <if test="deSysId != null and deSysId != ''">
+                AND de_sys_id = #{deSysId}
+            </if>
+            <if test="dePId != null and dePId != ''">
+                AND de_p_id = #{dePId}
+            </if>
+            <if test="deQaNo != null and deQaNo != ''">
+                AND de_qa_no = #{deQaNo}
+            </if>
+            <if test="deQaAType != null and deQaAType != ''">
+                AND de_qa_a_type = #{deQaAType}
+            </if>
+            <if test="dePre != null and dePre != ''">
+                AND de_pre = #{dePre}
+            </if>
+        </where>
+    </select>
+
+    <insert id="insertDcDesign" parameterType="DcDesign">
+        insert into dc_design
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deId != null">de_id,</if>
+            <if test="deSysId != null">de_sys_id,</if>
+            <if test="dePId != null">de_p_id,</if>
+            <if test="deQaNo != null">de_qa_no,</if>
+            <if test="deQaTj != null">de_qa_tj,</if>
+            <if test="deQaFn != null">de_qa_fn,</if>
+            <if test="deQaQNr != null">de_qa_q_nr,</if>
+            <if test="deQaAType != null">de_qa_a_type,</if>
+            <if test="deQaABl != null">de_qa_a_bl,</if>
+            <if test="deQaABltb != null">de_qa_a_bltb,</if>
+            <if test="deQaABlsm != null">de_qa_a_blsm,</if>
+            <if test="deQaABlz != null">de_qa_a_blz,</if>
+            <if test="deQaHf != null">de_qa_hf,</if>
+            <if test="deQaCz != null">de_qa_cz,</if>
+            <if test="dePre != null">de_pre,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deId != null">#{deId},</if>
+            <if test="deSysId != null">#{deSysId},</if>
+            <if test="dePId != null">#{dePId},</if>
+            <if test="deQaNo != null">#{deQaNo},</if>
+            <if test="deQaTj != null">#{deQaTj},</if>
+            <if test="deQaFn != null">#{deQaFn},</if>
+            <if test="deQaQNr != null">#{deQaQNr},</if>
+            <if test="deQaAType != null">#{deQaAType},</if>
+            <if test="deQaABl != null">#{deQaABl},</if>
+            <if test="deQaABltb != null">#{deQaABltb},</if>
+            <if test="deQaABlsm != null">#{deQaABlsm},</if>
+            <if test="deQaABlz != null">#{deQaABlz},</if>
+            <if test="deQaHf != null">#{deQaHf},</if>
+            <if test="deQaCz != null">#{deQaCz},</if>
+            <if test="dePre != null">#{dePre},</if>
+        </trim>
+    </insert>
+
+    <update id="updateDcDesign" parameterType="DcDesign">
+        update dc_design
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deSysId != null">de_sys_id = #{deSysId},</if>
+            <if test="dePId != null">de_p_id = #{dePId},</if>
+            <if test="deQaNo != null">de_qa_no = #{deQaNo},</if>
+            <if test="deQaTj != null">de_qa_tj = #{deQaTj},</if>
+            <if test="deQaFn != null">de_qa_fn = #{deQaFn},</if>
+            <if test="deQaQNr != null">de_qa_q_nr = #{deQaQNr},</if>
+            <if test="deQaAType != null">de_qa_a_type = #{deQaAType},</if>
+            <if test="deQaABl != null">de_qa_a_bl = #{deQaABl},</if>
+            <if test="deQaABltb != null">de_qa_a_bltb = #{deQaABltb},</if>
+            <if test="deQaABlsm != null">de_qa_a_blsm = #{deQaABlsm},</if>
+            <if test="deQaABlz != null">de_qa_a_blz = #{deQaABlz},</if>
+            <if test="deQaHf != null">de_qa_hf = #{deQaHf},</if>
+            <if test="deQaCz != null">de_qa_cz = #{deQaCz},</if>
+            <if test="dePre != null">de_pre = #{dePre},</if>
+        </trim>
+        where de_id = #{deId}
+    </update>
+
+    <delete id="deleteDcDesignById" parameterType="String">
+        delete from dc_design where de_id = #{deId}
+    </delete>
+
+    <delete id="deleteDcDesignByIds" parameterType="String">
+        delete from dc_design where de_id in
+        <foreach item="deId" collection="array" open="(" separator="," close=")">
+            #{deId}
+        </foreach>
+    </delete>
+
+</mapper>

+ 4 - 3
pom.xml

@@ -3,13 +3,13 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<modelVersion>4.0.0</modelVersion>
-	
+
     <groupId>com.gqy</groupId>
     <groupId>com.gqy</groupId>
     <artifactId>gqy</artifactId>
     <artifactId>gqy</artifactId>
     <version>3.8.8</version>
     <version>3.8.8</version>
 
 
     <description>旷视可以GQY系统</description>
     <description>旷视可以GQY系统</description>
-    
+
     <properties>
     <properties>
         <gqy.version>3.8.8</gqy.version>
         <gqy.version>3.8.8</gqy.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -180,6 +180,7 @@
                 <version>${gqy.version}</version>
                 <version>${gqy.version}</version>
             </dependency>
             </dependency>
 
 
+
         </dependencies>
         </dependencies>
     </dependencyManagement>
     </dependencyManagement>
 
 
@@ -233,4 +234,4 @@
         </pluginRepository>
         </pluginRepository>
     </pluginRepositories>
     </pluginRepositories>
 
 
-</project>
+</project>