浏览代码

优化实体命名

zhouhao 8 年之前
父节点
当前提交
3f61afa70f
共有 100 个文件被更改,包括 2064 次插入337 次删除
  1. 11 0
      hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Authorize.java
  2. 0 1
      hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/UserSubject.java
  3. 0 10
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/CloneableBean.java
  4. 2 3
      hsweb-commons/hsweb-commons-controller/src/main/java/org/hswebframework/web/controller/CrudController.java
  5. 5 5
      hsweb-commons/hsweb-commons-controller/src/main/java/org/hswebframework/web/controller/GenericBeanController.java
  6. 1 1
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml
  7. 2 2
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/CrudDao.java
  8. 2 2
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/dynamic/DeleteByBeanDao.java
  9. 3 3
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/dynamic/QueryByBeanDao.java
  10. 3 3
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/dynamic/UpdateByBeanDao.java
  11. 1 1
      hsweb-commons/hsweb-commons-beans/pom.xml
  12. 10 0
      hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/CloneableEntity.java
  13. 2 2
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/Bean.java
  14. 15 2
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/GenericBean.java
  15. 2 2
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/PagerResult.java
  16. 4 4
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SharedBean.java
  17. 3 3
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SimpleGenericBean.java
  18. 4 4
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SimpleSharedBean.java
  19. 2 2
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SortSupport.java
  20. 3 3
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/TreeSortSupportBean.java
  21. 2 2
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/TreeSupport.java
  22. 10 10
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/factory/BeanFactory.java
  23. 31 21
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/factory/MapperBeanFactory.java
  24. 8 8
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/param/DeleteParamBean.java
  25. 9 9
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/param/QueryParamBean.java
  26. 11 11
      hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/param/UpdateParamBean.java
  27. 3 3
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/CreateBeanService.java
  28. 4 4
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/CrudService.java
  29. 3 4
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/QueryByBeanService.java
  30. 14 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/Validator.java
  31. 107 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/AbstractService.java
  32. 7 7
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLDeleteService.java
  33. 6 6
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLQueryService.java
  34. 13 5
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLUpdateService.java
  35. 12 12
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultQueryByBeanService.java
  36. 0 147
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericBeanService.java
  37. 93 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java
  38. 3 3
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericService.java
  39. 2 2
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/dsl/DSLQuery.java
  40. 5 5
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/dsl/SimpleDSLQuery.java
  41. 5 5
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/dsl/SimpleFieldCondition.java
  42. 1 1
      hsweb-commons/hsweb-commons-service/pom.xml
  43. 1 1
      hsweb-commons/pom.xml
  44. 6 1
      hsweb-core/src/main/java/org/hswebframework/web/validate/ValidationException.java
  45. 1 1
      hsweb-message/README.md
  46. 14 0
      hsweb-message/hsweb-message-api/pom.xml
  47. 11 0
      hsweb-message/hsweb-message-api/src/main/java/org/hswebframework/web/message/Message.java
  48. 10 0
      hsweb-message/hsweb-message-api/src/main/java/org/hswebframework/web/message/MessageListener.java
  49. 17 0
      hsweb-message/hsweb-message-api/src/main/java/org/hswebframework/web/message/MessageManager.java
  50. 37 0
      hsweb-message/hsweb-message-jms/pom.xml
  51. 35 0
      hsweb-message/hsweb-message-jms/src/main/java/org/hswebframework/web/message/jms/JmsMessageManager.java
  52. 55 0
      hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/AmqpTests.java
  53. 26 0
      hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/Consumer.java
  54. 15 0
      hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/Consumer2.java
  55. 31 0
      hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/SampleActiveMQApplication.java
  56. 15 0
      hsweb-message/hsweb-message-jms/src/test/resources/application.yml
  57. 5 0
      hsweb-message/pom.xml
  58. 1 1
      hsweb-system/README.md
  59. 26 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/pom.xml
  60. 13 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/PermissionDao.java
  61. 25 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/PermissionRoleDao.java
  62. 12 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/RoleDao.java
  63. 12 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/UserDao.java
  64. 23 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/UserRoleDao.java
  65. 43 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/pom.xml
  66. 66 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/PermissionMapper.xml
  67. 67 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/PermissionRoleMapper.xml
  68. 65 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/RoleMapper.xml
  69. 70 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserMapper.xml
  70. 56 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserRoleMapper.xml
  71. 19 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/pom.xml
  72. 2 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-bean/pom.xml
  73. 17 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/ActionEntity.java
  74. 18 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/Authorization.java
  75. 24 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionEntity.java
  76. 22 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionReadEntity.java
  77. 20 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionRoleEntity.java
  78. 19 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionRoleReadEntity.java
  79. 23 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/RoleEntity.java
  80. 62 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleActionEntity.java
  81. 70 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionEntity.java
  82. 57 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionRoleEntity.java
  83. 53 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleRoleEntity.java
  84. 111 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserEntity.java
  85. 41 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserRoleEntity.java
  86. 14 13
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-bean/src/main/java/org/hswebframework/web/bean/authorization/UserBean.java
  87. 27 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/UserReadEntity.java
  88. 19 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/UserRoleEntity.java
  89. 17 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/WebPermissionEntity.java
  90. 17 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/BindPermissionRoleEntity.java
  91. 16 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/BindRoleUserEntity.java
  92. 38 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/SimpleBindPermissionRoleEntity.java
  93. 43 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/SimpleBindRoleUserEntity.java
  94. 26 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/pom.xml
  95. 11 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/PasswordStrengthValidator.java
  96. 15 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/PermissionService.java
  97. 28 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/RoleService.java
  98. 42 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/UserService.java
  99. 11 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/UsernameValidator.java
  100. 0 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/pom.xml

+ 11 - 0
hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/Authorize.java

@@ -25,6 +25,7 @@ import java.lang.annotation.*;
  */
 @Target({ElementType.TYPE, ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
+@Inherited
 @Documented
 public @interface Authorize {
 
@@ -49,8 +50,18 @@ public @interface Authorize {
      */
     String[] action() default {};
 
+    /**
+     * 验证是否为指定user
+     *
+     * @return
+     */
     String[] user() default {};
 
+    /**
+     * 验证失败时返回的消息
+     *
+     * @return
+     */
     String message() default "{unauthorized}";
 
     /**

+ 0 - 1
hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/UserSubject.java

@@ -23,7 +23,6 @@ import java.util.Set;
 /**
  * @author zhouhao
  */
-@Authorize(user = "{data.creatorId}")
 public interface UserSubject {
 
     String getUsername();

+ 0 - 10
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/CloneableBean.java

@@ -1,10 +0,0 @@
-package org.hswebframework.web.commons.beans;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public interface CloneableBean extends Bean, Cloneable {
-    CloneableBean clone();
-}

+ 2 - 3
hsweb-commons/hsweb-commons-controller/src/main/java/org/hswebframework/web/controller/CrudController.java

@@ -19,12 +19,11 @@
 package org.hswebframework.web.controller;
 
 import org.hswebframework.web.authorization.Authorize;
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 import org.hswebframework.web.controller.message.ResponseMessage;
 import org.hswebframework.web.logging.AccessLogger;
 import org.hswebframework.web.service.CrudService;
 import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 import static org.hswebframework.web.controller.message.ResponseMessage.ok;
@@ -34,7 +33,7 @@ import static org.hswebframework.web.controller.message.ResponseMessage.ok;
  *
  * @author zhouhao
  */
-public interface CrudController<B, PK, Q extends Bean> {
+public interface CrudController<B, PK, Q extends Entity> {
 
     CrudService<B, PK, Q> getService();
 

+ 5 - 5
hsweb-commons/hsweb-commons-controller/src/main/java/org/hswebframework/web/controller/GenericBeanController.java

@@ -18,8 +18,8 @@
 
 package org.hswebframework.web.controller;
 
-import org.hswebframework.web.commons.beans.GenericBean;
-import org.hswebframework.web.commons.beans.param.QueryParamBean;
+import org.hswebframework.web.commons.entity.GenericEntity;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.controller.message.ResponseMessage;
 import org.hswebframework.web.service.CrudService;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -32,10 +32,10 @@ import static org.hswebframework.web.controller.message.ResponseMessage.ok;
  *
  * @author zhouhao
  */
-public interface GenericBeanController<B extends GenericBean<PK>, PK>
-        extends CrudController<B, PK, QueryParamBean> {
+public interface GenericEntityController<B extends GenericEntity<PK>, PK>
+        extends CrudController<B, PK, QueryParamEntity> {
 
-    CrudService<B, PK, QueryParamBean> getService();
+    CrudService<B, PK, QueryParamEntity> getService();
 
     @Override
     default ResponseMessage updateByPrimaryKey(@PathVariable PK id, @RequestBody B data) {

+ 1 - 1
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml

@@ -32,7 +32,7 @@
     <dependencies>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-beans</artifactId>
+            <artifactId>hsweb-commons-entity</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>

+ 2 - 2
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/CrudDao.java

@@ -18,7 +18,7 @@
 
 package org.hswebframework.web.dao;
 
-import org.hswebframework.web.dao.dynamic.UpdateByBeanDao;
+import org.hswebframework.web.dao.dynamic.UpdateByEntityDao;
 import org.hswebframework.web.dao.dynamic.DeleteByBeanDao;
 import org.hswebframework.web.dao.dynamic.QueryByBeanDao;
 
@@ -31,6 +31,6 @@ public interface CrudDao<PO, PK> extends
         InsertDao<PO>,
         DeleteDao<PK>,
         DeleteByBeanDao,
-        UpdateByBeanDao,
+        UpdateByEntityDao,
         QueryByBeanDao<PO> {
 }

+ 2 - 2
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/dynamic/DeleteByBeanDao.java

@@ -18,7 +18,7 @@
 
 package org.hswebframework.web.dao.dynamic;
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * TODO  完成注释
@@ -27,5 +27,5 @@ import org.hswebframework.web.commons.beans.Bean;
  * @since 3.0
  */
 public interface DeleteByBeanDao {
-    int delete(Bean bean);
+    int delete(Entity entity);
 }

+ 3 - 3
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/dynamic/QueryByBeanDao.java

@@ -18,7 +18,7 @@
 
 package org.hswebframework.web.dao.dynamic;
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 import java.util.List;
 
@@ -29,7 +29,7 @@ import java.util.List;
  * @since 3.0
  */
 public interface QueryByBeanDao<PO> {
-    List<PO> query(Bean queryBean);
+    List<PO> query(Entity queryEntity);
 
-    int count(Bean queryBean);
+    int count(Entity queryEntity);
 }

+ 3 - 3
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/src/main/java/org/hswebframework/web/dao/dynamic/UpdateByBeanDao.java

@@ -18,7 +18,7 @@
 
 package org.hswebframework.web.dao.dynamic;
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * TODO  完成注释
@@ -26,6 +26,6 @@ import org.hswebframework.web.commons.beans.Bean;
  * @author zhouhao
  * @since 3.0
  */
-public interface UpdateByBeanDao {
-    int update(Bean bean);
+public interface UpdateByEntityDao {
+    int update(Entity entity);
 }

+ 1 - 1
hsweb-commons/hsweb-commons-beans/pom.xml

@@ -27,7 +27,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>hsweb-commons-beans</artifactId>
+    <artifactId>hsweb-commons-entity</artifactId>
 
     <dependencies>
         <dependency>

+ 10 - 0
hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/CloneableEntity.java

@@ -0,0 +1,10 @@
+package org.hswebframework.web.commons.entity;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface CloneableEntity extends Entity, Cloneable {
+    <T extends CloneableEntity> T clone();
+}

+ 2 - 2
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/Bean.java

@@ -16,7 +16,7 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 import java.io.Serializable;
 
@@ -25,5 +25,5 @@ import java.io.Serializable;
  *
  * @author zhouhao
  */
-public interface Bean extends Serializable{
+public interface Entity extends Serializable{
 }

+ 15 - 2
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/GenericBean.java

@@ -16,7 +16,7 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -25,7 +25,7 @@ import java.util.Map;
  * @author zhouhao
  * @since 3.0
  */
-public interface GenericBean<PK> extends CloneableBean {
+public interface GenericEntity<PK> extends CloneableEntity {
     String id = "id";
 
     String properties = "properties";
@@ -57,4 +57,17 @@ public interface GenericBean<PK> extends CloneableBean {
         map.put(propertyName, value);
     }
 
+    default Map<String, Object> cloneProperties() {
+        Map<String, Object> target = new LinkedHashMap<>();
+        Map<String, Object> old = getProperties();
+        if (old == null || old.isEmpty()) return target;
+        old.forEach((k, v) -> {
+            if (v instanceof CloneableEntity) {
+                target.put(k, ((CloneableEntity) v).clone());
+            } else {
+                target.put(k, v);
+            }
+        });
+        return target;
+    }
 }

+ 2 - 2
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/PagerResult.java

@@ -16,12 +16,12 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 
 import java.util.List;
 
-public class PagerResult<B> implements Bean {
+public class PagerResult<B> implements Entity {
     private static final long serialVersionUID = -6171751136953308027L;
     private int total;
 

+ 4 - 4
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SharedBean.java

@@ -16,23 +16,23 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 /**
  * TODO 完成注释
  *
  * @author zhouhao
  */
-public interface SharedBean extends Bean {
+public interface SharedEntity extends Entity {
 
     String creatorId = "creatorId";
     String shareCode = "shareCode";
 
     String getCreatorId();
 
-    SharedBean setCreatorId(String creatorId);
+    SharedEntity setCreatorId(String creatorId);
 
     String getShareCode();
 
-    SharedBean setShareCode(String shareCode);
+    SharedEntity setShareCode(String shareCode);
 }

+ 3 - 3
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SimpleGenericBean.java

@@ -16,7 +16,7 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -25,7 +25,7 @@ import java.util.Map;
  * @author zhouhao
  * @since 3.0
  */
-public abstract class SimpleGenericBean<PK> implements GenericBean<PK> {
+public abstract class SimpleGenericEntity<PK> implements GenericEntity<PK> {
 
     private PK id;
 
@@ -70,5 +70,5 @@ public abstract class SimpleGenericBean<PK> implements GenericBean<PK> {
     }
 
     @Override
-    public abstract SimpleGenericBean<PK> clone();
+    public abstract SimpleGenericEntity<PK> clone();
 }

+ 4 - 4
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SimpleSharedBean.java

@@ -16,7 +16,7 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 
 import org.hibernate.validator.constraints.NotBlank;
@@ -26,7 +26,7 @@ import org.hibernate.validator.constraints.NotBlank;
  *
  * @author zhouhao
  */
-public abstract class SimpleSharedBean<PK> extends SimpleGenericBean<PK> implements SharedBean {
+public abstract class SimpleSharedEntity<PK> extends SimpleGenericEntity<PK> implements SharedEntity {
     @NotBlank
     private String creatorId;
 
@@ -39,7 +39,7 @@ public abstract class SimpleSharedBean<PK> extends SimpleGenericBean<PK> impleme
     }
 
     @Override
-    public SimpleSharedBean<PK> setCreatorId(String creatorId) {
+    public SimpleSharedEntity<PK> setCreatorId(String creatorId) {
         this.creatorId = creatorId;
         return this;
     }
@@ -50,7 +50,7 @@ public abstract class SimpleSharedBean<PK> extends SimpleGenericBean<PK> impleme
     }
 
     @Override
-    public SimpleSharedBean<PK> setShareCode(String shareCode) {
+    public SimpleSharedEntity<PK> setShareCode(String shareCode) {
         this.shareCode = shareCode;
         return this;
     }

+ 2 - 2
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/SortSupport.java

@@ -16,9 +16,9 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
-public interface SortSupport extends Comparable<SortSupport> {
+public interface SortSupport extends Comparable<SortSupport>, Entity {
 
     long getSortIndex();
 

+ 3 - 3
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/TreeSortSupportBean.java

@@ -16,14 +16,14 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 import org.hswebframework.web.Describe;
 
 /**
  * 支持树形结构,排序的实体类,要使用树形结构,排序功能的实体类直接继承该类
  */
-public abstract class TreeSortSupportBean extends SimpleGenericBean<String> implements TreeSupport, SortSupport {
+public abstract class TreeSortSupportEntity extends SimpleGenericEntity<String> implements TreeSupport, SortSupport {
 
     /**
      * 父级类别
@@ -70,7 +70,7 @@ public abstract class TreeSortSupportBean extends SimpleGenericBean<String> impl
     }
 
     @Override
-    public TreeSortSupportBean setSortIndex(long sortIndex) {
+    public TreeSortSupportEntity setSortIndex(long sortIndex) {
         this.sortIndex = sortIndex;
         return this;
     }

+ 2 - 2
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/TreeSupport.java

@@ -16,7 +16,7 @@
  *
  */
 
-package org.hswebframework.web.commons.beans;
+package org.hswebframework.web.commons.entity;
 
 
 import org.hswebframework.web.id.IDGenerator;
@@ -25,7 +25,7 @@ import org.hswebframwork.utils.StringUtils;
 
 import java.util.List;
 
-public interface TreeSupport {
+public interface TreeSupport extends Entity {
     String getId();
 
     void setId(String id);

+ 10 - 10
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/factory/BeanFactory.java

@@ -16,26 +16,26 @@
  *  
  */
 
-package org.hswebframework.web.commons.beans.factory;
+package org.hswebframework.web.commons.entity.factory;
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * 实体工厂接口,系统各个地方使用此接口来创建实体,在实际编码中也应该使用此接口来创建实体,而不是使用new方式来创建
  *
  * @author zhouhao
- * @see Bean
+ * @see Entity
  * @since 3.0
  */
-public interface BeanFactory {
+public interface EntityFactory {
     /**
-     * 根据类型创建实体,类型必须为{@link Bean}的子类。
+     * 根据类型创建实体,类型必须为{@link Entity}的子类。
      *
-     * @param beanClass 类型
-     * @param <T>       泛型,需实现{@link Bean}
+     * @param entityClass 类型
+     * @param <T>       泛型,需实现{@link Entity}
      * @return 实体
      */
-    <T extends Bean> T newInstance(Class<T> beanClass);
+    <T extends Entity> T newInstance(Class<T> entityClass);
 
     /**
      * 根据类型获取实体的真实的实体类型,
@@ -44,9 +44,9 @@ public interface BeanFactory {
      * factory.getInstanceType(MyBeanInterface.class); -> class SimpleMyBeanInterface
      * </code>
      *
-     * @param beanClass 类型
+     * @param entityClass 类型
      * @param <T>       泛型
      * @return 实体类型
      */
-    <T extends Bean> Class<T> getInstanceType(Class<T> beanClass);
+    <T extends Entity> Class<T> getInstanceType(Class<T> entityClass);
 }

+ 31 - 21
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/factory/MapperBeanFactory.java

@@ -16,9 +16,10 @@
  *  
  */
 
-package org.hswebframework.web.commons.beans.factory;
+package org.hswebframework.web.commons.entity.factory;
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.NotFoundException;
+import org.hswebframework.web.commons.entity.Entity;
 
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
@@ -31,35 +32,44 @@ import java.util.function.Supplier;
  * @author zhouhao
  * @since 3.0
  */
-public class MapperBeanFactory implements BeanFactory {
+public class MapperEntityFactory implements EntityFactory {
     private Map<Class, Mapper> realTypeMapper = new HashMap<>();
 
+    public <T extends Entity> MapperEntityFactory addMapping(Class<T> target, Mapper<T> mapper) {
+        realTypeMapper.put(target, mapper);
+        return this;
+    }
+
     @Override
     @SuppressWarnings("unchecked")
-    public <T extends Bean> T newInstance(Class<T> beanClass) {
+    public <T extends Entity> T newInstance(Class<T> beanClass) {
         Mapper<T> mapper = realTypeMapper.get(beanClass);
         if (mapper != null) return mapper.getInstanceGetter().get();
-        Class<T> realType = null;
-        if (!Modifier.isInterface(beanClass.getModifiers()) && !Modifier.isAbstract(beanClass.getModifiers())) {
-            realType = beanClass;
-        }
-        //尝试使用 Simple类,如: package.SimpleUserBean
-        if (realType == null) {
-            String simpleClassName = beanClass.getPackage().getName().concat(".Simple").concat(beanClass.getSimpleName());
-            try {
-                realType = (Class<T>) Class.forName(simpleClassName);
-                mapper = new Mapper<>(realType, new DefaultInstanceGetter(realType));
-                realTypeMapper.put(beanClass, mapper);
-                return mapper.getInstanceGetter().get();
-            } catch (ClassNotFoundException e) {
+        synchronized (beanClass) {
+            mapper = realTypeMapper.get(beanClass);
+            if (mapper != null) return mapper.getInstanceGetter().get();
+            Class<T> realType = null;
+            if (!Modifier.isInterface(beanClass.getModifiers()) && !Modifier.isAbstract(beanClass.getModifiers())) {
+                realType = beanClass;
+            }
+            //尝试使用 Simple类,如: package.SimpleUserBean
+            if (realType == null) {
+                String simpleClassName = beanClass.getPackage().getName().concat(".Simple").concat(beanClass.getSimpleName());
+                try {
+                    realType = (Class<T>) Class.forName(simpleClassName);
+                    mapper = new Mapper<>(realType, new DefaultInstanceGetter(realType));
+                    realTypeMapper.put(beanClass, mapper);
+                    return mapper.getInstanceGetter().get();
+                } catch (ClassNotFoundException e) {
+                }
             }
         }
-        return null;
+        throw new NotFoundException("can't create instance for " + beanClass);
     }
 
     @Override
     @SuppressWarnings("unchecked")
-    public <T extends Bean> Class<T> getInstanceType(Class<T> beanClass) {
+    public <T extends Entity> Class<T> getInstanceType(Class<T> beanClass) {
         Mapper<T> mapper = realTypeMapper.get(beanClass);
         if (null != mapper) {
             return mapper.getTarget();
@@ -67,7 +77,7 @@ public class MapperBeanFactory implements BeanFactory {
         return null;
     }
 
-    public static class Mapper<T extends Bean> {
+    public static class Mapper<T extends Entity> {
         Class<T>    target;
         Supplier<T> instanceGetter;
 
@@ -85,7 +95,7 @@ public class MapperBeanFactory implements BeanFactory {
         }
     }
 
-    class DefaultInstanceGetter<T extends Bean> implements Supplier<T> {
+    class DefaultInstanceGetter<T extends Entity> implements Supplier<T> {
         Class<T> type;
 
         public DefaultInstanceGetter(Class<T> type) {

+ 8 - 8
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/param/DeleteParamBean.java

@@ -1,27 +1,27 @@
-package org.hswebframework.web.commons.beans.param;
+package org.hswebframework.web.commons.entity.param;
 
 import org.hsweb.ezorm.core.param.Param;
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * 查询参数实体,使用<a href="https://github.com/hs-web/hsweb-easy-orm">easyorm</a>进行动态查询参数构建<br/>
  * 可通过静态方法创建:<br/>
- * {@link DeleteParamBean#build()}<br/>
+ * {@link DeleteParamEntity#build()}<br/>
  *
  * @author zhouhao
  * @see Param
- * @see Bean
+ * @see Entity
  * @since 3.0
  */
-public class DeleteParamBean extends Param implements Bean {
+public class DeleteParamEntity extends Param implements Entity {
     /**
      * 创建一个无条件的删除条件实体
-     * 创建后需自行指定条件({@link DeleteParamBean#where(String, Object)})
+     * 创建后需自行指定条件({@link DeleteParamEntity#where(String, Object)})
      * 否则可能无法执行更新(dao实现应该禁止无条件的删除)
      *
      * @return
      */
-    public static DeleteParamBean build() {
-        return new DeleteParamBean();
+    public static DeleteParamEntity build() {
+        return new DeleteParamEntity();
     }
 }

+ 9 - 9
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/param/QueryParamBean.java

@@ -1,13 +1,13 @@
-package org.hswebframework.web.commons.beans.param;
+package org.hswebframework.web.commons.entity.param;
 
 import org.hsweb.ezorm.core.param.QueryParam;
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * 查询参数实体,使用<a href="https://github.com/hs-web/hsweb-easy-orm">easyorm</a>进行动态查询参数构建<br/>
  * 可通过静态方法创建:<br/>
- * {@link QueryParamBean#empty()}<br/>
- * {@link QueryParamBean#single(String, Object)}<br/>
+ * {@link QueryParamEntity#empty()}<br/>
+ * {@link QueryParamEntity#single(String, Object)}<br/>
  * 如:
  * <code>
  * QueryParamBean.single("id",id);
@@ -15,18 +15,18 @@ import org.hswebframework.web.commons.beans.Bean;
  *
  * @author zhouhao
  * @see QueryParam
- * @see Bean
+ * @see Entity
  * @since 3.0
  */
-public class QueryParamBean extends QueryParam implements Bean {
+public class QueryParamEntity extends QueryParam implements Entity {
 
     /**
      * 创建一个空的查询参数实体,该实体无任何参数.
      *
      * @return 无条件的参数实体
      */
-    public static QueryParamBean empty() {
-        return new QueryParamBean();
+    public static QueryParamEntity empty() {
+        return new QueryParamEntity();
     }
 
     /**
@@ -37,7 +37,7 @@ public class QueryParamBean extends QueryParam implements Bean {
      * @return 单个条件的参数实体
      * @see QueryParam#where(String, Object)
      */
-    public static QueryParamBean single(String field, Object value) {
+    public static QueryParamEntity single(String field, Object value) {
         return empty().where(field, value);
     }
 }

+ 11 - 11
hsweb-commons/hsweb-commons-beans/src/main/java/org/hswebframework/web/commons/beans/param/UpdateParamBean.java

@@ -1,35 +1,35 @@
-package org.hswebframework.web.commons.beans.param;
+package org.hswebframework.web.commons.entity.param;
 
 import org.hsweb.ezorm.core.param.UpdateParam;
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * 修改参数实体,使用<a href="https://github.com/hs-web/hsweb-easy-orm">easyorm</a>进行动态参数构建
  *
  * @author zhouhao
  * @see UpdateParam
- * @see Bean
+ * @see Entity
  * @since 3.0
  */
-public class UpdateParamBean<T> extends UpdateParam<T> implements Bean {
-    public UpdateParamBean() {
+public class UpdateParamEntity<T> extends UpdateParam<T> implements Entity {
+    public UpdateParamEntity() {
     }
 
-    public UpdateParamBean(T data) {
+    public UpdateParamEntity(T data) {
         super(data);
     }
 
     /**
      * 创建一个无任何条件并指定数据的更新参数实体
-     * 创建后需自行指定条件({@link UpdateParamBean#where(String, Object)})
+     * 创建后需自行指定条件({@link UpdateParamEntity#where(String, Object)})
      * 否则可能无法执行更新(dao实现应该禁止无条件的更新)
      *
      * @param data 要更新的数据
      * @param <T>  数据泛型
      * @return 更新参数实体
      */
-    public static <T> UpdateParamBean<T> build(T data) {
-        return new UpdateParamBean<>(data);
+    public static <T> UpdateParamEntity<T> build(T data) {
+        return new UpdateParamEntity<>(data);
     }
 
     /**
@@ -47,7 +47,7 @@ public class UpdateParamBean<T> extends UpdateParam<T> implements Bean {
      * @param <T>   数据泛型
      * @return 更新参数实体
      */
-    public static <T> UpdateParamBean<T> build(T data, String field, Object value) {
-        return new UpdateParamBean<>(data).where(field, value);
+    public static <T> UpdateParamEntity<T> build(T data, String field, Object value) {
+        return new UpdateParamEntity<>(data).where(field, value);
     }
 }

+ 3 - 3
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/CreateBeanService.java

@@ -22,17 +22,17 @@ package org.hswebframework.web.service;
  * 实体创建服务接口,通过此接口创建实体.在创建实体类时,建议使用此接口进行创建,而不是使用new
  * 如:
  * <code>
- * YourBean bean =  service.createBean();
+ * YourBean bean =  service.createEntity();
  * </code>
  *
  * @author zhouhao
  * @since 3.0
  */
-public interface CreateBeanService<B> {
+public interface CreateEntityService<B> {
     /**
      * 创建实体
      *
      * @return 实体
      */
-    B createBean();
+    B createEntity();
 }

+ 4 - 4
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/CrudService.java

@@ -18,7 +18,7 @@
 
 package org.hswebframework.web.service;
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 /**
  * 通用Service,实现增删改查
@@ -26,12 +26,12 @@ import org.hswebframework.web.commons.beans.Bean;
  * @author zhouhao
  * @since 3.0
  */
-public interface CrudService<B, PK, Q extends Bean> extends
-        QueryByBeanService<B, Q>,
+public interface CrudService<B, PK, Q extends Entity> extends
+        QueryByEntityService<B, Q>,
         UpdateService<B>,
         InsertService<B, PK>,
         DeleteService<PK>,
-        CreateBeanService<B> {
+        CreateEntityService<B> {
 
     B selectByPk(PK id);
 }

+ 3 - 4
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/QueryByBeanService.java

@@ -18,12 +18,12 @@
 
 package org.hswebframework.web.service;
 
-import org.hswebframework.web.commons.beans.Bean;
-import org.hswebframework.web.commons.beans.PagerResult;
+import org.hswebframework.web.commons.entity.Entity;
+import org.hswebframework.web.commons.entity.PagerResult;
 
 import java.util.List;
 
-public interface QueryByBeanService<B, Q extends Bean> extends Service {
+public interface QueryByEntityService<B, Q extends Entity> extends Service {
     PagerResult<B> selectPager(Q param);
 
     List<B> select(Q param);
@@ -33,5 +33,4 @@ public interface QueryByBeanService<B, Q extends Bean> extends Service {
     int count(Q param);
 
     B selectSingle(Q param);
-
 }

+ 14 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/Validator.java

@@ -0,0 +1,14 @@
+package org.hswebframework.web.service;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface Validator<T> {
+    boolean validate(T data);
+
+    default String getErrorMessage() {
+        return "{validation_fail}";
+    }
+}

+ 107 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/AbstractService.java

@@ -0,0 +1,107 @@
+package org.hswebframework.web.service;
+
+import org.hswebframework.web.NotFoundException;
+import org.hswebframework.web.commons.entity.Entity;
+import org.hswebframework.web.commons.entity.factory.EntityFactory;
+import org.hswebframework.web.validate.SimpleValidateResults;
+import org.hswebframework.web.validate.ValidationException;
+import org.hswebframwork.utils.ClassUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.validation.Validator;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public abstract class AbstractService<B extends Entity, PK> implements CreateEntityService<B>, Service {
+    protected Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired(required = false)
+    protected Validator validator;
+
+    @Autowired(required = false)
+    protected EntityFactory entityFactory;
+
+    private Class<B>  beanType;
+    private Class<PK> primaryKeyType;
+
+    @SuppressWarnings("unchecked")
+    public AbstractService() {
+        primaryKeyType = (Class<PK>) ClassUtils.getGenericType(this.getClass(), 1);
+        beanType = (Class<B>) ClassUtils.getGenericType(this.getClass(), 0);
+    }
+
+    protected boolean entityFactoryIsEnabled() {
+        if (entityFactory == null) {
+            logger.warn("entityFactory is null!");
+        }
+        return null != entityFactory;
+    }
+
+    protected Class<B> getEntityRealType() {
+        return entityFactory.getInstanceType(getEntityType());
+    }
+
+    protected Class<B> getEntityType() {
+        return beanType;
+    }
+
+    protected Class<PK> getPrimaryKeyType() {
+        return primaryKeyType;
+    }
+
+    @Override
+    public B createEntity() {
+        if (!entityFactoryIsEnabled()) {
+            throw new UnsupportedOperationException("{unsupported_operation}");
+        }
+        return entityFactory.newInstance(getEntityType());
+    }
+
+    protected <T> void tryValidateProperty(org.hswebframework.web.service.Validator<T> validator, String property, T value) {
+        if (validator != null) {
+            if (!validator.validate(value)) {
+                throw new ValidationException(validator.getErrorMessage(), property);
+            }
+        }
+    }
+
+    protected <T> void tryValidateProperty(org.hswebframework.web.service.Validator<T> validator, String property, T value, String message) {
+        if (validator != null) {
+            if (!validator.validate(value)) {
+                throw new ValidationException(message, property);
+            }
+        }
+    }
+
+    protected void tryValidateProperty(boolean success, String property, String message) {
+        if (!success) {
+            throw new ValidationException(message, property);
+        }
+    }
+
+    protected void tryValidate(B bean) {
+        if (validator == null) {
+            logger.warn("validator is null!");
+            return;
+        }
+        SimpleValidateResults results = new SimpleValidateResults();
+        validator.validate(bean).forEach(violation -> results.addResult(violation.getPropertyPath().toString(), violation.getMessage()));
+        if (!results.isSuccess())
+            throw new ValidationException(results);
+    }
+
+    public void assertNotNull(Object data) {
+        assertNotNull(data, "{data_not_found}");
+    }
+
+    public void assertNotNull(Object data, String message) {
+        if (null == data) throw new NotFoundException(message);
+    }
+
+
+}

+ 7 - 7
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLDeleteService.java

@@ -19,7 +19,7 @@
 package org.hswebframework.web.service;
 
 import org.hsweb.ezorm.core.dsl.Delete;
-import org.hswebframework.web.commons.beans.param.DeleteParamBean;
+import org.hswebframework.web.commons.entity.param.DeleteParamEntity;
 import org.hswebframework.web.dao.dynamic.DeleteByBeanDao;
 
 /**
@@ -28,14 +28,14 @@ import org.hswebframework.web.dao.dynamic.DeleteByBeanDao;
 public interface DefaultDSLDeleteService<PK> extends DefaultDeleteService<PK> {
     DeleteByBeanDao getDao();
 
-    default Delete<DeleteParamBean> createDelete() {
-        Delete<DeleteParamBean> delete = new Delete<>(new DeleteParamBean());
+    default Delete<DeleteParamEntity> createDelete() {
+        Delete<DeleteParamEntity> delete = new Delete<>(new DeleteParamEntity());
         delete.setExecutor(getDao()::delete);
         return delete;
     }
 
-    static Delete<DeleteParamBean> createDelete(DeleteByBeanDao deleteDao) {
-        Delete<DeleteParamBean> update = new Delete<>(new DeleteParamBean());
+    static Delete<DeleteParamEntity> createDelete(DeleteByBeanDao deleteDao) {
+        Delete<DeleteParamEntity> update = new Delete<>(new DeleteParamEntity());
         update.setExecutor(deleteDao::delete);
         return update;
     }
@@ -47,8 +47,8 @@ public interface DefaultDSLDeleteService<PK> extends DefaultDeleteService<PK> {
      * @return {@link Delete}
      * @since 3.0
      */
-    static Delete<DeleteParamBean> createDelete(Delete.Executor<DeleteParamBean> executor) {
-        Delete<DeleteParamBean> update = new Delete<>(new DeleteParamBean());
+    static Delete<DeleteParamEntity> createDelete(Delete.Executor<DeleteParamEntity> executor) {
+        Delete<DeleteParamEntity> update = new Delete<>(new DeleteParamEntity());
         update.setExecutor(executor);
         return update;
     }

+ 6 - 6
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLQueryService.java

@@ -19,13 +19,13 @@
 package org.hswebframework.web.service;
 
 import org.hsweb.ezorm.core.dsl.Query;
-import org.hswebframework.web.commons.beans.param.QueryParamBean;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.dao.dynamic.QueryByBeanDao;
 
 import java.util.List;
 
 public interface DefaultDSLQueryService<B>
-        extends DefaultQueryByBeanService<B> {
+        extends DefaultQueryByEntityService<B> {
 
     /**
      * 创建本服务的dsl查询操作对象
@@ -39,8 +39,8 @@ public interface DefaultDSLQueryService<B>
      * @see org.hsweb.ezorm.core.Conditional
      * @since 3.0
      */
-    default Query<B, QueryParamBean> createQuery() {
-        Query<B, QueryParamBean> query = Query.empty(new QueryParamBean());
+    default Query<B, QueryParamEntity> createQuery() {
+        Query<B, QueryParamEntity> query = Query.empty(new QueryParamEntity());
         query.setListExecutor(this::select);
         query.setTotalExecutor(this::count);
         query.setSingleExecutor(this::selectSingle);
@@ -61,8 +61,8 @@ public interface DefaultDSLQueryService<B>
      * @see org.hsweb.ezorm.core.Conditional
      * @since 3.0
      */
-    static <PO> Query<PO, QueryParamBean> createQuery(QueryByBeanDao<PO> dao) {
-        Query<PO, QueryParamBean> query = new Query<>(new QueryParamBean());
+    static <PO> Query<PO, QueryParamEntity> createQuery(QueryByBeanDao<PO> dao) {
+        Query<PO, QueryParamEntity> query = new Query<>(new QueryParamEntity());
         query.setListExecutor(dao::query);
         query.setTotalExecutor(dao::count);
         query.setSingleExecutor((param) -> {

+ 13 - 5
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLUpdateService.java

@@ -19,8 +19,8 @@
 package org.hswebframework.web.service;
 
 import org.hsweb.ezorm.core.dsl.Update;
-import org.hswebframework.web.dao.dynamic.UpdateByBeanDao;
-import org.hswebframework.web.commons.beans.param.UpdateParamBean;
+import org.hswebframework.web.dao.dynamic.UpdateByEntityDao;
+import org.hswebframework.web.commons.entity.param.UpdateParamEntity;
 
 /**
  * TODO 完成注释
@@ -29,9 +29,17 @@ import org.hswebframework.web.commons.beans.param.UpdateParamBean;
  */
 public interface DefaultDSLUpdateService<PO> extends UpdateService<PO> {
 
-    UpdateByBeanDao getDao();
+    UpdateByEntityDao getDao();
 
-    default Update<PO, UpdateParamBean<PO>> createUpdate(PO data) {
-        return Update.build(getDao()::update, new UpdateParamBean<>(data));
+    default Update<PO, UpdateParamEntity<PO>> createUpdate(PO data) {
+        return Update.build(getDao()::update, new UpdateParamEntity<>(data));
+    }
+
+    static <PO> Update<PO, UpdateParamEntity<PO>> createUpdate(UpdateByEntityDao dao) {
+        return Update.build(dao::update, new UpdateParamEntity<>());
+    }
+
+    static <PO> Update<PO, UpdateParamEntity<PO>> createUpdate(UpdateByEntityDao dao, PO data) {
+        return Update.build(dao::update, new UpdateParamEntity<>(data));
     }
 }

+ 12 - 12
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultQueryByBeanService.java

@@ -20,20 +20,20 @@ package org.hswebframework.web.service;
 
 import org.hsweb.ezorm.core.dsl.Query;
 import org.hsweb.ezorm.core.param.QueryParam;
-import org.hswebframework.web.commons.beans.PagerResult;
-import org.hswebframework.web.commons.beans.param.QueryParamBean;
+import org.hswebframework.web.commons.entity.PagerResult;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.dao.dynamic.QueryByBeanDao;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.List;
 
-public interface DefaultQueryByBeanService<B>
-        extends QueryByBeanService<B, QueryParamBean> {
+public interface DefaultQueryByEntityService<B>
+        extends QueryByEntityService<B, QueryParamEntity> {
     QueryByBeanDao<B> getDao();
 
     @Override
-    default PagerResult<B> selectPager(QueryParamBean param) {
+    default PagerResult<B> selectPager(QueryParamEntity param) {
         PagerResult<B> pagerResult = new PagerResult<>();
         param.setPaging(false);
         int total = getDao().count(param);
@@ -49,7 +49,7 @@ public interface DefaultQueryByBeanService<B>
     }
 
     /**
-     * 分页进行查询数据,查询条件同 {@link DefaultQueryByBeanService#select}
+     * 分页进行查询数据,查询条件同 {@link DefaultQueryByEntityService#select}
      *
      * @param param 查询参数
      * @return 分页结果
@@ -65,7 +65,7 @@ public interface DefaultQueryByBeanService<B>
      */
     @Override
     @Transactional(readOnly = true)
-    default List<B> select(QueryParamBean param) {
+    default List<B> select(QueryParamEntity param) {
         return getDao().query(param);
     }
 
@@ -77,18 +77,18 @@ public interface DefaultQueryByBeanService<B>
     @Override
     @Transactional(readOnly = true)
     default List<B> select() {
-        return getDao().query(new QueryParamBean());
+        return getDao().query(new QueryParamEntity());
     }
 
     /**
-     * 查询记录总数,用于分页等操作。查询条件同 {@link DefaultQueryByBeanService#select}
+     * 查询记录总数,用于分页等操作。查询条件同 {@link DefaultQueryByEntityService#select}
      *
      * @param param 查询参数
      * @return 查询结果,实现mapper中的sql应指定默认值,否则可能抛出异常
      */
     @Override
     @Transactional(readOnly = true)
-    default int count(QueryParamBean param) {
+    default int count(QueryParamEntity param) {
         return getDao().count(param);
     }
 
@@ -97,11 +97,11 @@ public interface DefaultQueryByBeanService<B>
      *
      * @param param 查询条件
      * @return 单个结果
-     * @see this#select(QueryParamBean)
+     * @see this#select(QueryParamEntity)
      */
     @Override
     @Transactional(readOnly = true)
-    default B selectSingle(QueryParamBean param) {
+    default B selectSingle(QueryParamEntity param) {
         param.doPaging(0, 1);
         List<B> list = this.select(param);
         if (list.size() == 0) return null;

+ 0 - 147
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericBeanService.java

@@ -1,147 +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.service;
-
-import org.hswebframework.web.commons.beans.GenericBean;
-import org.hswebframework.web.commons.beans.factory.BeanFactory;
-import org.hswebframework.web.NotFoundException;
-import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.validate.SimpleValidateResults;
-import org.hswebframework.web.validate.ValidationException;
-import org.hswebframwork.utils.ClassUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.validation.Validator;
-import java.util.List;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-@Transactional(rollbackFor = Throwable.class)
-public abstract class GenericBeanService<B extends GenericBean<PK>, PK> implements GenericService<B, PK> {
-
-    protected Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    @Autowired(required = false)
-    private Validator validator;
-
-    @Autowired(required = false)
-    private BeanFactory beanFactory;
-
-    private Class<B>  beanType;
-    private Class<PK> primaryKeyType;
-
-    @SuppressWarnings("unchecked")
-    public GenericBeanService(){
-        primaryKeyType = (Class<PK>) ClassUtils.getGenericType(this.getClass(), 1);
-        beanType = (Class<B>) ClassUtils.getGenericType(this.getClass(), 0);
-    }
-
-    @Override
-    public abstract CrudDao<B, PK> getDao();
-
-    private boolean beanFactoryIsEnabled() {
-        if (beanFactory == null) {
-            logger.warn("beanFactory is null!");
-        }
-        return null != beanFactory;
-    }
-
-    protected Class<B> getBeanRealType() {
-        return beanFactory.getInstanceType(getBeanType());
-    }
-
-    protected Class<B> getBeanType() {
-        return beanType;
-    }
-
-    protected Class<PK> getPrimaryKeyType() {
-        return primaryKeyType;
-    }
-
-    @Override
-    public B createBean() {
-        if (!beanFactoryIsEnabled()) {
-            throw new UnsupportedOperationException("{unsupported_operation}");
-        }
-        return beanFactory.newInstance(getBeanType());
-    }
-
-    public void tryValidate(B bean) {
-        if (validator == null) {
-            logger.warn("validator is null!");
-            return;
-        }
-        SimpleValidateResults results = new SimpleValidateResults();
-        validator.validate(bean).forEach(violation -> results.addResult(violation.getPropertyPath().toString(), violation.getMessage()));
-        if (!results.isSuccess())
-            throw new ValidationException(results);
-    }
-
-    @Override
-    public int deleteByPk(PK pk) {
-        return createDelete().where(GenericBean.id, pk).exec();
-    }
-
-    @Override
-    public int updateByPk(B data) {
-        tryValidate(data);
-        return createUpdate(data).where(GenericBean.id, data.getId()).exec();
-    }
-
-    @Override
-    public int updateByPk(List<B> data) {
-        return data.stream().map(this::updateByPk).reduce(Math::addExact).orElse(0);
-    }
-
-    @Override
-    public int saveOrUpdate(B po) {
-        if (null != po.getId()) {
-            return updateByPk(po);
-        } else {
-            insert(po);
-        }
-        return 1;
-    }
-
-    @Override
-    public PK insert(B data) {
-        tryValidate(data);
-        getDao().insert(data);
-        return data.getId();
-    }
-
-    @Override
-    public B selectByPk(PK id) {
-        return createQuery().where(GenericBean.id, id).single();
-    }
-
-    public void assertNotNull(Object data) {
-        assertNotNull(data, "{data_not_found}");
-    }
-
-    public void assertNotNull(Object data, String message) {
-        if (null == data) throw new NotFoundException(message);
-    }
-}

+ 93 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java

@@ -0,0 +1,93 @@
+/*
+ *
+ *  * 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.service;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+import org.hswebframework.web.commons.entity.factory.EntityFactory;
+import org.hswebframework.web.NotFoundException;
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.validate.SimpleValidateResults;
+import org.hswebframework.web.validate.ValidationException;
+import org.hswebframwork.utils.ClassUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.validation.Validator;
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+@Transactional(rollbackFor = Throwable.class)
+public abstract class GenericEntityService<B extends GenericEntity<PK>, PK>
+        extends AbstractService<B, PK>
+        implements GenericService<B, PK> {
+
+    @SuppressWarnings("unchecked")
+    public GenericEntityService() {
+        super();
+    }
+
+    @Override
+    public abstract CrudDao<B, PK> getDao();
+
+    @Override
+    public int deleteByPk(PK pk) {
+        return createDelete().where(GenericEntity.id, pk).exec();
+    }
+
+    @Override
+    public int updateByPk(B data) {
+        tryValidate(data);
+        return createUpdate(data).where(GenericEntity.id, data.getId()).exec();
+    }
+
+    @Override
+    public int updateByPk(List<B> data) {
+        return data.stream().map(this::updateByPk).reduce(Math::addExact).orElse(0);
+    }
+
+    @Override
+    public int saveOrUpdate(B po) {
+        if (null != po.getId()) {
+            return updateByPk(po);
+        } else {
+            insert(po);
+        }
+        return 1;
+    }
+
+    @Override
+    public PK insert(B data) {
+        tryValidateProperty(null != data.getId(), GenericEntity.id, "id {not_be_null}");
+        tryValidate(data);
+        getDao().insert(data);
+        return data.getId();
+    }
+
+    @Override
+    @Transactional(readOnly = true)
+    public B selectByPk(PK id) {
+        return createQuery().where(GenericEntity.id, id).single();
+    }
+}

+ 3 - 3
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericService.java

@@ -19,7 +19,7 @@
 package org.hswebframework.web.service;
 
 import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.commons.beans.param.QueryParamBean;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -30,14 +30,14 @@ import org.springframework.transaction.annotation.Transactional;
  * @see DefaultDSLUpdateService
  * @see DefaultDSLDeleteService
  * @see CrudService
- * @see QueryParamBean
+ * @see QueryParamEntity
  * @see CrudDao
  */
 public interface GenericService<B, PK> extends
         DefaultDSLQueryService<B>,
         DefaultDSLUpdateService<B>,
         DefaultDSLDeleteService<PK>,
-        CrudService<B, PK, QueryParamBean> {
+        CrudService<B, PK, QueryParamEntity> {
     @Override
     @Transactional
     CrudDao<B, PK> getDao();

+ 2 - 2
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/dsl/DSLQuery.java

@@ -1,7 +1,7 @@
 package org.hswebframework.web.service.dsl;
 
 
-import org.hswebframework.web.commons.beans.Bean;
+import org.hswebframework.web.commons.entity.Entity;
 
 import java.util.List;
 
@@ -10,7 +10,7 @@ import java.util.List;
  *
  * @author zhouhao
  */
-public interface DSLQuery<PO> extends Bean {
+public interface DSLQuery<PO> extends Entity {
     List<PO> list();
 
     List<PO> list(int pageIndex, int pageSize);

+ 5 - 5
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/dsl/SimpleDSLQuery.java

@@ -1,8 +1,8 @@
 package org.hswebframework.web.service.dsl;
 
 import org.hsweb.ezorm.core.dsl.Query;
-import org.hswebframework.web.commons.beans.param.QueryParamBean;
-import org.hswebframework.web.service.DefaultQueryByBeanService;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.service.DefaultQueryByEntityService;
 
 import java.util.List;
 
@@ -12,15 +12,15 @@ import java.util.List;
  * @author zhouhao
  */
 public class SimpleDSLQuery<PO> implements DSLQuery<PO> {
-    protected Query<PO, QueryParamBean> query = Query.empty(new QueryParamBean());
+    protected Query<PO, QueryParamEntity> query = Query.empty(new QueryParamEntity());
 
-    public SimpleDSLQuery(DefaultQueryByBeanService<PO> service) {
+    public SimpleDSLQuery(DefaultQueryByEntityService<PO> service) {
         query.setListExecutor(service::select);
         query.setTotalExecutor(service::count);
         query.setSingleExecutor(service::selectSingle);
     }
 
-    public Query<PO, QueryParamBean> dynamic() {
+    public Query<PO, QueryParamEntity> dynamic() {
         return query;
     }
 

+ 5 - 5
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/dsl/SimpleFieldCondition.java

@@ -1,7 +1,7 @@
 package org.hswebframework.web.service.dsl;
 
 import org.hsweb.ezorm.core.dsl.Query;
-import org.hswebframework.web.commons.beans.param.QueryParamBean;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 
 import java.util.Collection;
 
@@ -11,11 +11,11 @@ import java.util.Collection;
  * @author zhouhao
  */
 public class SimpleFieldCondition<PO, R extends DSLQuery<PO>> implements FieldCondition<PO, R> {
-    Query<PO, QueryParamBean> query;
-    R                         proxy;
-    String                    filed;
+    Query<PO, QueryParamEntity> query;
+    R                           proxy;
+    String                      filed;
 
-    public SimpleFieldCondition(Query<PO, QueryParamBean> query, R proxy, String filed) {
+    public SimpleFieldCondition(Query<PO, QueryParamEntity> query, R proxy, String filed) {
         this.query = query;
         this.proxy = proxy;
         this.filed = filed;

+ 1 - 1
hsweb-commons/hsweb-commons-service/pom.xml

@@ -41,7 +41,7 @@
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-beans</artifactId>
+            <artifactId>hsweb-commons-entity</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>

+ 1 - 1
hsweb-commons/pom.xml

@@ -30,7 +30,7 @@
     <artifactId>hsweb-commons</artifactId>
     <packaging>pom</packaging>
     <modules>
-        <module>hsweb-commons-beans</module>
+        <module>hsweb-commons-entity</module>
         <module>hsweb-commons-dao</module>
         <module>hsweb-commons-service</module>
         <module>hsweb-commons-controller</module>

+ 6 - 1
hsweb-core/src/main/java/org/hswebframework/web/validate/ValidationException.java

@@ -28,12 +28,17 @@ public class ValidationException extends BusinessException {
         super(message, 400);
     }
 
+    public ValidationException(String message, String field) {
+        super(message, 400);
+        results = new SimpleValidateResults().addResult(field, message);
+    }
+
     public ValidationException(ValidateResults results) {
         super(results.toString(), 400);
         this.results = results;
     }
 
-    public Object getResults() {
+    public ValidateResults getResults() {
         return results;
     }
 }

+ 1 - 1
hsweb-message/README.md

@@ -1 +1 @@
-## 消息模块,整合jms,email,sms等消息发功能
+## 消息模块,整合jms,email,sms等消息发功能

+ 14 - 0
hsweb-message/hsweb-message-api/pom.xml

@@ -0,0 +1,14 @@
+<?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-message</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-message-api</artifactId>
+
+</project>

+ 11 - 0
hsweb-message/hsweb-message-api/src/main/java/org/hswebframework/web/message/Message.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.message;
+
+import java.io.Serializable;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface Message extends Serializable {
+}

+ 10 - 0
hsweb-message/hsweb-message-api/src/main/java/org/hswebframework/web/message/MessageListener.java

@@ -0,0 +1,10 @@
+package org.hswebframework.web.message;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface MessageListener<T extends Message> {
+    void onMessage(T message);
+}

+ 17 - 0
hsweb-message/hsweb-message-api/src/main/java/org/hswebframework/web/message/MessageManager.java

@@ -0,0 +1,17 @@
+package org.hswebframework.web.message;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface MessageManager {
+
+    void send(String toUser,String destination, Message message);
+
+    void publish(String topic, Message message);
+
+    <T extends Message> void subscribe(String topic, MessageListener<T> listener);
+
+    void deSubscribe(String topic);
+}

+ 37 - 0
hsweb-message/hsweb-message-jms/pom.xml

@@ -0,0 +1,37 @@
+<?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-message</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-message-jms</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-message-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-activemq</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-tests</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

+ 35 - 0
hsweb-message/hsweb-message-jms/src/main/java/org/hswebframework/web/message/jms/JmsMessageManager.java

@@ -0,0 +1,35 @@
+package org.hswebframework.web.message.jms;
+
+import org.hswebframework.web.message.Message;
+import org.hswebframework.web.message.MessageListener;
+import org.hswebframework.web.message.MessageManager;
+import org.springframework.jms.core.JmsTemplate;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class JmsMessageManager implements MessageManager {
+    JmsTemplate jmsTemplate;
+
+    @Override
+    public void send(String toUser,String destination, Message message) {
+
+    }
+
+    @Override
+    public void publish(String topic, Message message) {
+
+    }
+
+    @Override
+    public <T extends Message> void subscribe(String topic, MessageListener<T> listener) {
+
+    }
+
+    @Override
+    public void deSubscribe(String topic) {
+
+    }
+}

+ 55 - 0
hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/AmqpTests.java

@@ -0,0 +1,55 @@
+package org.hswebframework.web.message.jms;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.jms.annotation.EnableJms;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+/**
+ * @author zhouhao
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SampleActiveMQApplication.class, properties = "application.yml")
+@EnableJms
+public class AmqpTests {
+
+    @Autowired
+    private JmsTemplate template;
+
+    @Test
+    public void testSend() throws InterruptedException {
+        new Thread(() -> {
+            while (true) {
+                try {
+                    Object obj = template.receiveAndConvert("test4");
+                    System.out.println("----" + obj);
+                } catch (Exception e) {
+                    break;
+                }
+            }
+        }).start();
+        new Thread(() -> {
+            while (true) {
+                try {
+                    Object obj = template.receiveAndConvert("test4");
+                    System.out.println("----222" + obj);
+                } catch (Exception e) {
+                    break;
+                }
+            }
+        }).start();
+        Thread.sleep(100);
+        int i = 0;
+        while (i < 10) {
+            template.convertAndSend("test4", "aaa" + i++);
+            Thread.sleep(1000);
+        }
+        Thread.sleep(1000);
+
+    }
+
+}

+ 26 - 0
hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/Consumer.java

@@ -0,0 +1,26 @@
+package org.hswebframework.web.message.jms;
+
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.messaging.simp.annotation.SubscribeMapping;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Consumer {
+
+    @JmsListener(destination = "test")
+    public void receiveQueue(String text) {
+        System.out.println("3:" + text);
+    }
+
+    @JmsListener(destination = "test")
+    public void receiveQueue4(String text) {
+        System.out.println("4:" + text);
+    }
+
+    @JmsListener(destination = "test2", subscription = "test2")
+    public void receiveQueue3(String text) {
+        System.out.println("1:" + text);
+    }
+
+
+}

+ 15 - 0
hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/Consumer2.java

@@ -0,0 +1,15 @@
+package org.hswebframework.web.message.jms;
+
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Consumer2 {
+
+
+    @JmsListener(destination = "test2", subscription = "test2")
+    public void receiveQueue4(String text) {
+        System.out.println("2:" + text);
+    }
+
+}

+ 31 - 0
hsweb-message/hsweb-message-jms/src/test/java/org/hswebframework/web/message/jms/SampleActiveMQApplication.java

@@ -0,0 +1,31 @@
+package org.hswebframework.web.message.jms;
+
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.jms.annotation.EnableJms;
+import org.springframework.jms.listener.MessageListenerContainer;
+import org.springframework.jms.listener.SimpleMessageListenerContainer;
+import org.springframework.jms.listener.adapter.MessageListenerAdapter;
+
+import javax.jms.*;
+
+@SpringBootApplication
+@EnableJms
+public class SampleActiveMQApplication {
+
+
+//    @Bean
+//    public Queue queue() {
+//        return new ActiveMQQueue("test");
+//    }
+//
+//    @Bean
+//    public Topic topic() {
+//        ActiveMQTopic topic = new ActiveMQTopic("test2");
+//        return topic;
+//    }
+
+}

+ 15 - 0
hsweb-message/hsweb-message-jms/src/test/resources/application.yml

@@ -0,0 +1,15 @@
+spring:
+    activemq:
+        in-memory: true
+    datasource:
+       url : jdbc:h2:mem:test_mem
+       username : sa
+       password :
+       type: com.alibaba.druid.pool.DruidDataSource
+       driver-class-name : org.h2.Driver
+    jms:
+      pub-sub-domain: true
+hsweb:
+    app:
+      name: jms测试
+      version: 3.0.0

+ 5 - 0
hsweb-message/pom.xml

@@ -10,6 +10,11 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>hsweb-message</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-message-api</module>
+        <module>hsweb-message-jms</module>
+    </modules>
 
 
 </project>

+ 1 - 1
hsweb-system/README.md

@@ -4,7 +4,7 @@
 如:
 ```text
 -----hsweb-system-config
-           |------hsweb-system-config-bean
+           |------hsweb-system-config-entity
            |------hsweb-system-config-service
                             |----------hsweb-system-config-service-api
                             |----------hsweb-system-config-service-simple

+ 26 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/pom.xml

@@ -0,0 +1,26 @@
+<?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-authorization-dao</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-authorization-dao-api</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-authorization-entity</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 13 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/PermissionDao.java

@@ -0,0 +1,13 @@
+package org.hswebframework.web.dao.authorization;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.authorization.ActionEntity;
+import org.hswebframework.web.entity.authorization.PermissionEntity;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionDao extends CrudDao<PermissionEntity<ActionEntity>,String> {
+}

+ 25 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/PermissionRoleDao.java

@@ -0,0 +1,25 @@
+package org.hswebframework.web.dao.authorization;
+
+import org.hswebframework.web.entity.authorization.PermissionRoleEntity;
+import org.hswebframework.web.dao.Dao;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionRoleDao extends Dao {
+    int insert(PermissionRoleEntity permissionRoleBean);
+
+    List<PermissionRoleEntity> selectByRoleId(String roleId);
+
+    List<PermissionRoleEntity> selectByRoleIdList(List<String> roleIds);
+
+    List<PermissionRoleEntity> selectByPermissionId(String roleId);
+
+    int deleteByRoleId(String roleId);
+
+    int deleteByPermissionId(String permissionId);
+}

+ 12 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/RoleDao.java

@@ -0,0 +1,12 @@
+package org.hswebframework.web.dao.authorization;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.authorization.RoleEntity;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface RoleDao extends CrudDao<RoleEntity, String> {
+}

+ 12 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/UserDao.java

@@ -0,0 +1,12 @@
+package org.hswebframework.web.dao.authorization;
+
+import org.hswebframework.web.entity.authorization.UserEntity;
+import org.hswebframework.web.dao.CrudDao;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface UserDao extends CrudDao<UserEntity, String> {
+}

+ 23 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/UserRoleDao.java

@@ -0,0 +1,23 @@
+package org.hswebframework.web.dao.authorization;
+
+import org.hswebframework.web.dao.Dao;
+import org.hswebframework.web.entity.authorization.UserRoleEntity;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface UserRoleDao extends Dao {
+    int deleteByUserId(String userId);
+
+    int deleteByRoleId(String roleId);
+
+    void insert(UserRoleEntity userRoleBean);
+
+    List<UserRoleEntity> selectByUserId(String userId);
+
+    List<UserRoleEntity> selectByRoleId(String roleId);
+}

+ 43 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/pom.xml

@@ -0,0 +1,43 @@
+<?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-authorization-dao</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-authorization-dao-mybatis</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-authorization-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>

+ 66 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/PermissionMapper.xml

@@ -0,0 +1,66 @@
+<?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.
+  ~
+  -->
+
+<!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.authorization.PermissionDao">
+    <resultMap id="PermissionResultMap" type="org.hswebframework.web.entity.authorization.SimplePermissionEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="name" column="name" javaType="string" jdbcType="VARCHAR"/>
+        <result property="describe" column="describe" javaType="string" jdbcType="VARCHAR"/>
+        <result property="status" column="status" javaType="byte" jdbcType="NUMERIC"/>
+        <result property="actions" column="actions" javaType="java.util.List" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'PermissionResultMap'"/>
+        <bind name="tableName" value="'s_permission'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.authorization.PermissionEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_permission where u_id =#{id}
+    </delete>
+
+    <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildDeleteSql"/>
+    </delete>
+
+    <update id="update" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildUpdateSql"/>
+    </update>
+
+    <select id="query" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="PermissionResultMap">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildSelectSql"/>
+    </select>
+
+    <select id="count" parameterType="org.hswebframework.web.commons.entity.Entity" resultType="int">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildTotalSql"/>
+    </select>
+</mapper>

+ 67 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/PermissionRoleMapper.xml

@@ -0,0 +1,67 @@
+<?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.
+  ~
+  -->
+
+<!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.authorization.PermissionRoleDao">
+    <resultMap id="PermissionRoleResultMap" type="org.hswebframework.web.entity.authorization.SimplePermissionRoleEntity">
+        <result property="roleId" column="role_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="permissionId" column="permission_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="actions" column="actions" javaType="java.util.List" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'PermissionRoleResultMap'"/>
+        <bind name="tableName" value="'s_permission_role'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.authorization.PermissionRoleEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByRoleId" parameterType="String">
+        delete from s_permission_role where role_id =#{id}
+    </delete>
+
+    <delete id="deleteByPermissionId" parameterType="String">
+        delete from s_permission_role where permission_id =#{id}
+    </delete>
+
+    <select id="selectByPermissionId" parameterType="string" resultMap="PermissionRoleResultMap">
+        select * from s_permission_role where permission_id=#{id}
+    </select>
+
+    <select id="selectByRoleIdList" parameterType="List" resultMap="PermissionRoleResultMap">
+        select * from s_permission_role
+        <where>
+            role_id in
+            <foreach item="id" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </where>
+    </select>
+
+    <select id="selectByRoleId" parameterType="String" resultMap="PermissionRoleResultMap">
+        select * from s_permission_role where role_id=#{id}
+    </select>
+
+</mapper>

+ 65 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/RoleMapper.xml

@@ -0,0 +1,65 @@
+<?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.
+  ~
+  -->
+
+<!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.authorization.RoleDao">
+    <resultMap id="RoleResultMap" type="org.hswebframework.web.entity.authorization.SimpleRoleEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="name" column="name" javaType="string" jdbcType="VARCHAR"/>
+        <result property="describe" column="describe" javaType="string" jdbcType="VARCHAR"/>
+        <result property="enabled" column="enabled" javaType="boolean" jdbcType="NUMERIC"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'RoleResultMap'"/>
+        <bind name="tableName" value="'s_role'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.authorization.RoleEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_role where u_id =#{id}
+    </delete>
+
+    <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildDeleteSql"/>
+    </delete>
+
+    <update id="update" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildUpdateSql"/>
+    </update>
+
+    <select id="query" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="RoleResultMap">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildSelectSql"/>
+    </select>
+
+    <select id="count" parameterType="org.hswebframework.web.commons.entity.Entity" resultType="int">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildTotalSql"/>
+    </select>
+</mapper>

+ 70 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserMapper.xml

@@ -0,0 +1,70 @@
+<?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.
+  ~
+  -->
+
+<!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.authorization.UserDao">
+    <resultMap id="UserResultMap" type="org.hswebframework.web.entity.authorization.SimpleUserEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="name" column="name" javaType="string" jdbcType="VARCHAR"/>
+        <result property="username" column="username" javaType="string" jdbcType="VARCHAR"/>
+        <result property="password" column="password" javaType="String" jdbcType="VARCHAR"/>
+        <result property="salt" column="salt" javaType="String" jdbcType="VARCHAR"/>
+        <result property="enabled" column="enabled" javaType="boolean" jdbcType="NUMERIC"/>
+        <result property="lastLoginIp" column="last_login_ip" javaType="string" jdbcType="VARCHAR"/>
+        <result property="createDate" column="create_date" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
+        <result property="lastLoginDate" column="last_login_date" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'UserResultMap'"/>
+        <bind name="tableName" value="'s_user'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.authorization.UserEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_user where u_id =#{id}
+    </delete>
+
+    <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildDeleteSql"/>
+    </delete>
+
+    <update id="update" parameterType="org.hswebframework.web.commons.entity.Entity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildUpdateSql"/>
+    </update>
+
+    <select id="query" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="UserResultMap">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildSelectSql"/>
+    </select>
+
+    <select id="count" parameterType="org.hswebframework.web.commons.entity.Entity" resultType="int">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildTotalSql"/>
+    </select>
+</mapper>

+ 56 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserRoleMapper.xml

@@ -0,0 +1,56 @@
+<?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.
+  ~
+  -->
+
+<!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.authorization.UserRoleDao">
+    <resultMap id="UserRoleResultMap" type="org.hswebframework.web.entity.authorization.SimpleUserRoleEntity">
+        <result property="roleId" column="role_id" javaType="string" jdbcType="VARCHAR"/>
+        <result property="userId" column="user_id" javaType="string" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'UserRoleResultMap'"/>
+        <bind name="tableName" value="'s_user_role'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.authorization.PermissionRoleEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByRoleId" parameterType="String">
+        delete from s_user_role where role_id =#{id}
+    </delete>
+
+    <delete id="deleteByUserId" parameterType="String">
+        delete from s_user_role where user_id =#{id}
+    </delete>
+
+    <select id="selectByUserId" parameterType="string" resultMap="UserRoleResultMap">
+        select * from s_user_role where user_id=#{id}
+    </select>
+
+    <select id="selectByRoleId" parameterType="String" resultMap="UserRoleResultMap">
+        select * from s_user_role where role_id=#{id}
+    </select>
+
+</mapper>

+ 19 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/pom.xml

@@ -0,0 +1,19 @@
+<?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-authorization</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-authorization-dao</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-authorization-dao-api</module>
+        <module>hsweb-system-authorization-dao-mybatis</module>
+    </modules>
+
+</project>

+ 2 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-bean/pom.xml

@@ -27,12 +27,12 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>hsweb-system-authorization-bean</artifactId>
+    <artifactId>hsweb-system-authorization-entity</artifactId>
 
     <dependencies>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-commons-beans</artifactId>
+            <artifactId>hsweb-commons-entity</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>

+ 17 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/ActionEntity.java

@@ -0,0 +1,17 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.CloneableEntity;
+
+public interface ActionEntity extends CloneableEntity {
+    String getAction();
+
+    void setAction(String action);
+
+    String getDescribe();
+
+    void setDescribe(String describe);
+
+    boolean isDefaultCheck();
+
+    void setDefaultCheck(boolean defaultCheck);
+}

+ 18 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/Authorization.java

@@ -0,0 +1,18 @@
+package org.hswebframework.web.entity.authorization;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface Authorization {
+
+    UserReadEntity getUser();
+
+    List<PermissionRoleReadEntity> getRoles();
+
+    List<PermissionReadEntity<ActionEntity>> getPermissions();
+
+}

+ 24 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionEntity.java

@@ -0,0 +1,24 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+import org.hswebframework.web.commons.entity.SortSupport;
+import org.hswebframework.web.commons.entity.TreeSupport;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionEntity<A extends ActionEntity> extends GenericEntity<String>,
+        PermissionReadEntity<A>{
+    void setName(String name);
+
+    void setDescribe(String comment);
+
+    void setStatus(byte status);
+
+    void setActions(List<A> actions);
+
+}

+ 22 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionReadEntity.java

@@ -0,0 +1,22 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.Entity;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionReadEntity<A extends ActionEntity> extends Entity{
+    String getId();
+
+    String getName();
+
+    String getDescribe();
+
+    byte getStatus();
+
+    List<A> getActions();
+}

+ 20 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionRoleEntity.java

@@ -0,0 +1,20 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.CloneableEntity;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionRoleEntity extends PermissionRoleReadEntity, CloneableEntity {
+
+    void setRoleId(String roleId);
+
+    void setPermissionId(String permissionId);
+
+    void setActions(List<String> actions);
+
+}

+ 19 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionRoleReadEntity.java

@@ -0,0 +1,19 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.Entity;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionRoleReadEntity extends Entity {
+
+    String getRoleId();
+
+    String getPermissionId();
+
+    List<String> getActions();
+}

+ 23 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/RoleEntity.java

@@ -0,0 +1,23 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface RoleEntity extends GenericEntity<String> {
+
+    String getName();
+
+    void setName(String name);
+
+    String getDescribe();
+
+    void setDescribe(String describe);
+
+    void setEnabled(boolean enabled);
+
+    boolean isEnabled();
+}

+ 62 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleActionEntity.java

@@ -0,0 +1,62 @@
+package org.hswebframework.web.entity.authorization;
+
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimpleActionEntity implements ActionEntity {
+
+    private String action;
+
+    private String describe;
+
+    private boolean defaultCheck;
+
+    public SimpleActionEntity() {
+    }
+
+    public SimpleActionEntity(String action) {
+        this.action = action;
+    }
+
+    @Override
+    public String getAction() {
+        return action;
+    }
+
+    @Override
+    public void setAction(String action) {
+        this.action = action;
+    }
+
+    @Override
+    public String getDescribe() {
+        return describe;
+    }
+
+    @Override
+    public void setDescribe(String describe) {
+        this.describe = describe;
+    }
+
+    @Override
+    public boolean isDefaultCheck() {
+        return defaultCheck;
+    }
+
+    @Override
+    public void setDefaultCheck(boolean defaultCheck) {
+        this.defaultCheck = defaultCheck;
+    }
+
+    @Override
+    public SimpleActionEntity clone() {
+        SimpleActionEntity target = new SimpleActionEntity();
+        target.setAction(getAction());
+        target.setDescribe(getDescribe());
+        target.setDefaultCheck(isDefaultCheck());
+        return target;
+    }
+}

+ 70 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionEntity.java

@@ -0,0 +1,70 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hibernate.validator.constraints.NotBlank;
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimplePermissionEntity extends SimpleGenericEntity<String> implements PermissionEntity<SimpleActionEntity> {
+    @NotBlank
+    private String name;
+
+    private String describe;
+
+    private byte status = 1;
+
+    //可选事件
+    private List<SimpleActionEntity> actions;
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescribe() {
+        return describe;
+    }
+
+    public void setDescribe(String describe) {
+        this.describe = describe;
+    }
+
+    public byte getStatus() {
+        return status;
+    }
+
+    public void setStatus(byte status) {
+        this.status = status;
+    }
+
+    @Override
+    public List<SimpleActionEntity> getActions() {
+        return actions;
+    }
+
+    @Override
+    public void setActions(List<SimpleActionEntity> actions) {
+        this.actions = actions;
+    }
+
+    @Override
+    public SimplePermissionEntity clone() {
+        SimplePermissionEntity target = new SimplePermissionEntity();
+        target.setId(getId());
+        if (actions != null)
+            target.setActions(new ArrayList<>(getActions()));
+        target.setDescribe(getDescribe());
+        target.setStatus(getStatus());
+        return target;
+    }
+
+}

+ 57 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionRoleEntity.java

@@ -0,0 +1,57 @@
+package org.hswebframework.web.entity.authorization;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimplePermissionRoleEntity implements PermissionRoleEntity {
+    private String roleId;
+
+    private String permissionId;
+
+    private List<String> actions;
+
+    @Override
+    public String getRoleId() {
+        return roleId;
+    }
+
+    @Override
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    @Override
+    public String getPermissionId() {
+        return permissionId;
+    }
+
+    @Override
+    public void setPermissionId(String permissionId) {
+        this.permissionId = permissionId;
+    }
+
+    @Override
+    public List<String> getActions() {
+        return actions;
+    }
+
+    @Override
+    public void setActions(List<String> actions) {
+        this.actions = actions;
+    }
+
+    @Override
+    public SimplePermissionRoleEntity clone() {
+        SimplePermissionRoleEntity target = new SimplePermissionRoleEntity();
+        if (actions != null)
+            target.setActions(new ArrayList<>(getActions()));
+        target.setPermissionId(getPermissionId());
+        target.setRoleId(getRoleId());
+        return target;
+    }
+}

+ 53 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleRoleEntity.java

@@ -0,0 +1,53 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimpleRoleEntity extends SimpleGenericEntity<String> implements RoleEntity {
+    private String name;
+
+    private String describe;
+
+    private boolean enabled;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescribe() {
+        return describe;
+    }
+
+    public void setDescribe(String describe) {
+        this.describe = describe;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    @Override
+    public SimpleGenericEntity<String> clone() {
+        SimpleRoleEntity target = new SimpleRoleEntity();
+        target.setId(getId());
+        target.setName(getName());
+        target.setDescribe(getDescribe());
+        target.setProperties(cloneProperties());
+        target.setEnabled(isEnabled());
+        return target;
+    }
+}

+ 111 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserEntity.java

@@ -0,0 +1,111 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+import java.util.Date;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimpleUserEntity extends SimpleGenericEntity<String> implements UserEntity {
+    private String name;
+
+    private String username;
+
+    private String password;
+
+    private String salt;
+
+    private Date createDate;
+
+    private Date lastLoginDate;
+
+    private boolean enabled;
+
+    private String lastLoginIp;
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    @Override
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Override
+    public String getSalt() {
+        return salt;
+    }
+
+    public void setSalt(String salt) {
+        this.salt = salt;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    public Date getLastLoginDate() {
+        return lastLoginDate;
+    }
+
+    public void setLastLoginDate(Date lastLoginDate) {
+        this.lastLoginDate = lastLoginDate;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public String getLastLoginIp() {
+        return lastLoginIp;
+    }
+
+    public void setLastLoginIp(String lastLoginIp) {
+        this.lastLoginIp = lastLoginIp;
+    }
+
+    @Override
+    public SimpleUserEntity clone() {
+        SimpleUserEntity target = new SimpleUserEntity();
+        target.setId(getId());
+        target.setName(getName());
+        target.setUsername(getUsername());
+        target.setPassword(getPassword());
+        target.setCreateDate(getCreateDate());
+        target.setEnabled(isEnabled());
+        target.setLastLoginDate(getLastLoginDate());
+        target.setLastLoginIp(getLastLoginIp());
+        return target;
+    }
+}

+ 41 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserRoleEntity.java

@@ -0,0 +1,41 @@
+package org.hswebframework.web.entity.authorization;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimpleUserRoleEntity implements UserRoleEntity {
+
+    private String userId;
+
+    private String roleId;
+
+    @Override
+    public String getUserId() {
+        return userId;
+    }
+
+    @Override
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    @Override
+    public String getRoleId() {
+        return roleId;
+    }
+
+    @Override
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    @Override
+    public SimpleUserRoleEntity clone() {
+        SimpleUserRoleEntity target = new SimpleUserRoleEntity();
+        target.setRoleId(getRoleId());
+        target.setUserId(getUserId());
+        return target;
+    }
+}

+ 14 - 13
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-bean/src/main/java/org/hswebframework/web/bean/authorization/UserBean.java

@@ -16,9 +16,9 @@
  *
  */
 
-package org.hswebframework.web.bean.authorization;
+package org.hswebframework.web.entity.authorization;
 
-import org.hswebframework.web.commons.beans.GenericBean;
+import org.hswebframework.web.commons.entity.GenericEntity;
 
 import java.util.Date;
 
@@ -27,24 +27,25 @@ import java.util.Date;
  *
  * @author zhouhao
  */
-public interface UserBean extends GenericBean<String> {
-    String username = "username";
-    String password = "password";
-    String name     = "name";
-    String salt     = "salt";
+public interface UserEntity extends UserReadEntity, GenericEntity<String> {
+    void setName(String name);
 
-    String getUsername();
+    void setUsername(String username);
 
-    String getPassword();
+    void setPassword(String password);
+
+    void setSalt(String salt);
 
-    String getName();
+    String getPassword();
 
     String getSalt();
 
-    Date createTime();
+    void setCreateDate(Date createDate);
+
+    void setLastLoginDate(Date lastLoginDate);
 
-    Date lastLoginTime();
+    void setEnabled(boolean enabled);
 
-    boolean isEnabled();
+    void setLastLoginIp(String lastLoginIp);
 
 }

+ 27 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/UserReadEntity.java

@@ -0,0 +1,27 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.Entity;
+
+import java.util.Date;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface UserReadEntity extends Entity {
+
+    String getId();
+
+    String getName();
+
+    String getUsername();
+
+    Date getCreateDate();
+
+    Date getLastLoginDate();
+
+    boolean isEnabled();
+
+    String getLastLoginIp();
+}

+ 19 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/UserRoleEntity.java

@@ -0,0 +1,19 @@
+package org.hswebframework.web.entity.authorization;
+
+import org.hswebframework.web.commons.entity.CloneableEntity;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface UserRoleEntity extends CloneableEntity {
+
+    String getUserId();
+
+    void setUserId(String userId);
+
+    String getRoleId();
+
+    void setRoleId(String roleId);
+}

+ 17 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/WebPermissionEntity.java

@@ -0,0 +1,17 @@
+package org.hswebframework.web.entity.authorization;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface WebPermissionEntity<A extends ActionEntity> extends PermissionEntity<A> {
+    String getUri();
+
+    void setUri(String uri);
+
+    String getIcon();
+
+    void setIcon(String icon);
+
+}

+ 17 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/BindPermissionRoleEntity.java

@@ -0,0 +1,17 @@
+package org.hswebframework.web.entity.authorization.bind;
+
+import org.hswebframework.web.entity.authorization.PermissionRoleEntity;
+import org.hswebframework.web.entity.authorization.RoleEntity;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface BindPermissionRoleEntity<T extends PermissionRoleEntity> extends RoleEntity {
+    List<T> getPermissions();
+
+    void setPermissions(List<T> permissions);
+}

+ 16 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/BindRoleUserEntity.java

@@ -0,0 +1,16 @@
+package org.hswebframework.web.entity.authorization.bind;
+
+import org.hswebframework.web.entity.authorization.UserEntity;
+
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface BindRoleUserEntity extends UserEntity {
+    List<String> getRoles();
+
+    void setRoles(List<String> roles);
+}

+ 38 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/SimpleBindPermissionRoleEntity.java

@@ -0,0 +1,38 @@
+package org.hswebframework.web.entity.authorization.bind;
+
+import org.hswebframework.web.entity.authorization.SimplePermissionRoleEntity;
+import org.hswebframework.web.entity.authorization.SimpleRoleEntity;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimpleBindPermissionRoleEntity extends SimpleRoleEntity implements BindPermissionRoleEntity<SimplePermissionRoleEntity> {
+    private List<SimplePermissionRoleEntity> permissions;
+
+    @Override
+    public List<SimplePermissionRoleEntity> getPermissions() {
+        return permissions;
+    }
+
+    @Override
+    public void setPermissions(List<SimplePermissionRoleEntity> permissions) {
+        this.permissions = permissions;
+    }
+
+    @Override
+    public SimpleBindPermissionRoleEntity clone() {
+        SimpleBindPermissionRoleEntity target = new SimpleBindPermissionRoleEntity();
+        target.setId(getId());
+        target.setName(getName());
+        target.setDescribe(getDescribe());
+        if (permissions != null && !permissions.isEmpty()) {
+            target.permissions = permissions.stream().map(SimplePermissionRoleEntity::clone).collect(Collectors.toList());
+        }
+        return target;
+    }
+}

+ 43 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/bind/SimpleBindRoleUserEntity.java

@@ -0,0 +1,43 @@
+package org.hswebframework.web.entity.authorization.bind;
+
+import org.hswebframework.web.entity.authorization.SimpleUserEntity;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public class SimpleBindRoleUserEntity extends SimpleUserEntity implements BindRoleUserEntity {
+
+    private List<String> roles;
+
+    @Override
+    public List<String> getRoles() {
+        return roles;
+    }
+
+    public void setRoles(List<String> roles) {
+        this.roles = roles;
+    }
+
+    @Override
+    public SimpleBindRoleUserEntity clone() {
+        SimpleBindRoleUserEntity target = new SimpleBindRoleUserEntity();
+        target.setId(getId());
+        target.setName(getName());
+        target.setCreateDate(getCreateDate());
+        target.setEnabled(isEnabled());
+        target.setLastLoginIp(getLastLoginIp());
+        target.setLastLoginDate(getLastLoginDate());
+        target.setSalt(getSalt());
+        if (roles != null)
+            target.setRoles(new ArrayList<>(getRoles()));
+        if (getProperties() != null)
+            target.setProperties(new HashMap<>(getProperties()));
+        return target;
+    }
+}

+ 26 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/pom.xml

@@ -0,0 +1,26 @@
+<?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-authorization-service</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-authorization-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-authorization-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 11 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/PasswordStrengthValidator.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.service.authorization;
+
+import org.hswebframework.web.service.Validator;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PasswordStrengthValidator extends Validator<String> {
+}

+ 15 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/PermissionService.java

@@ -0,0 +1,15 @@
+package org.hswebframework.web.service.authorization;
+
+import org.hswebframework.web.entity.authorization.ActionEntity;
+import org.hswebframework.web.entity.authorization.PermissionEntity;
+import org.hswebframework.web.commons.entity.Entity;
+import org.hswebframework.web.service.CrudService;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PermissionService<Q extends Entity> extends CrudService<PermissionEntity<ActionEntity>, String, Q> {
+
+}

+ 28 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/RoleService.java

@@ -0,0 +1,28 @@
+package org.hswebframework.web.service.authorization;
+
+import org.hswebframework.web.commons.entity.Entity;
+import org.hswebframework.web.entity.authorization.PermissionRoleEntity;
+import org.hswebframework.web.entity.authorization.RoleEntity;
+import org.hswebframework.web.entity.authorization.bind.BindPermissionRoleEntity;
+import org.hswebframework.web.service.CreateEntityService;
+import org.hswebframework.web.service.QueryByEntityService;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface RoleService<Q extends Entity> extends
+        CreateEntityService<RoleEntity>,
+        QueryByEntityService<RoleEntity, Q> {
+    <T extends PermissionRoleEntity> String add(BindPermissionRoleEntity<T> roleEntity);
+
+    boolean enable(String roleId);
+
+    boolean disable(String roleId);
+
+    <T extends PermissionRoleEntity> boolean update(BindPermissionRoleEntity<T> roleEntity);
+
+    RoleEntity selectById(String roleId);
+
+}

+ 42 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/UserService.java

@@ -0,0 +1,42 @@
+package org.hswebframework.web.service.authorization;
+
+import org.hswebframework.web.entity.authorization.Authorization;
+import org.hswebframework.web.entity.authorization.UserEntity;
+import org.hswebframework.web.entity.authorization.bind.BindRoleUserEntity;
+import org.hswebframework.web.commons.entity.Entity;
+import org.hswebframework.web.service.CreateEntityService;
+import org.hswebframework.web.service.QueryByEntityService;
+
+import java.util.Date;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface UserService<Q extends Entity> extends
+        CreateEntityService<UserEntity>,
+        QueryByEntityService<UserEntity, Q> {
+
+    String add(UserEntity userBean);
+
+    boolean enable(String userId);
+
+    boolean disable(String userId);
+
+    void update(UserEntity userBean);
+
+    UserEntity selectByUsername(String username);
+
+    UserEntity selectById(String id);
+
+    String encodePassword(String password, String salt);
+
+    void updateLoginInfo(String userId, String ip, Date loginTime);
+
+    void updatePassword(String userId, String oldPassword, String newPassword);
+
+    Authorization initUserAuthorization(String userId);
+
+    Authorization initAdminAuthorization(String userId);
+}

+ 11 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/UsernameValidator.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.service.authorization;
+
+import org.hswebframework.web.service.Validator;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface UsernameValidator extends Validator<String> {
+}

+ 0 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/pom.xml


部分文件因为文件数量过多而无法显示