Ver Fonte

预留缓存的接口

xiaochan há 3 meses atrás
pai
commit
6052ebaf48

+ 9 - 0
thyy-emr-query/src/main/java/org/thyy/emrquery/dao/UserInfoDao.java

@@ -0,0 +1,9 @@
+package org.thyy.emrquery.dao;
+
+import org.apache.ibatis.annotations.Select;
+
+public interface UserInfoDao {
+
+    @Select("select password from dj_user_base where code = '${code}'")
+    String getUserPwdCode(String code);
+}

+ 0 - 61
thyy-emr-query/src/main/java/org/thyy/emrquery/utils/JavaToTypeScriptConverter.java

@@ -1,61 +0,0 @@
-package org.thyy.emrquery.utils;
-
-import org.thyy.emrquery.entity.timeLimitConfig.CreateEditingRestrictions;
-
-import java.lang.reflect.Field;
-import java.util.Date;
-
-public class JavaToTypeScriptConverter {
-
-    public static String convertType(Class<?> type) {
-        if (type == Integer.class) {
-            return "number | null";
-        }
-        if (type == Date.class) {
-            return "date";
-        }
-        if (type == int.class) {
-            return "number";
-        } else if (type == String.class) {
-            return "string";
-        } else if (type == Boolean.class || type == boolean.class) {
-            return "boolean";
-        } else if (type == Double.class || type == double.class || type == Float.class || type == float.class) {
-            return "number";
-        } else if (type == Long.class || type == long.class) {
-            return "bigint";
-        } else {
-            return type.getSimpleName();
-        }
-    }
-
-    public static String generateTypeScriptDefinition(Class<?> clazz) {
-        StringBuilder sb = new StringBuilder();
-        sb.append("interface ").append(clazz.getSimpleName()).append(" {\n");
-        Field[] fields = clazz.getDeclaredFields();
-        for (Field field : fields) {
-            sb.append("  /**\n");
-            sb.append("   * ").append(field.getName()).append("\n");
-            sb.append("   */\n");
-
-            // 处理嵌套类型
-            if (field.getType().isArray()) {
-                Class<?> componentType = field.getType().getComponentType();
-                sb.append("  ").append(field.getName()).append(": ").append(convertType(componentType)).append("[];\n");
-            } else if (field.getType().isPrimitive() || field.getType().getPackage().getName().startsWith("java")) {
-                sb.append("  ").append(field.getName()).append(": ").append(convertType(field.getType())).append(";\n");
-            } else {
-                sb.append("  ").append(field.getName()).append(": ").append(convertType(field.getType())).append(";\n");
-                sb.append(generateTypeScriptDefinition(field.getType())); // 递归处理嵌套类型
-            }
-        }
-        sb.append("}\n");
-        return sb.toString();
-    }
-
-    public static void main(String[] args) {
-        Class<?> clazz = CreateEditingRestrictions.class;
-        String definition = generateTypeScriptDefinition(clazz);
-        System.out.println(definition);
-    }
-}

+ 0 - 11
thyy-emr-query/src/main/java/org/thyy/emrquery/utils/ListUtil.java

@@ -80,15 +80,4 @@ public class ListUtil {
         }
     }
 
-    public static void main(String[] args) {
-        List<Integer> s = new ArrayList<>();
-
-        for (int i = 0; i < 11; i++) {
-            s.add(i);
-        }
-
-        System.out.println(partition(s, 2));
-
-    }
-
 }

+ 13 - 0
thyy-utils/src/main/java/org/thyy/utils/hutoolcache/CacheAll.java

@@ -0,0 +1,13 @@
+package org.thyy.utils.hutoolcache;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CacheAll {
+    private String key;
+    private Object value;
+}

+ 42 - 0
thyy-utils/src/main/java/org/thyy/utils/hutoolcache/HutoolCacheInterface.java

@@ -0,0 +1,42 @@
+package org.thyy.utils.hutoolcache;
+
+import cn.hutool.cache.impl.CacheObj;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public interface HutoolCacheInterface<T> {
+
+    void put(String key, T value);
+
+    T get(String key);
+
+
+    void del(String key);
+
+    void clear();
+
+    List<CacheAll> getAll();
+
+    default void refreshCache(String key) {
+
+    }
+
+    default String getLabel() {
+        return null;
+    }
+
+    default List<CacheAll> getAllUtils(Iterator<CacheObj<String, T>> cacheObjIterator) {
+        List<CacheAll> list = new ArrayList<>();
+
+        cacheObjIterator.forEachRemaining(i -> {
+            list.add(new CacheAll(i.getKey(), i.getValue()));
+        });
+
+        return list;
+    }
+
+
+}
+