Browse Source

优化结构

zhouhao 7 years ago
parent
commit
29f12aa7cc
60 changed files with 588 additions and 572 deletions
  1. 8 3
      hsweb-system/hsweb-system-module/hsweb-system-module-entity/pom.xml
  2. 41 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/DictionaryInfo.java
  3. 15 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/DictionaryInfoService.java
  4. 2 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryItemService.java
  5. 1 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryParser.java
  6. 3 4
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryParserService.java
  7. 2 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryService.java
  8. 13 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/DictionaryWrapper.java
  9. 11 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/builder/DictionaryParserBuilder.java
  10. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/DictionaryEntity.java
  11. 1 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/DictionaryItemEntity.java
  12. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/DictionaryParserEntity.java
  13. 7 7
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/SimpleDictionaryEntity.java
  14. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/SimpleDictionaryItemEntity.java
  15. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/SimpleDictionaryParserEntity.java
  16. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/parser/SingleDictParser.java
  17. 0 49
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-controller/pom.xml
  18. 0 45
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/pom.xml
  19. 0 44
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/pom.xml
  20. 0 36
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/pom.xml
  21. 0 40
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/pom.xml
  22. 0 42
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/pom.xml
  23. 0 12
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/builder/DictionaryParserBuilder.java
  24. 0 104
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/test/java/org/hswebframework/web/dictionary/starter/DictionaryParserTests.java
  25. 0 34
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/pom.xml
  26. 6 21
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/pom.xml
  27. 3 4
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/BoostDictDefineRepository.java
  28. 12 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/main/java/org/hswebframework/web/dictionary/simple/DefaultDictionaryHelper.java
  29. 164 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/main/java/org/hswebframework/web/dictionary/simple/DefaultDictionaryWrapper.java
  30. 13 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/main/java/org/hswebframework/web/dictionary/simple/DictionaryWrapperObject.java
  31. 4 4
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryItemService.java
  32. 9 7
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryParser.java
  33. 7 8
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryParserService.java
  34. 4 7
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryService.java
  35. 4 5
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/builder/SimpleDictionaryParserBuilder.java
  36. 2 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/src/main/java/org/hswebframework/web/dao/dictionary/DictionaryDao.java
  37. 2 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/src/main/java/org/hswebframework/web/dao/dictionary/DictionaryItemDao.java
  38. 2 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/src/main/java/org/hswebframework/web/dao/dictionary/DictionaryParserDao.java
  39. 1 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/DictParserFormat.java
  40. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/DictParserFormatter.java
  41. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/FormatterResult.java
  42. 2 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/ScriptSingleDictParser.java
  43. 4 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/SimpleDictParserFormatter.java
  44. 4 4
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/SimpleSingleDictParser.java
  45. 3 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dictionary/DictionaryItemMapper.xml
  46. 3 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dictionary/DictionaryMapper.xml
  47. 3 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dictionary/DictionaryParserMapper.xml
  48. 79 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/DefaultDictionaryWrapperTest.java
  49. 12 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/EmptyDictBean.java
  50. 20 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/TestBean.java
  51. 86 0
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/TestDict.java
  52. 2 7
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/pom.xml
  53. 6 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/src/main/java/org/hswebframework/web/dictionary/starter/DictionaryFactoryAutoConfiguration.java
  54. 1 1
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/src/test/java/org/hswebframework/web/dictionary/starter/DictionaryParserTests.java
  55. 2 3
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/src/test/java/org/hswebframework/web/dictionary/starter/DictionaryTests.java
  56. 10 9
      hsweb-system/hsweb-system-module/hsweb-system-module-controller/pom.xml
  57. 2 5
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-controller/src/main/java/org/hswebframework/web/controller/dictionary/DictionaryController.java
  58. 2 2
      hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-controller/src/main/java/org/hswebframework/web/controller/dictionary/DictionaryParserController.java
  59. 3 4
      hsweb-system/hsweb-system-dictionary/pom.xml
  60. 0 18
      hsweb-system/hsweb-system-module/hsweb-system-module-service/pom.xml

+ 8 - 3
hsweb-system/hsweb-system-module/hsweb-system-module-entity/pom.xml

@@ -3,18 +3,23 @@
          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">
     <parent>
-        <artifactId>hsweb-system-module</artifactId>
+        <artifactId>hsweb-system-dictionary</artifactId>
         <groupId>org.hswebframework.web</groupId>
         <version>3.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>hsweb-system-module-entity</artifactId>
+    <artifactId>hsweb-system-dictionary-api</artifactId>
 
     <dependencies>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-entity</artifactId>
+            <artifactId>hsweb-commons-bean</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-service-api</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>

+ 41 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/DictionaryInfo.java

@@ -0,0 +1,41 @@
+package org.hswebframework.web.dictionary.api;
+
+import lombok.*;
+import org.hibernate.validator.constraints.NotBlank;
+import org.hswebframework.web.commons.bean.ValidateBean;
+
+import java.io.Serializable;
+
+/**
+ * 字典信息
+ *
+ * @author zhouhao
+ * @since 3.0
+ */
+@Getter
+@Setter
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class DictionaryInfo implements ValidateBean, Serializable {
+    private static final long serialVersionUID = -4017149592047646129L;
+
+    private String id;
+
+    @NotBlank(message = "[字典ID]不能为空")
+    private String dictionaryId;
+
+    @NotBlank(message = "[目标key]不能为空")
+    private String targetKey;
+
+    @NotBlank(message = "[目标ID]不能为空")
+    private String targetId;
+
+    @NotBlank(message = "[值]不能为空")
+    private String value;
+
+    @NotBlank(message = "[文本说明]不能为空")
+    private String text;
+
+}

+ 15 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/DictionaryInfoService.java

@@ -0,0 +1,15 @@
+package org.hswebframework.web.dictionary.api;
+
+import java.util.List;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+public interface DictionaryInfoService  {
+    int insert(List<DictionaryInfo> dictionaryInfo);
+
+    List<DictionaryInfo> select(String targetKey, String targetId, String dictionaryId);
+
+    int delete(String targetKey, String targetId, String dictionaryId);
+}

+ 2 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryItemService.java

@@ -14,9 +14,9 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.service.dictionary;
+package org.hswebframework.web.dictionary.api;
 
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity;
 import org.hswebframework.web.service.CrudService;
 
 /**

+ 1 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryParser.java

@@ -16,10 +16,9 @@
  *
  */
 
-package org.hswebframework.web.service.dictionary;
+package org.hswebframework.web.dictionary.api;
 
 import java.io.Serializable;
-import java.util.List;
 import java.util.Optional;
 
 /**

+ 3 - 4
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryParserService.java

@@ -14,11 +14,10 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.service.dictionary;
+package org.hswebframework.web.dictionary.api;
 
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryParserEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity;
 import org.hswebframework.web.service.CrudService;
 
 /**

+ 2 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/DictionaryService.java

@@ -14,10 +14,9 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.service.dictionary;
+package org.hswebframework.web.dictionary.api;
 
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
 import org.hswebframework.web.service.CrudService;
 
 /**

+ 13 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/DictionaryWrapper.java

@@ -0,0 +1,13 @@
+package org.hswebframework.web.dictionary.api;
+
+/**
+ * 字典包装器,用于将实体类中的字段保存到数据库,或者将数据库中的字典信息包装到实体中
+ *
+ * @author zhouhao
+ * @since 3.0
+ */
+public interface DictionaryWrapper {
+    <T> T wrap(Object id, T bean);
+
+    <T> T persistent(Object id, T bean);
+}

+ 11 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-api/src/main/java/org/hswebframework/web/dictionary/api/builder/DictionaryParserBuilder.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.dictionary.api.builder;
+
+
+import org.hswebframework.web.dictionary.api.parser.SingleDictParser;
+
+/**
+ * @author zhouhao
+ */
+public interface DictionaryParserBuilder {
+    SingleDictParser build(String config);
+}

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/DictionaryEntity.java

@@ -14,7 +14,7 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.entity.dictionary;
+package org.hswebframework.web.dictionary.api.entity;
 
 import org.hswebframework.web.commons.entity.GenericEntity;
 import org.hswebframework.web.commons.entity.RecordCreationEntity;

+ 1 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/DictionaryItemEntity.java

@@ -14,10 +14,9 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.entity.dictionary;
+package org.hswebframework.web.dictionary.api.entity;
 
 import org.hswebframework.web.commons.entity.TreeSortSupportEntity;
-import org.hswebframework.web.commons.entity.TreeSupportEntity;
 
 import java.util.List;
 

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/DictionaryParserEntity.java

@@ -14,7 +14,7 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.entity.dictionary;
+package org.hswebframework.web.dictionary.api.entity;
 
 import org.hswebframework.web.commons.entity.GenericEntity;
 import org.hswebframework.web.commons.entity.RecordCreationEntity;

+ 7 - 7
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/SimpleDictionaryEntity.java

@@ -14,7 +14,7 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.entity.dictionary;
+package org.hswebframework.web.dictionary.api.entity;
 
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
@@ -27,17 +27,17 @@ import java.util.List;
  */
 public class SimpleDictionaryEntity extends SimpleGenericEntity<String> implements DictionaryEntity {
     //字典名称
-    private String                           name;
+    private String                     name;
     //分类id
-    private String                           classifiedId;
+    private String                     classifiedId;
     //说明
-    private String                           describe;
+    private String                     describe;
     //创建时间
-    private Long                             createTime;
+    private Long                       createTime;
     //创建人id
-    private String                           creatorId;
+    private String                     creatorId;
     //状态
-    private Byte                             status;
+    private Byte                       status;
     //字段选项
     private List<DictionaryItemEntity> items;
 

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/SimpleDictionaryItemEntity.java

@@ -14,7 +14,7 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.entity.dictionary;
+package org.hswebframework.web.dictionary.api.entity;
 
 import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
 

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/src/main/java/org/hswebframework/web/entity/dictionary/SimpleDictionaryParserEntity.java

@@ -14,7 +14,7 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.entity.dictionary;
+package org.hswebframework.web.dictionary.api.entity;
 
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/parser/SingleDictParser.java

@@ -1,4 +1,4 @@
-package org.hswebframework.web.service.dictionary.parser;
+package org.hswebframework.web.dictionary.api.parser;
 
 import java.io.Serializable;
 import java.util.Optional;

+ 0 - 49
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-controller/pom.xml

@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright 2016 http://www.hswebframework.org
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-controller</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.5</version>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-service-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-controller</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 45
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/pom.xml

@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 
-  ~   Copyright 2016 http://www.hswebframework.org
-  ~  
-  ~   Licensed under the Apache License, Version 2.0 (the "License");
-  ~   you may not use this file except in compliance with the License.
-  ~   You may obtain a copy of the License at
-  ~  
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~  
-  ~   Unless required by applicable law or agreed to in writing, software
-  ~   distributed under the License is distributed on an "AS IS" BASIS,
-  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~   See the License for the specific language governing permissions and
-  ~   limitations under the License.
-  ~  
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary-dao</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-dao-api</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-entity</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-dao-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 44
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/pom.xml

@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 
-  ~   Copyright 2016 http://www.hswebframework.org
-  ~  
-  ~   Licensed under the Apache License, Version 2.0 (the "License");
-  ~   you may not use this file except in compliance with the License.
-  ~   You may obtain a copy of the License at
-  ~  
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~  
-  ~   Unless required by applicable law or agreed to in writing, software
-  ~   distributed under the License is distributed on an "AS IS" BASIS,
-  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~   See the License for the specific language governing permissions and
-  ~   limitations under the License.
-  ~  
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary-dao</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-dao-mybatis</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-dao-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-dao-mybatis</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 36
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/pom.xml

@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 
-  ~   Copyright 2016 http://www.hswebframework.org
-  ~  
-  ~   Licensed under the Apache License, Version 2.0 (the "License");
-  ~   you may not use this file except in compliance with the License.
-  ~   You may obtain a copy of the License at
-  ~  
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~  
-  ~   Unless required by applicable law or agreed to in writing, software
-  ~   distributed under the License is distributed on an "AS IS" BASIS,
-  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~   See the License for the specific language governing permissions and
-  ~   limitations under the License.
-  ~  
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-dao</artifactId>
-    <packaging>pom</packaging>
-    <modules>
-        <module>hsweb-system-dictionary-dao-api</module>
-        <module>hsweb-system-dictionary-dao-mybatis</module>
-    </modules>
-</project>

+ 0 - 40
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-entity/pom.xml

@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 
-  ~   Copyright 2016 http://www.hswebframework.org
-  ~  
-  ~   Licensed under the Apache License, Version 2.0 (the "License");
-  ~   you may not use this file except in compliance with the License.
-  ~   You may obtain a copy of the License at
-  ~  
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~  
-  ~   Unless required by applicable law or agreed to in writing, software
-  ~   distributed under the License is distributed on an "AS IS" BASIS,
-  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~   See the License for the specific language governing permissions and
-  ~   limitations under the License.
-  ~  
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-entity</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-entity</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 42
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/pom.xml

@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright 2016 http://www.hswebframework.org
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary-service</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-service-api</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-service-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-dao-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 12
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-api/src/main/java/org/hswebframework/web/service/dictionary/builder/DictionaryParserBuilder.java

@@ -1,12 +0,0 @@
-package org.hswebframework.web.service.dictionary.builder;
-
-import org.hswebframework.web.service.dictionary.parser.SingleDictParser;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public interface DictionaryParserBuilder {
-    SingleDictParser build(String config);
-}

+ 0 - 104
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/test/java/org/hswebframework/web/dictionary/starter/DictionaryParserTests.java

@@ -1,104 +0,0 @@
-/*
- *  Copyright 2016 http://www.hswebframework.org
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.hswebframework.web.dictionary.starter;
-
-import com.alibaba.fastjson.JSON;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.entity.dictionary.SimpleDictionaryEntity;
-import org.hswebframework.web.entity.dictionary.SimpleDictionaryItemEntity;
-import org.hswebframework.web.service.dictionary.DictionaryParser;
-import org.hswebframework.web.service.dictionary.simple.SimpleDictionaryParser;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author
- */
-public class DictionaryParserTests {
-
-    DictionaryParser<String> parser;
-
-    @Before
-    public void init() {
-        SimpleDictionaryEntity dictionaryEntity = new SimpleDictionaryEntity();
-        String json = "[" +
-                "{'value':'1','text':'水果','children':" +
-                "[" +
-                "{'value':'101','text':'苹果'," +
-                "'children':[" +
-                "{'value':'10102','text':'红富士'}" +
-                ",{'value':'10103','text':'青苹果'}" +
-                //使用表达式进行解析
-                ",{'id':'10105','value':'10105','text':'其他苹果'}" +
-                "]}" +
-                ",{'value':'102','text':'梨子'}]" +
-                "}" +
-                ",{'value':'2','text':'蔬菜'}" +
-                "]";
-
-        List<DictionaryItemEntity> itemEntities = JSON.parseArray(json, DictionaryItemEntity.class);
-        dictionaryEntity.setItems(itemEntities);
-        this.parser = new SimpleDictionaryParser<String>()
-                .addToTextExpression("10105", "${#value}[${#context[otherApple]}]")
-                .addToValueExpression("10105", "${(#context.put('otherApple',#pattern.split(\"[ \\[ \\]]\")[1])==null)?#value:#value}")
-                .setDict(dictionaryEntity);
-    }
-
-    //支持表达式
-    @Test
-    public void testParseExpression() {
-
-        String val = "1,2,101,10102,10105";
-
-        Map<String, Object> data = new HashMap<>();
-        data.put("otherApple", "其他苹果1号");
-
-        String text = parser
-                .valueToText(val, data)
-                .get();
-
-        System.out.println(text);
-        data.clear();
-        String parseVal = parser.textToValue(text, data)
-                .get();
-        System.out.println(parseVal);
-        System.out.println(data);
-
-    }
-
-    //普通的解析
-    @Test
-    public void testParseText() throws Exception {
-        String val = "1,101,10102,10103,2";
-
-        String text = parser.valueToText(val).get();
-
-        System.out.println(text);
-        String parsedVal = parser.textToValue(text).get();
-
-        System.out.println(parsedVal);
-        Assert.assertEquals(val, parsedVal);
-
-    }
-}

+ 0 - 34
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/pom.xml

@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright 2016 http://www.hswebframework.org
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-dictionary</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-dictionary-service</artifactId>
-    <packaging>pom</packaging>
-    <modules>
-        <module>hsweb-system-dictionary-service-api</module>
-        <module>hsweb-system-dictionary-service-simple</module>
-    </modules>
-</project>

+ 6 - 21
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/pom.xml

@@ -1,47 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright 2016 http://www.hswebframework.org
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          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">
     <parent>
-        <artifactId>hsweb-system-dictionary-service</artifactId>
+        <artifactId>hsweb-system-dictionary</artifactId>
         <groupId>org.hswebframework.web</groupId>
         <version>3.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>hsweb-system-dictionary-service-simple</artifactId>
+    <artifactId>hsweb-system-dictionary-simple</artifactId>
 
     <dependencies>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-service-simple</artifactId>
+            <artifactId>hsweb-system-dictionary-api</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-service-api</artifactId>
+            <artifactId>hsweb-commons-service-simple</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-utils</artifactId>
+            <artifactId>hsweb-commons-dao-mybatis</artifactId>
             <version>${project.version}</version>
         </dependency>
+
     </dependencies>
 </project>

+ 3 - 4
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/BoostDictDefineRepository.java

@@ -1,14 +1,13 @@
-package org.hswebframework.web.service.dictionary.simple;
+package org.hswebframework.web.dictionary.simple;
 
 import org.hswebframework.web.dict.ClassDictDefine;
 import org.hswebframework.web.dict.DictDefine;
 import org.hswebframework.web.dict.ItemDefine;
-import org.hswebframework.web.dict.defaults.DefaultClassDictDefine;
 import org.hswebframework.web.dict.defaults.DefaultDictDefine;
 import org.hswebframework.web.dict.defaults.DefaultDictDefineRepository;
 import org.hswebframework.web.dict.defaults.DefaultItemDefine;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.service.dictionary.DictionaryService;
+import org.hswebframework.web.dictionary.api.DictionaryService;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheConfig;
 import org.springframework.cache.annotation.Cacheable;

+ 12 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/main/java/org/hswebframework/web/dictionary/simple/DefaultDictionaryHelper.java

@@ -0,0 +1,12 @@
+package org.hswebframework.web.dictionary.simple;
+
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+public interface DefaultDictionaryHelper {
+    Object getDictEnum(Object id, String targetKey, String dictId, Class type);
+
+    void persistent(Object id, String targetKey, String dictId, Class type,Object value);
+}

+ 164 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/main/java/org/hswebframework/web/dictionary/simple/DefaultDictionaryWrapper.java

@@ -0,0 +1,164 @@
+package org.hswebframework.web.dictionary.simple;
+
+import lombok.Setter;
+import org.apache.commons.beanutils.BeanUtilsBean;
+import org.hswebframework.web.dict.Dict;
+import org.hswebframework.web.dict.EnumDict;
+import org.hswebframework.web.dictionary.api.DictionaryInfo;
+import org.hswebframework.web.dictionary.api.DictionaryInfoService;
+import org.hswebframework.web.dictionary.api.DictionaryWrapper;
+import org.hswebframework.web.proxy.Proxy;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ClassUtils;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+public class DefaultDictionaryWrapper implements DictionaryWrapper, DefaultDictionaryHelper {
+    static DictionaryWrapperObject EMPTY_WRAPPER = new DictionaryWrapperObject() {
+        @Override
+        public void wrap(Object id, Object bean, DefaultDictionaryHelper helper) {
+
+        }
+
+        @Override
+        public void persistent(Object id, Object bean, DefaultDictionaryHelper helper) {
+
+        }
+    };
+
+    @Autowired
+    @Setter
+    private DictionaryInfoService dictionaryInfoService;
+
+    protected Map<Class, DictionaryWrapperObject> cache = new ConcurrentHashMap<>();
+
+    protected DictionaryWrapperObject createCache(Class bean) {
+        String beanName = bean.getName();
+        StringBuilder wrapMethod = new StringBuilder()
+                .append("public void wrap(Object id,Object bean, org.hswebframework.web.dictionary.simple.DefaultDictionaryHelper helper)")
+                .append("{\n")
+                .append(bean.getName()).append(" target=(").append(bean.getName()).append(")bean;\n");
+
+        StringBuilder persistentMethod = new StringBuilder()
+                .append("public void persistent(Object id,Object bean, org.hswebframework.web.dictionary.simple.DefaultDictionaryHelper helper)")
+                .append("{\n")
+                .append(bean.getName()).append(" target=(").append(bean.getName()).append(")bean;\n");
+
+        PropertyDescriptor[] descriptors = BeanUtilsBean.getInstance().getPropertyUtils().getPropertyDescriptors(bean);
+        boolean hasDict = false;
+        for (PropertyDescriptor descriptor : descriptors) {
+            Class type = descriptor.getPropertyType();
+            boolean isArray = type.isArray();
+            if (isArray) {
+                type = type.getComponentType();
+            }
+            //枚举字典并且枚举数量大于64
+            if (type.isEnum() && EnumDict.class.isAssignableFrom(type) && type.getEnumConstants().length >= 64) {
+                String typeName = isArray ? type.getName().concat("[]") : type.getName();
+                String dictId = type.getName();
+                Dict dict = (Dict) type.getAnnotation(Dict.class);
+                if (dict != null) {
+                    dictId = dict.id();
+                }
+                wrapMethod.append("{\n");
+                wrapMethod.append(typeName).append(" dict=(").append(typeName).append(")helper.getDictEnum(id,")
+                        .append("\"").append(beanName).append(".").append(descriptor.getName()).append("\"").append(",\"").append(dictId).append("\"")
+                        .append(",").append(typeName).append(".class);\n");
+                wrapMethod.append("target.").append(descriptor.getWriteMethod().getName()).append("(dict);\n");
+                wrapMethod.append("}");
+
+                persistentMethod.append("helper.persistent(id,")
+                        .append("\"").append(beanName).append(".").append(descriptor.getName()).append("\"").append(",\"").append(dictId).append("\"")
+                        .append(",").append(typeName).append(".class,")
+                        .append("target.").append(descriptor.getReadMethod().getName()).append("()")
+                        .append(");\n");
+
+                hasDict = true;
+            }
+        }
+        wrapMethod.append("\n}");
+        persistentMethod.append("\n}");
+        if (hasDict) {
+            return Proxy.create(DictionaryWrapperObject.class)
+                    .addMethod(wrapMethod.toString())
+                    .addMethod(persistentMethod.toString())
+                    .newInstance();
+        }
+        return EMPTY_WRAPPER;
+    }
+
+    @Override
+    public <T> T wrap(Object id, T bean) {
+        cache.computeIfAbsent(ClassUtils.getUserClass(bean.getClass()), this::createCache)
+                .wrap(id, bean, getHelper());
+        return bean;
+    }
+
+    protected DefaultDictionaryHelper getHelper() {
+        return this;
+    }
+
+    @Override
+    public <T> T persistent(Object id, T bean) {
+        cache.computeIfAbsent(ClassUtils.getUserClass(bean.getClass()), this::createCache)
+                .persistent(id, bean, getHelper());
+        return bean;
+    }
+
+    @Override
+    @SuppressWarnings("all")
+    public Object getDictEnum(Object id, String targetKey, String dictId, Class type) {
+        List<DictionaryInfo> infos = dictionaryInfoService.select(targetKey, String.valueOf(id), dictId);
+        Class componentType = type.isArray() ? type.getComponentType() : type;
+        if (componentType.isEnum() && EnumDict.class.isAssignableFrom(componentType)) {
+            Stream stream = infos.stream()
+                    .map(DictionaryInfo::getValue)
+                    .map(val -> EnumDict.find(componentType, val).orElse(null))
+                    .filter(Objects::nonNull);
+            if (type.isArray()) {
+                return stream.toArray(len -> Array.newInstance(componentType, len));
+            } else {
+                return stream.findFirst().orElse(null);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void persistent(Object id, String targetKey, String dictId, Class type, Object value) {
+        if (value == null) {
+            return;
+        }
+        Class componentType = type.isArray() ? type.getComponentType() : type;
+        if (componentType.isEnum() && EnumDict.class.isAssignableFrom(componentType)) {
+            List<EnumDict> dicts;
+            if (type.isArray()) {
+                dicts = Arrays.asList(((EnumDict[]) value));
+            } else {
+                dicts = Arrays.asList(((EnumDict) value));
+            }
+            dictionaryInfoService.delete(targetKey, String.valueOf(id), dictId);
+            dictionaryInfoService.insert(dicts.stream().map(dict ->
+                    DictionaryInfo.builder()
+                            .value(String.valueOf(dict.getValue()))
+                            .dictionaryId(dictId)
+                            .text(dict.getText())
+                            .targetKey(targetKey)
+                            .targetId(String.valueOf(id))
+                            .build()).collect(Collectors.toList()));
+        }
+
+    }
+}

+ 13 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/main/java/org/hswebframework/web/dictionary/simple/DictionaryWrapperObject.java

@@ -0,0 +1,13 @@
+package org.hswebframework.web.dictionary.simple;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+public interface DictionaryWrapperObject {
+
+    void wrap(Object id, Object bean, DefaultDictionaryHelper helper);
+
+    void persistent(Object id, Object bean, DefaultDictionaryHelper helper);
+
+}

+ 4 - 4
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryItemService.java

@@ -14,13 +14,13 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.service.dictionary.simple;
+package org.hswebframework.web.dictionary.simple;
 
-import org.hswebframework.web.dao.dictionary.DictionaryItemDao;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.DictionaryItemService;
+import org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.simple.dao.DictionaryItemDao;
 import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.AbstractTreeSortService;
-import org.hswebframework.web.service.dictionary.DictionaryItemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

+ 9 - 7
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryParser.java

@@ -1,12 +1,14 @@
-package org.hswebframework.web.service.dictionary.simple;
+package org.hswebframework.web.dictionary.simple;
 
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.service.dictionary.DictionaryParser;
-import org.hswebframework.web.service.dictionary.simple.parser.SimpleSingleDictParser;
-import org.hswebframework.web.service.dictionary.parser.SingleDictParser;
+import org.hswebframework.web.dictionary.api.DictionaryParser;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.parser.SingleDictParser;
+import org.hswebframework.web.dictionary.simple.parser.SimpleSingleDictParser;
 
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
 
 /**
  * 简单的字典解析器实现,支持树形结构字典

+ 7 - 8
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryParserService.java

@@ -14,17 +14,16 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.service.dictionary.simple;
+package org.hswebframework.web.dictionary.simple;
 
-import org.hswebframework.web.dao.dictionary.DictionaryParserDao;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryParserEntity;
+import org.hswebframework.web.dictionary.api.DictionaryParser;
+import org.hswebframework.web.dictionary.api.DictionaryParserService;
+import org.hswebframework.web.dictionary.api.builder.DictionaryParserBuilder;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity;
+import org.hswebframework.web.dictionary.simple.dao.DictionaryParserDao;
 import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.GenericEntityService;
-import org.hswebframework.web.service.dictionary.DictionaryParser;
-import org.hswebframework.web.service.dictionary.DictionaryParserService;
-import org.hswebframework.web.service.dictionary.builder.DictionaryParserBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

+ 4 - 7
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/SimpleDictionaryService.java

@@ -14,16 +14,13 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.service.dictionary.simple;
+package org.hswebframework.web.dictionary.simple;
 
-import org.hswebframework.web.dao.dictionary.DictionaryDao;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.DictionaryService;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
+import org.hswebframework.web.dictionary.simple.dao.DictionaryDao;
 import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.EnableCacheAllEvictGenericEntityService;
-import org.hswebframework.web.service.EnableCacheGenericEntityService;
-import org.hswebframework.web.service.GenericEntityService;
-import org.hswebframework.web.service.dictionary.DictionaryService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheConfig;
 import org.springframework.stereotype.Service;

+ 4 - 5
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/builder/SimpleDictionaryParserBuilder.java

@@ -1,15 +1,14 @@
-package org.hswebframework.web.service.dictionary.simple.builder;
+package org.hswebframework.web.dictionary.simple.builder;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import org.hswebframework.web.service.dictionary.builder.DictionaryParserBuilder;
-import org.hswebframework.web.service.dictionary.parser.SingleDictParser;
-import org.hswebframework.web.service.dictionary.simple.parser.SimpleSingleDictParser;
+import org.hswebframework.web.dictionary.api.builder.DictionaryParserBuilder;
+import org.hswebframework.web.dictionary.api.parser.SingleDictParser;
+import org.hswebframework.web.dictionary.simple.parser.SimpleSingleDictParser;
 
 import java.util.Objects;
 
 /**
- * TODO 完成注释
  *
  * @author zhouhao
  */

+ 2 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/src/main/java/org/hswebframework/web/dao/dictionary/DictionaryDao.java

@@ -14,11 +14,10 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.dao.dictionary;
+package org.hswebframework.web.dictionary.simple.dao;
 
 import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
 
 /**
 *  数据字典 DAO接口

+ 2 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/src/main/java/org/hswebframework/web/dao/dictionary/DictionaryItemDao.java

@@ -14,10 +14,10 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.dao.dictionary;
+package org.hswebframework.web.dictionary.simple.dao;
 
 import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity;
 
 /**
 *  数据字典选项 DAO接口

+ 2 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-api/src/main/java/org/hswebframework/web/dao/dictionary/DictionaryParserDao.java

@@ -14,10 +14,10 @@
  *  limitations under the License.
  *  
  */
-package org.hswebframework.web.dao.dictionary;
+package org.hswebframework.web.dictionary.simple.dao;
 
 import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.entity.dictionary.DictionaryParserEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity;
 
 /**
 *  数据字典解析配置 DAO接口

+ 1 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/DictParserFormat.java

@@ -1,11 +1,9 @@
-package org.hswebframework.web.service.dictionary.simple.parser;
+package org.hswebframework.web.dictionary.simple.parser;
 
 import java.io.Serializable;
 import java.util.StringJoiner;
 
 /**
- * TODO 完成注释
- *
  * @author zhouhao
  */
 public class DictParserFormat implements Serializable {

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/DictParserFormatter.java

@@ -1,4 +1,4 @@
-package org.hswebframework.web.service.dictionary.simple.parser;
+package org.hswebframework.web.dictionary.simple.parser;
 
 import java.util.List;
 import java.util.function.BiFunction;

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/FormatterResult.java

@@ -1,4 +1,4 @@
-package org.hswebframework.web.service.dictionary.simple.parser;
+package org.hswebframework.web.dictionary.simple.parser;
 
 /**
  *

+ 2 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/ScriptSingleDictParser.java

@@ -1,9 +1,8 @@
-package org.hswebframework.web.service.dictionary.simple.parser;
+package org.hswebframework.web.dictionary.simple.parser;
 
 import org.hswebframework.expands.script.engine.DynamicScriptEngine;
 import org.hswebframework.expands.script.engine.DynamicScriptEngineFactory;
-import org.hswebframework.web.ExpressionUtils;
-import org.hswebframework.web.service.dictionary.parser.SingleDictParser;
+import org.hswebframework.web.dictionary.api.parser.SingleDictParser;
 
 import java.util.HashMap;
 import java.util.Map;

+ 4 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/SimpleDictParserFormatter.java

@@ -1,8 +1,10 @@
-package org.hswebframework.web.service.dictionary.simple.parser;
+package org.hswebframework.web.dictionary.simple.parser;
 
 import org.hswebframework.web.RegexUtils;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 import java.util.function.BiFunction;
 import java.util.stream.Collectors;
 

+ 4 - 4
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-service/hsweb-system-dictionary-service-simple/src/main/java/org/hswebframework/web/service/dictionary/simple/parser/SimpleSingleDictParser.java

@@ -1,9 +1,9 @@
-package org.hswebframework.web.service.dictionary.simple.parser;
+package org.hswebframework.web.dictionary.simple.parser;
 
 import org.hswebframework.web.ExpressionUtils;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.service.dictionary.parser.SingleDictParser;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.parser.SingleDictParser;
 
 import java.io.Serializable;
 import java.util.*;

+ 3 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dictionary/DictionaryItemMapper.xml

@@ -18,8 +18,8 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.hswebframework.web.dao.dictionary.DictionaryItemDao">
-    <resultMap id="DictionaryItemResultMap" type="org.hswebframework.web.entity.dictionary.SimpleDictionaryItemEntity">
+<mapper namespace="org.hswebframework.web.dictionary.simple.dao.DictionaryItemDao">
+    <resultMap id="DictionaryItemResultMap" type="org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity">
         <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
         <result property="dictId" column="dict_id" javaType="String" jdbcType="VARCHAR"/>
         <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
@@ -45,7 +45,7 @@
         <bind name="tableName" value="'s_dict_item'"/>
     </sql>
 
-    <insert id="insert" parameterType="org.hswebframework.web.entity.dictionary.SimpleDictionaryItemEntity">
+    <insert id="insert" parameterType="org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity">
         <include refid="config"/>
         <include refid="BasicMapper.buildInsertSql"/>
     </insert>

+ 3 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dictionary/DictionaryMapper.xml

@@ -18,8 +18,8 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.hswebframework.web.dao.dictionary.DictionaryDao">
-    <resultMap id="DictionaryResultMap" type="org.hswebframework.web.entity.dictionary.SimpleDictionaryEntity">
+<mapper namespace="org.hswebframework.web.dictionary.simple.dao.DictionaryDao">
+    <resultMap id="DictionaryResultMap" type="org.hswebframework.web.dictionary.api.entity.DictionaryEntity">
         <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
         <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
         <result property="classifiedId" column="classified_id" javaType="String" jdbcType="VARCHAR"/>
@@ -35,7 +35,7 @@
         <bind name="tableName" value="'s_dictionary'"/>
     </sql>
 
-    <insert id="insert" parameterType="org.hswebframework.web.entity.dictionary.SimpleDictionaryEntity">
+    <insert id="insert" parameterType="org.hswebframework.web.dictionary.api.entity.DictionaryEntity">
         <include refid="config"/>
         <include refid="BasicMapper.buildInsertSql"/>
     </insert>

+ 3 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-dao/hsweb-system-dictionary-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dictionary/DictionaryParserMapper.xml

@@ -18,8 +18,8 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.hswebframework.web.dao.dictionary.DictionaryParserDao">
-    <resultMap id="DictionaryParserResultMap" type="org.hswebframework.web.entity.dictionary.SimpleDictionaryParserEntity">
+<mapper namespace="org.hswebframework.web.dictionary.simple.dao.DictionaryParserDao">
+    <resultMap id="DictionaryParserResultMap" type="org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity">
         <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
             <result property="valueToTextParser" column="v_t_parser" javaType="String" jdbcType="CLOB"/>
             <result property="textToValueParser" column="t_v_parser" javaType="String" jdbcType="CLOB"/>
@@ -38,7 +38,7 @@
         <bind name="tableName" value="'s_dict_parser'"/>
     </sql>
   
-    <insert id="insert" parameterType="org.hswebframework.web.entity.dictionary.SimpleDictionaryParserEntity" >
+    <insert id="insert" parameterType="org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity" >
         <include refid="config"/>
         <include refid="BasicMapper.buildInsertSql"/>
     </insert>

+ 79 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/DefaultDictionaryWrapperTest.java

@@ -0,0 +1,79 @@
+package org.hswebframework.web.dictionary.simple;
+
+import org.hswebframework.web.dictionary.api.DictionaryInfo;
+import org.hswebframework.web.dictionary.api.DictionaryInfoService;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ * @since
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class DefaultDictionaryWrapperTest {
+
+    @Mock
+    private DictionaryInfoService dictionaryInfoService;
+
+    @InjectMocks
+    private DefaultDictionaryWrapper wrapper = new DefaultDictionaryWrapper();
+
+    @Before
+    public void init() {
+        List<DictionaryInfo> infos = new ArrayList<>();
+        infos.add(DictionaryInfo.builder()
+                .value(TestDict.CODE0.getValue())
+                .build());
+        infos.add(DictionaryInfo.builder()
+                .value(TestDict.CODE1.getValue())
+                .build());
+
+        when(dictionaryInfoService.select("org.hswebframework.web.dictionary.simple.TestBean.dict", "test", "TestDict"))
+                .thenReturn(infos);
+
+        when(dictionaryInfoService.select("org.hswebframework.web.dictionary.simple.TestBean.dict2", "test", "TestDict"))
+                .thenReturn(Arrays.asList(infos.get(0)));
+
+        when(dictionaryInfoService.insert(anyList())).then(invocationOnMock -> {
+            System.out.println(invocationOnMock.getArgumentAt(0, List.class));
+            return null;
+        });
+
+        when(dictionaryInfoService.delete(anyString(),anyString(),anyString())).then(invocationOnMock -> {
+            System.out.println(Arrays.toString(invocationOnMock.getArguments()));
+            return null;
+        });
+    }
+
+    @Test
+    public void test() {
+
+        TestBean bean = new TestBean();
+        wrapper.wrap("test", bean);
+        System.out.println(bean);
+        Assert.assertNotNull(bean.getDict());
+        Assert.assertEquals(bean.getDict().length, 2);
+        wrapper.persistent("test", bean);
+
+        wrapper.wrap("test2", new EmptyDictBean());
+        wrapper.persistent("test2", new EmptyDictBean());
+
+    }
+}

+ 12 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/EmptyDictBean.java

@@ -0,0 +1,12 @@
+package org.hswebframework.web.dictionary.simple;
+
+import lombok.Data;
+
+/**
+ * @author zhouhao
+ * @since
+ */
+@Data
+public class EmptyDictBean {
+    private String id;
+}

+ 20 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/TestBean.java

@@ -0,0 +1,20 @@
+package org.hswebframework.web.dictionary.simple;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * @author zhouhao
+ * @since
+ */
+@Data
+@Getter
+@Setter
+@ToString
+public class TestBean {
+    private TestDict[] dict;
+
+    private TestDict dict2;
+}

+ 86 - 0
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-simple/src/test/java/org/hswebframework/web/dictionary/simple/TestDict.java

@@ -0,0 +1,86 @@
+package org.hswebframework.web.dictionary.simple;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.hswebframework.web.dict.Dict;
+import org.hswebframework.web.dict.EnumDict;
+
+@Getter
+@AllArgsConstructor
+@Dict(id = "TestDict")
+public enum TestDict implements EnumDict {
+
+    CODE0("TEST0","TEST0","TEST0"),
+    CODE1("TEST1","TEST1","TEST1"),
+    CODE2("TEST2","TEST2","TEST2"),
+    CODE3("TEST3","TEST3","TEST3"),
+    CODE4("TEST4","TEST4","TEST4"),
+    CODE5("TEST5","TEST5","TEST5"),
+    CODE6("TEST6","TEST6","TEST6"),
+    CODE7("TEST7","TEST7","TEST7"),
+    CODE8("TEST8","TEST8","TEST8"),
+    CODE9("TEST9","TEST9","TEST9"),
+    CODE10("TEST10","TEST10","TEST10"),
+    CODE11("TEST11","TEST11","TEST11"),
+    CODE12("TEST12","TEST12","TEST12"),
+    CODE13("TEST13","TEST13","TEST13"),
+    CODE14("TEST14","TEST14","TEST14"),
+    CODE15("TEST15","TEST15","TEST15"),
+    CODE16("TEST16","TEST16","TEST16"),
+    CODE17("TEST17","TEST17","TEST17"),
+    CODE18("TEST18","TEST18","TEST18"),
+    CODE19("TEST19","TEST19","TEST19"),
+    CODE20("TEST20","TEST20","TEST20"),
+    CODE21("TEST21","TEST21","TEST21"),
+    CODE22("TEST22","TEST22","TEST22"),
+    CODE23("TEST23","TEST23","TEST23"),
+    CODE24("TEST24","TEST24","TEST24"),
+    CODE25("TEST25","TEST25","TEST25"),
+    CODE26("TEST26","TEST26","TEST26"),
+    CODE27("TEST27","TEST27","TEST27"),
+    CODE28("TEST28","TEST28","TEST28"),
+    CODE29("TEST29","TEST29","TEST29"),
+    CODE30("TEST30","TEST30","TEST30"),
+    CODE31("TEST31","TEST31","TEST31"),
+    CODE32("TEST32","TEST32","TEST32"),
+    CODE33("TEST33","TEST33","TEST33"),
+    CODE34("TEST34","TEST34","TEST34"),
+    CODE35("TEST35","TEST35","TEST35"),
+    CODE36("TEST36","TEST36","TEST36"),
+    CODE37("TEST37","TEST37","TEST37"),
+    CODE38("TEST38","TEST38","TEST38"),
+    CODE39("TEST39","TEST39","TEST39"),
+    CODE40("TEST40","TEST40","TEST40"),
+    CODE41("TEST41","TEST41","TEST41"),
+    CODE42("TEST42","TEST42","TEST42"),
+    CODE43("TEST43","TEST43","TEST43"),
+    CODE44("TEST44","TEST44","TEST44"),
+    CODE45("TEST45","TEST45","TEST45"),
+    CODE46("TEST46","TEST46","TEST46"),
+    CODE47("TEST47","TEST47","TEST47"),
+    CODE48("TEST48","TEST48","TEST48"),
+    CODE49("TEST49","TEST49","TEST49"),
+    CODE50("TEST50","TEST50","TEST50"),
+    CODE51("TEST51","TEST51","TEST51"),
+    CODE52("TEST52","TEST52","TEST52"),
+    CODE53("TEST53","TEST53","TEST53"),
+    CODE54("TEST54","TEST54","TEST54"),
+    CODE55("TEST55","TEST55","TEST55"),
+    CODE56("TEST56","TEST56","TEST56"),
+    CODE57("TEST57","TEST57","TEST57"),
+    CODE58("TEST58","TEST58","TEST58"),
+    CODE59("TEST59","TEST59","TEST59"),
+    CODE60("TEST60","TEST60","TEST60"),
+    CODE61("TEST61","TEST61","TEST61"),
+    CODE62("TEST62","TEST62","TEST62"),
+    CODE63("TEST63","TEST63","TEST63"),
+    CODE64("TEST64","TEST64","TEST64"),
+    ;
+
+
+    private String value;
+
+    private String text;
+
+    private String comments;
+}

+ 2 - 7
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/pom.xml

@@ -41,17 +41,12 @@
     <dependencies>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-service-simple</artifactId>
+            <artifactId>hsweb-system-dictionary-simple</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-dao-mybatis</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-dictionary-controller</artifactId>
+            <artifactId>hsweb-system-dictionary-web</artifactId>
             <version>${project.version}</version>
         </dependency>
 

+ 6 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/src/main/java/org/hswebframework/web/dictionary/starter/DictionaryFactoryAutoConfiguration.java

@@ -1,10 +1,12 @@
 package org.hswebframework.web.dictionary.starter;
 
+import org.hswebframework.web.dao.Dao;
 import org.hswebframework.web.dict.DictDefineRepository;
 import org.hswebframework.web.dict.DictSupportApi;
 import org.hswebframework.web.dict.defaults.DefaultDictSupportApi;
-import org.hswebframework.web.service.dictionary.builder.DictionaryParserBuilder;
-import org.hswebframework.web.service.dictionary.simple.builder.SimpleDictionaryParserBuilder;
+import org.hswebframework.web.dictionary.api.builder.DictionaryParserBuilder;
+import org.hswebframework.web.dictionary.simple.builder.SimpleDictionaryParserBuilder;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
@@ -14,8 +16,9 @@ import org.springframework.context.annotation.Configuration;
  * @author zhouhao
  */
 @Configuration
-@ComponentScan({"org.hswebframework.web.service.dictionary.simple"
+@ComponentScan({"org.hswebframework.web.dictionary.simple"
         , "org.hswebframework.web.controller.dictionary"})
+@MapperScan(value = "org.hswebframework.web.dictionary.simple.dao",markerInterface = Dao.class)
 public class DictionaryFactoryAutoConfiguration {
     @Bean
     @ConditionalOnMissingBean(DictionaryParserBuilder.class)

+ 1 - 1
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/src/test/java/org/hswebframework/web/dictionary/starter/DictionaryParserTests.java

@@ -20,7 +20,7 @@ package org.hswebframework.web.dictionary.starter;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import org.hswebframework.web.entity.dictionary.DictionaryParserEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity;
 import org.hswebframework.web.starter.convert.FastJsonGenericHttpMessageConverter;
 import org.hswebframework.web.tests.SimpleWebApplicationTests;
 import org.junit.Assert;

+ 2 - 3
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-starter/src/test/java/org/hswebframework/web/dictionary/starter/DictionaryTests.java

@@ -21,9 +21,8 @@ package org.hswebframework.web.dictionary.starter;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import org.hswebframework.web.commons.entity.DataStatus;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.entity.dictionary.SimpleDictionaryItemEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
+import org.hswebframework.web.dictionary.api.entity.DictionaryItemEntity;
 import org.hswebframework.web.starter.convert.FastJsonGenericHttpMessageConverter;
 import org.hswebframework.web.tests.SimpleWebApplicationTests;
 import org.junit.Assert;

+ 10 - 9
hsweb-system/hsweb-system-module/hsweb-system-module-controller/pom.xml

@@ -3,24 +3,18 @@
          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">
     <parent>
-        <artifactId>hsweb-system-module</artifactId>
+        <artifactId>hsweb-system-dictionary</artifactId>
         <groupId>org.hswebframework.web</groupId>
         <version>3.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>hsweb-system-module-controller</artifactId>
+    <artifactId>hsweb-system-dictionary-web</artifactId>
 
     <dependencies>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.5</version>
-            <optional>true</optional>
-        </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-module-service-api</artifactId>
+            <artifactId>hsweb-system-dictionary-api</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
@@ -28,5 +22,12 @@
             <artifactId>hsweb-commons-controller</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
+
 </project>

+ 2 - 5
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-controller/src/main/java/org/hswebframework/web/controller/dictionary/DictionaryController.java

@@ -20,12 +20,9 @@ package org.hswebframework.web.controller.dictionary;
 import io.swagger.annotations.Api;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
-import org.hswebframework.web.controller.GenericEntityController;
 import org.hswebframework.web.controller.SimpleGenericEntityController;
-import org.hswebframework.web.entity.dictionary.DictionaryEntity;
-import org.hswebframework.web.entity.dictionary.DictionaryItemEntity;
-import org.hswebframework.web.logging.AccessLogger;
-import org.hswebframework.web.service.dictionary.DictionaryService;
+import org.hswebframework.web.dictionary.api.DictionaryService;
+import org.hswebframework.web.dictionary.api.entity.DictionaryEntity;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;

+ 2 - 2
hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-controller/src/main/java/org/hswebframework/web/controller/dictionary/DictionaryParserController.java

@@ -21,9 +21,9 @@ import io.swagger.annotations.Api;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.controller.GenericEntityController;
-import org.hswebframework.web.entity.dictionary.DictionaryParserEntity;
+import org.hswebframework.web.dictionary.api.DictionaryParserService;
+import org.hswebframework.web.dictionary.api.entity.DictionaryParserEntity;
 import org.hswebframework.web.logging.AccessLogger;
-import org.hswebframework.web.service.dictionary.DictionaryParserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;

+ 3 - 4
hsweb-system/hsweb-system-dictionary/pom.xml

@@ -29,11 +29,10 @@
     <artifactId>hsweb-system-dictionary</artifactId>
     <packaging>pom</packaging>
     <modules>
-        <module>hsweb-system-dictionary-dao</module>
-        <module>hsweb-system-dictionary-service</module>
-        <module>hsweb-system-dictionary-controller</module>
-        <module>hsweb-system-dictionary-entity</module>
         <module>hsweb-system-dictionary-starter</module>
+        <module>hsweb-system-dictionary-api</module>
+        <module>hsweb-system-dictionary-simple</module>
+        <module>hsweb-system-dictionary-web</module>
     </modules>
 
 

+ 0 - 18
hsweb-system/hsweb-system-module/hsweb-system-module-service/pom.xml

@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         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">
-    <parent>
-        <artifactId>hsweb-system-module</artifactId>
-        <groupId>org.hswebframework.web</groupId>
-        <version>3.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hsweb-system-module-service</artifactId>
-    <packaging>pom</packaging>
-    <modules>
-        <module>hsweb-system-module-service-api</module>
-        <module>hsweb-system-module-service-simple</module>
-    </modules>
-</project>