Explorar el Código

增加部分注解

zhou-hao hace 5 años
padre
commit
cb4d3e3802
Se han modificado 24 ficheros con 192 adiciones y 562 borrados
  1. 5 0
      hsweb-commons/hsweb-commons-entity/pom.xml
  2. 4 0
      hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/SimpleGenericEntity.java
  3. 16 39
      hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/SimpleTreeSortSupportEntity.java
  4. 7 0
      hsweb-commons/hsweb-commons-entity/src/test/java/org/hswebframework/web/commons/entity/MenuEntity.java
  5. 9 26
      hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/easyorm/EasyOrmConfiguration.java
  6. 0 93
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/MenuGroupBindEntity.java
  7. 0 102
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/MenuGroupEntity.java
  8. 25 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleAuthorizationSettingDetailEntity.java
  9. 11 4
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleAuthorizationSettingEntity.java
  10. 11 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleAuthorizationSettingMenuEntity.java
  11. 9 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleMenuEntity.java
  12. 0 44
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleMenuGroupBindEntity.java
  13. 0 48
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleMenuGroupEntity.java
  14. 24 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionEntity.java
  15. 10 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleRoleEntity.java
  16. 19 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserEntity.java
  17. 9 4
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserRoleEntity.java
  18. 16 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/UserSettingEntity.java
  19. 0 45
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleMenuGroupBindService.java
  20. 0 144
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleMenuGroupService.java
  21. 3 3
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/form/DynamicFormColumnMapper.xml
  22. 1 1
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/form/DynamicFormDeployLogMapper.xml
  23. 2 2
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/form/DynamicFormMapper.xml
  24. 11 4
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-api/src/main/java/org/hswebframework/web/entity/organizational/SimpleDepartmentEntity.java

+ 5 - 0
hsweb-commons/hsweb-commons-entity/pom.xml

@@ -32,6 +32,11 @@
     <description>通用增删改查-通用实体模块</description>
 
     <dependencies>
+        <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.1-api</artifactId>
+            <version>1.0.2.Final</version>
+        </dependency>
         <dependency>
             <groupId>${project.parent.groupId}</groupId>
             <artifactId>hsweb-core</artifactId>

+ 4 - 0
hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/SimpleGenericEntity.java

@@ -20,6 +20,8 @@ package org.hswebframework.web.commons.entity;
 
 import lombok.SneakyThrows;
 
+import javax.persistence.Column;
+import javax.persistence.Id;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -31,6 +33,8 @@ public abstract class SimpleGenericEntity<PK> implements GenericEntity<PK> {
 
     private static final long serialVersionUID = 4546315942526096290L;
 
+    @Column
+    @Id
     private PK id;
 
     private Map<String, Object> properties;

+ 16 - 39
hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/SimpleTreeSortSupportEntity.java

@@ -19,67 +19,44 @@
 package org.hswebframework.web.commons.entity;
 
 
+import lombok.Getter;
+import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
+
+import javax.persistence.Column;
+
 /**
  * 支持树形结构,排序的实体类,要使用树形结构,排序功能的实体类直接继承该类
  */
+@Getter
+@Setter
 public abstract class SimpleTreeSortSupportEntity<PK> extends SimpleGenericEntity<PK>
         implements TreeSortSupportEntity<PK> {
     /**
      * 父级类别
      */
+    @Column(name = "parent_id", length = 32)
+    @Comment("父级ID")
     private PK parentId;
 
     /**
      * 树结构编码,用于快速查找, 每一层由4位字符组成,用-分割
      * 如第一层:0001 第二层:0001-0001 第三层:0001-0001-0001
      */
+    @Column(name = "path", length = 128)
+    @Comment("树路径")
     private String path;
 
     /**
      * 排序索引
      */
+    @Column(name = "sort_index", precision = 32)
+    @Comment("排序序号")
     private Long sortIndex;
 
+    @Column(name = "_level", precision = 32)
+    @Comment("树层级")
     private Integer level;
 
-    @Override
-    public String getPath() {
-        return path;
-    }
-
-    @Override
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    @Override
-    public PK getParentId() {
-        return parentId;
-    }
-
-    @Override
-    public void setParentId(PK parentId) {
-        this.parentId = parentId;
-    }
-
-    @Override
-    public Long getSortIndex() {
-        return sortIndex;
-    }
-
-    @Override
-    public Integer getLevel() {
-        return level;
-    }
-
-    @Override
-    public void setLevel(Integer level) {
-        this.level = level;
-    }
-
-    @Override
-    public void setSortIndex(Long sortIndex) {
-        this.sortIndex = sortIndex;
-    }
 
 }

+ 7 - 0
hsweb-commons/hsweb-commons-entity/src/test/java/org/hswebframework/web/commons/entity/MenuEntity.java

@@ -1,7 +1,10 @@
 package org.hswebframework.web.commons.entity;
 
 import lombok.*;
+import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
 import java.util.List;
 
 @Getter
@@ -9,10 +12,14 @@ import java.util.List;
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
+@Table(name = "s_menu")
 public class MenuEntity extends SimpleTreeSortSupportEntity<Integer> {
     private static final long serialVersionUID = 5548107788893085691L;
 
+    @Column(length = 32)
+    @Comment("名称")
     private String name;
 
+
     private List<MenuEntity> children;
 }

+ 9 - 26
hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/easyorm/EasyOrmConfiguration.java

@@ -3,62 +3,47 @@ package org.hswebframework.web.starter.easyorm;
 
 import lombok.SneakyThrows;
 import org.hswebframework.ezorm.core.meta.Feature;
-import org.hswebframework.ezorm.rdb.executor.SyncSqlExecutor;
 import org.hswebframework.ezorm.rdb.mapping.EntityColumnMapping;
 import org.hswebframework.ezorm.rdb.mapping.EntityManager;
 import org.hswebframework.ezorm.rdb.mapping.MappingFeatureType;
 import org.hswebframework.ezorm.rdb.mapping.jpa.JpaEntityTableMetadataParser;
-import org.hswebframework.ezorm.rdb.mapping.parser.DataTypeResolver;
 import org.hswebframework.ezorm.rdb.mapping.parser.EntityTableMetadataParser;
-import org.hswebframework.ezorm.rdb.mapping.parser.ValueCodecResolver;
 import org.hswebframework.ezorm.rdb.metadata.RDBDatabaseMetadata;
 import org.hswebframework.ezorm.rdb.operator.DatabaseOperator;
 import org.hswebframework.ezorm.rdb.operator.DefaultDatabaseOperator;
+import org.hswebframework.web.commons.entity.factory.EntityFactory;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
-import javax.sql.DataSource;
 import java.util.List;
-import java.util.Optional;
 
 @Configuration
 @EnableConfigurationProperties(EasyormProperties.class)
+@EnableEasyormRepository("org.hswebframework.web.**.*Entity")
 public class EasyOrmConfiguration {
 
     @Autowired
     private EasyormProperties properties;
 
-    @Bean
-    @ConditionalOnBean(DataSource.class)
-    public SyncSqlExecutor syncSqlExecutor(DataSource dataSource) {
-        return new DataSourceJdbcSyncSqlExecutor() {
-            @Override
-            protected DataSource getDataSource() {
-                return dataSource;
-            }
-        };
-    }
-
     @Bean
     @ConditionalOnMissingBean
-    public EntityManager entityManager(EntityTableMetadataResolver resolver) {
+    public EntityManager entityManager(EntityTableMetadataResolver resolver, EntityFactory entityFactory) {
         return new EntityManager() {
             @Override
             @SneakyThrows
             public <E> E newInstance(Class<E> type) {
-                return type.newInstance();
+                return entityFactory.newInstance(type);
             }
 
             @Override
             public EntityColumnMapping getMapping(Class entity) {
 
-                return resolver.resolve(entity)
+                return resolver.resolve(entityFactory.getInstanceType(entity))
                         .getFeature(MappingFeatureType.columnPropertyMapping.createFeatureId(entity))
                         .map(EntityColumnMapping.class::cast)
                         .orElse(null);
@@ -81,14 +66,12 @@ public class EasyOrmConfiguration {
 
     @Bean
     @ConditionalOnMissingBean
-    public EntityTableMetadataParser jpaEntityTableMetadataParser(DatabaseOperator operator,
-                                                                  Optional<DataTypeResolver> resolver,
-                                                                  Optional<ValueCodecResolver> codecResolver) {
+    public EntityTableMetadataParser jpaEntityTableMetadataParser(DatabaseOperator operator) {
         JpaEntityTableMetadataParser parser = new JpaEntityTableMetadataParser();
         parser.setDatabaseMetadata(operator.getMetadata());
-
-        resolver.ifPresent(parser::setDataTypeResolver);
-        codecResolver.ifPresent(parser::setValueCodecResolver);
+//
+//        resolver.ifPresent(parser::setDataTypeResolver);
+//        codecResolver.ifPresent(parser::setValueCodecResolver);
 
         return parser;
     }

+ 0 - 93
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/MenuGroupBindEntity.java

@@ -1,93 +0,0 @@
-/*
- *  Copyright 2019 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.entity.authorization;
-
-import org.hswebframework.web.commons.entity.TreeSortSupportEntity;
-
-import java.util.List;
-
-/**
- * 菜单分组关联 实体
- *
- * @author hsweb-generator-online
- */
-public interface MenuGroupBindEntity extends TreeSortSupportEntity<String> {
- /*-------------------------------------------
-    |               属性名常量               |
-    ===========================================*/
-    /**
-     * 树结构编码
-     */
-    String path      = "path";
-    /**
-     * 父级id
-     */
-    String parentId  = "parentId";
-    /**
-     * 树层级
-     */
-    String level     = "level";
-    /**
-     * 排序序号
-     */
-    String sortIndex = "sortIndex";
-    /**
-     * 状态
-     */
-    String status     = "status";
-    /**
-     * 菜单id
-     */
-    String menuId    = "menuId";
-    /**
-     * 分组id
-     */
-    String groupId   = "groupId";
-
-    /**
-     * @return 状态
-     */
-    Byte getStatus();
-
-    /**
-     * 设置 状态
-     */
-    void setStatus(Byte status);
-
-    /**
-     * @return 菜单id
-     */
-    String getMenuId();
-
-    /**
-     * 设置 菜单id
-     */
-    void setMenuId(String menuId);
-
-    /**
-     * @return 分组id
-     */
-    String getGroupId();
-
-    /**
-     * 设置 分组id
-     */
-    void setGroupId(String groupId);
-
-
-    void setChildren(List<MenuGroupBindEntity> children);
-}

+ 0 - 102
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/MenuGroupEntity.java

@@ -1,102 +0,0 @@
-/*
- *  Copyright 2019 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.entity.authorization;
-
-import org.hswebframework.web.commons.entity.TreeSortSupportEntity;
-
-import java.util.List;
-
-/**
- * 菜单分组 实体
- *
- * @author hsweb-generator-online
- */
-public interface MenuGroupEntity extends TreeSortSupportEntity<String> {
- /*-------------------------------------------
-    |               属性名常量               |
-    ===========================================*/
-    /**
-     * 分组名称
-     */
-    String name         = "name";
-    /**
-     * 分组描述
-     */
-    String describe     = "describe";
-    /**
-     * 是否默认
-     */
-    String defaultGroup = "defaultGroup";
-    /**
-     * 树结构编码
-     */
-    String path         = "path";
-    /**
-     * 父级id
-     */
-    String parentId     = "parentId";
-    /**
-     * 树层级
-     */
-    String level        = "level";
-    /**
-     * 排序序号
-     */
-    String sortIndex    = "sortIndex";
-    /**
-     * 状态
-     */
-    String status       = "status";
-
-    /**
-     * @return 分组名称
-     */
-    String getName();
-
-    /**
-     * 设置 分组名称
-     */
-    void setName(String name);
-
-    /**
-     * @return 分组描述
-     */
-    String getDescribe();
-
-    /**
-     * 设置 分组描述
-     */
-    void setDescribe(String describe);
-
-    /**
-     * @return 是否默认
-     */
-    Boolean getDefaultGroup();
-
-    /**
-     * 设置 是否默认
-     */
-    void setDefaultGroup(Boolean defaultGroup);
-
-    Byte getStatus();
-
-    void setStatus(Byte status);
-
-    List<MenuGroupBindEntity> getBindInfo();
-
-    void setBindInfo(List<MenuGroupBindEntity> bindInfo);
-}

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

@@ -19,8 +19,13 @@ package org.hswebframework.web.entity.authorization;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
+import org.hswebframework.ezorm.rdb.mapping.annotation.JsonCodec;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
+import java.sql.JDBCType;
 import java.util.List;
 import java.util.Set;
 
@@ -32,20 +37,40 @@ import java.util.Set;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_autz_detail")
 public class SimpleAuthorizationSettingDetailEntity extends SimpleGenericEntity<String> implements AuthorizationSettingDetailEntity {
     private static final long serialVersionUID = -4284551748747749521L;
     //权限id
+    @Column(name = "permission_id",length = 32,nullable = false)
     private String                 permissionId;
+
     //设置id
+    @Column(name = "setting_id",length = 32,nullable = false)
     private String                 settingId;
     //可操作类型
+
+    @Column
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
+    @JsonCodec
     private Set<String>            actions;
+
     //数据权限控制
+    @Column(name = "data_accesses")
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
+    @JsonCodec
     private List<DataAccessEntity> dataAccesses;
+
     //状态
+    @Column
     private Byte                   status;
+
     //优先级
+    @Column(precision = 32)
     private Long                   priority;
+
+
     //是否合并
+    @Column
     private Boolean                merge;
+
 }

+ 11 - 4
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleAuthorizationSettingEntity.java

@@ -1,18 +1,18 @@
 /*
  *  Copyright 2019 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.entity.authorization;
 
@@ -21,6 +21,8 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
 import java.util.List;
 
 /**
@@ -31,15 +33,20 @@ import java.util.List;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_autz_setting")
 public class SimpleAuthorizationSettingEntity extends SimpleGenericEntity<String> implements AuthorizationSettingEntity {
     private static final long serialVersionUID = -6036823477895044483L;
     //类型
+    @Column(length = 32)
     private String type;
     //设置给谁
+    @Column(name = "setting_for", length = 32)
     private String settingFor;
     //状态
-    private Byte   status;
+    @Column
+    private Byte status;
     //备注
+    @Column
     private String describe;
 
     private List<AuthorizationSettingMenuEntity> menus;

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

@@ -19,8 +19,12 @@ package org.hswebframework.web.entity.authorization;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
 import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
+import java.sql.JDBCType;
 import java.util.List;
 
 /**
@@ -31,16 +35,23 @@ import java.util.List;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_autz_menu")
 public class SimpleAuthorizationSettingMenuEntity extends SimpleTreeSortSupportEntity<String> implements AuthorizationSettingMenuEntity {
     private static final long serialVersionUID = 4311480526446922229L;
     //菜单id
+    @Column(name = "menu_id",length = 32)
     private String menuId;
     //设置id
+    @Column(name = "setting_id",length = 32)
     private String settingId;
     //状态
+    @Column
     private Byte   status;
     //其他配置内容
+    @Column
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     private String config;
+
     private List<AuthorizationSettingMenuEntity> children;
 
 }

+ 9 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleMenuEntity.java

@@ -23,6 +23,8 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -35,26 +37,33 @@ import java.util.stream.Collectors;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_menu")
 public class SimpleMenuEntity extends SimpleTreeSortSupportEntity<String>
         implements MenuEntity {
 
     private static final long serialVersionUID = 6942822850955576468L;
     //菜单名称
+    @Column
     private String name;
 
     //备注
+    @Column
     private String describe;
 
     //权限ID
+    @Column(name = "permission_id")
     private String permissionId;
 
     //菜单对应的url
+    @Column(length = 1024)
     private String url;
 
     //图标
+    @Column(length = 32)
     private String icon;
 
     //状态
+    @Column
     private Byte status;
 
     //子菜单

+ 0 - 44
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleMenuGroupBindEntity.java

@@ -1,44 +0,0 @@
-/*
- *  Copyright 2019 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.entity.authorization;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
-
-import java.util.List;
-
-/**
- * 菜单分组关联
- *
- * @author hsweb-generator-online
- */
-@Getter
-@Setter
-@NoArgsConstructor
-public class SimpleMenuGroupBindEntity extends SimpleTreeSortSupportEntity<String> implements MenuGroupBindEntity {
-    private static final long serialVersionUID = -8671671135008425741L;
-    //状态
-    private Byte                      status;
-    //菜单id
-    private String                    menuId;
-    //分组id
-    private String                    groupId;
-    //子节点
-    private List<MenuGroupBindEntity> children;
-}

+ 0 - 48
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleMenuGroupEntity.java

@@ -1,48 +0,0 @@
-/*
- *  Copyright 2019 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.entity.authorization;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
-
-import java.util.List;
-
-/**
- * 菜单分组
- *
- * @author hsweb-generator-online
- */
-@Getter
-@Setter
-@NoArgsConstructor
-public class SimpleMenuGroupEntity extends SimpleTreeSortSupportEntity<String> implements MenuGroupEntity {
-    private static final long serialVersionUID = 349586524046467254L;
-    //分组名称
-    private String  name;
-    //分组描述
-    private String  describe;
-    //是否默认
-    private Boolean defaultGroup;
-    //状态
-    private Byte    status;
-
-    private List<MenuGroupEntity> children;
-
-    private List<MenuGroupBindEntity> bindInfo;
-}

+ 24 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionEntity.java

@@ -4,8 +4,13 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.NotBlank;
+import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
+import org.hswebframework.ezorm.rdb.mapping.annotation.JsonCodec;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
+import java.sql.JDBCType;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -16,26 +21,43 @@ import java.util.stream.Collectors;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_permission")
 public class SimplePermissionEntity extends SimpleGenericEntity<String> implements PermissionEntity {
-    private static final long   serialVersionUID = -5505339187716888516L;
+    private static final long serialVersionUID = -5505339187716888516L;
     @NotBlank
-    private              String name;
+    @Column(length = 32)
+    private String name;
 
+    @Column
     private String describe;
 
+    @Column
     private Byte status;
 
+    @Column
     private String type;
 
     //支持的数据权限控制类型
+    @Column(name = "spt_da_types")
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
+    @JsonCodec
     private List<String> supportDataAccessTypes;
 
     //可选事件
+    @Column
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
+    @JsonCodec
     private List<ActionEntity> actions;
 
+    @Column(name = "optional_fields")
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
+    @JsonCodec
     private List<OptionalField> optionalFields;
 
     //直接关联其他权限
+    @Column
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
+    @JsonCodec
     private List<ParentPermission> parents;
 
     @Override

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

@@ -5,18 +5,28 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
 /**
  * @author zhouhao
  */
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_role")
 public class SimpleRoleEntity extends SimpleGenericEntity<String> implements RoleEntity {
     private static final long serialVersionUID = -2857131363164004807L;
+
+    @Column
+    @Id
     private String name;
 
+    @Column
     private String describe;
 
+    @Column
     private Byte status;
 
     @Override

+ 19 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserEntity.java

@@ -3,32 +3,50 @@ package org.hswebframework.web.entity.authorization;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
 import org.hswebframework.web.bean.ToString;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
 /**
  * @author zhouhao
  */
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_user", indexes = {
+        @Index(name = "idx_user_name", columnList = "username", unique = true)
+})
 public class SimpleUserEntity extends SimpleGenericEntity<String> implements UserEntity {
     private static final long serialVersionUID = -2625681326256009807L;
-
+    @Column
+    @Comment("姓名")
     private String name;
 
+    @Column
+    @Comment("用户名")
     private String username;
 
     @ToString.Ignore
+    @Column
+    @Comment("密码")
     private String password;
 
     @ToString.Ignore(cover = false)
+    @Column
+    @Comment("密码盐")
     private String salt;
 
+    @Column(name = "create_time")
     private Long createTime;
 
+    @Column(name = "creator_id")
     private String creatorId;
 
+    @Column
     private Byte status;
 
     @Override

+ 9 - 4
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/entity/authorization/SimpleUserRoleEntity.java

@@ -3,6 +3,10 @@ package org.hswebframework.web.entity.authorization;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
+import lombok.SneakyThrows;
+
+import javax.persistence.Column;
+import javax.persistence.Table;
 
 /**
  * @author zhouhao
@@ -10,19 +14,20 @@ import lombok.Setter;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_user_role")
 public class SimpleUserRoleEntity implements UserRoleEntity {
 
     private static final long serialVersionUID = -8831232608833695774L;
 
+    @Column(name = "user_id")
     private String userId;
 
+    @Column(name = "role_id")
     private String roleId;
 
     @Override
+    @SneakyThrows
     public SimpleUserRoleEntity clone() {
-        SimpleUserRoleEntity target = new SimpleUserRoleEntity();
-        target.setRoleId(getRoleId());
-        target.setUserId(getUserId());
-        return target;
+        return (SimpleUserRoleEntity)super.clone();
     }
 }

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

@@ -4,10 +4,14 @@ import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.hibernate.validator.constraints.NotBlank;
+import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
 import org.hswebframework.web.authorization.setting.UserSettingPermission;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 import org.hswebframework.web.validator.group.CreateGroup;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
+import java.sql.JDBCType;
 import java.util.Date;
 
 /**
@@ -17,27 +21,39 @@ import java.util.Date;
 @Getter
 @Setter
 @NoArgsConstructor
+@Table(name = "s_user_setting")
 public class UserSettingEntity extends SimpleGenericEntity<String> {
     @NotBlank(groups = CreateGroup.class)
+    @Column(name = "user_id", length = 32)
     private String userId;
 
     @NotBlank(groups = CreateGroup.class)
+    @Column
     private String key;
 
     @NotBlank(groups = CreateGroup.class)
+    @Column(name = "setting_id", length = 32)
     private String settingId;
 
     @NotBlank(groups = CreateGroup.class)
+    @Column(name = "setting")
+    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     private String setting;
 
+    @Column
     private String describe;
 
+    @Column
     private String name;
 
+    @Column(name = "create_time")
     private Date createTime;
 
+    @Column(name = "update_time")
     private Date updateTime;
 
+    @Column(name = "permission")
+    @ColumnType(jdbcType = JDBCType.VARCHAR, javaType = String.class)
     private UserSettingPermission permission;
 
     public boolean hasPermission(UserSettingPermission... permissions) {

+ 0 - 45
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleMenuGroupBindService.java

@@ -1,45 +0,0 @@
-/*
- *  Copyright 2019 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.authorization.simple;
-
-import org.hswebframework.web.entity.authorization.MenuGroupBindEntity;
-import org.hswebframework.web.id.IDGenerator;
-import org.hswebframework.web.service.AbstractTreeSortService;
-import org.hswebframework.web.service.authorization.MenuGroupBindService;
-import org.springframework.stereotype.Service;
-
-/**
- * 默认的服务实现
- *
- * @author hsweb-generator-online
- */
-@Service("menuGroupBindService")
-public class SimpleMenuGroupBindService extends AbstractTreeSortService<MenuGroupBindEntity, String>
-        implements MenuGroupBindService {
-
-    @Override
-    protected IDGenerator<String> getIDGenerator() {
-        return IDGenerator.MD5;
-    }
-
-
-    @Override
-    public int deleteByGroupId(String groupId) {
-        tryValidateProperty(groupId != null, MenuGroupBindEntity.groupId, "groups id can not be null");
-        return createDelete().where(MenuGroupBindEntity.groupId, groupId).execute();
-    }
-}

+ 0 - 144
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleMenuGroupService.java

@@ -1,144 +0,0 @@
-/*
- *  Copyright 2019 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.authorization.simple;
-
-import org.hswebframework.web.service.authorization.MenuGroupService;
-import org.hswebframework.web.commons.entity.TreeSupportEntity;
-import org.hswebframework.web.entity.authorization.MenuEntity;
-import org.hswebframework.web.entity.authorization.MenuGroupBindEntity;
-import org.hswebframework.web.entity.authorization.MenuGroupEntity;
-import org.hswebframework.web.id.IDGenerator;
-import org.hswebframework.web.service.AbstractTreeSortService;
-import org.hswebframework.web.service.DefaultDSLUpdateService;
-import org.hswebframework.web.service.authorization.MenuGroupBindService;
-import org.hswebframework.web.service.authorization.MenuService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CacheConfig;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 默认的服务实现
- *
- * @author hsweb-generator-online
- */
-@Service("menuGroupService")
-@CacheConfig(cacheNames = CacheConstants.MENU_CACHE_NAME)
-public class SimpleMenuGroupService
-        extends AbstractTreeSortService<MenuGroupEntity, String>
-        implements MenuGroupService {
-
-    @Autowired
-    private MenuService menuService;
-
-    @Autowired
-    private MenuGroupBindService menuGroupBindService;
-
-    @Override
-    protected IDGenerator<String> getIDGenerator() {
-        return IDGenerator.MD5;
-    }
-
-    @Override
-    @Cacheable(key = "'group-id-list:'+(#groupId==null?0:#groupId.hashCode())")
-    public List<MenuEntity> getMenuByGroupId(List<String> groupId) {
-        List<MenuGroupBindEntity> bindEntities = menuGroupBindService.selectByPk(groupId);
-        if (bindEntities == null || bindEntities.isEmpty()) {
-            return new LinkedList<>();
-        }
-        return menuService.selectByPk(bindEntities.stream()
-                .map(MenuGroupBindEntity::getMenuId)
-                .distinct()
-                .collect(Collectors.toList()));
-    }
-
-    @Override
-    @CacheEvict(allEntries = true)
-    public String insert(MenuGroupEntity entity) {
-        entity.setStatus((byte) 1);
-        String id = super.insert(entity);
-        List<MenuGroupBindEntity> bindEntities = entity.getBindInfo();
-        if (bindEntities != null && !bindEntities.isEmpty()) {
-            TreeSupportEntity.forEach(bindEntities, bindEntity -> {
-                bindEntity.setGroupId(id);
-                entity.setStatus((byte) 1);
-            });
-            menuGroupBindService.insertBatch(bindEntities);
-        }
-        return id;
-    }
-
-    @Override
-    @CacheEvict(allEntries = true)
-    public int updateByPk(MenuGroupEntity entity) {
-        int size = super.updateByPk(entity);
-        List<MenuGroupBindEntity> bindEntities = entity.getBindInfo();
-        if (bindEntities != null && !bindEntities.isEmpty()) {
-            TreeSupportEntity.forEach(bindEntities, bindEntity -> {
-                bindEntity.setGroupId(entity.getId());
-            });
-            menuGroupBindService.deleteByGroupId(entity.getId());
-            menuGroupBindService.insertBatch(bindEntities);
-        }
-        return size;
-    }
-
-    @CacheEvict(allEntries = true)
-    @Override
-    public int updateByPk(List<MenuGroupEntity> data) {
-        return super.updateByPk(data);
-    }
-
-    @Override
-    @CacheEvict(allEntries = true)
-    public int updateByPk(String id, MenuGroupEntity entity) {
-        return super.updateByPk(id, entity);
-    }
-
-    @Override
-    @CacheEvict(allEntries = true)
-    public MenuGroupEntity deleteByPk(String id) {
-        return super.deleteByPk(id);
-    }
-
-    @Override
-    @CacheEvict(allEntries = true)
-    public void enable(String id) {
-        tryValidateProperty(StringUtils.hasLength(id), MenuGroupEntity.id, "{id_is_null}");
-        createUpdate()
-                .set(MenuGroupEntity.status, 1)
-                .where(MenuGroupEntity.id, id)
-                .execute();
-    }
-
-    @Override
-    @CacheEvict(allEntries = true)
-    public void disable(String id) {
-        tryValidateProperty(StringUtils.hasLength(id), MenuGroupEntity.id, "{id_is_null}");
-        DefaultDSLUpdateService
-                .createUpdate(getDao())
-                .set(MenuGroupEntity.status, 0)
-                .where(MenuGroupEntity.id, id)
-                .execute();
-    }
-}

+ 3 - 3
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/form/DynamicFormColumnMapper.xml

@@ -16,10 +16,10 @@
         <result property="length" column="length" javaType="Integer" jdbcType="DECIMAL"/>
         <result property="precision" column="precision" javaType="Integer" jdbcType="DECIMAL"/>
         <result property="scale" column="scale" javaType="Integer" jdbcType="DECIMAL"/>
-        <result property="dictConfig" column="dict_config" javaType="String" jdbcType="CLOB"/>
+        <result property="dictConfig" column="dict_config" javaType="String" jdbcType="LONGVARCHAR"/>
         <result property="sortIndex" column="sort_index" javaType="Long" jdbcType="DECIMAL"/>
-        <result property="properties" column="properties" javaType="java.util.Map" jdbcType="CLOB"/>
-        <result property="validator" column="validator" javaType="java.util.List" jdbcType="CLOB"/>
+        <result property="properties" column="properties" javaType="java.util.Map" jdbcType="LONGVARCHAR"/>
+        <result property="validator" column="validator" javaType="java.util.List" jdbcType="LONGVARCHAR"/>
     </resultMap>
 
     <!--用于动态生成sql所需的配置-->

+ 1 - 1
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/form/DynamicFormDeployLogMapper.xml

@@ -8,7 +8,7 @@
         <result property="formId" column="form_id" javaType="String" jdbcType="VARCHAR"/>
         <result property="version" column="version" javaType="Long" jdbcType="NUMERIC"/>
         <result property="deployTime" column="deploy_time" javaType="Long" jdbcType="DECIMAL"/>
-        <result property="metaData" column="meta_data" javaType="String" jdbcType="CLOB"/>
+        <result property="metaData" column="meta_data" javaType="String" jdbcType="LONGVARCHAR"/>
         <result property="status" column="status" javaType="Byte" jdbcType="NUMERIC"/>
     </resultMap>
 

+ 2 - 2
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/form/DynamicFormMapper.xml

@@ -15,8 +15,8 @@
         <result property="updateTime" column="update_time" javaType="Long" jdbcType="DECIMAL"/>
         <result property="deployed" column="is_deployed" javaType="Boolean" jdbcType="DECIMAL"/>
         <result property="alias" column="alias" javaType="String" jdbcType="VARCHAR"/>
-        <result property="triggers" column="triggers" javaType="String" jdbcType="CLOB"/>
-        <result property="correlations" column="correlations" javaType="String" jdbcType="CLOB"/>
+        <result property="triggers" column="triggers" javaType="String" jdbcType="LONGVARCHAR"/>
+        <result property="correlations" column="correlations" javaType="String" jdbcType="LONGVARCHAR"/>
         <result property="dataSourceId" column="data_source_id" javaType="String" jdbcType="VARCHAR"/>
         <result property="properties" column="properties" javaType="java.util.Map" jdbcType="CLOB"/>
         <result property="type" column="type" javaType="String" jdbcType="VARCHAR"/>

+ 11 - 4
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-api/src/main/java/org/hswebframework/web/entity/organizational/SimpleDepartmentEntity.java

@@ -1,24 +1,26 @@
 /*
  *  Copyright 2019 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.entity.organizational;
 
 import lombok.*;
 import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
 
+import javax.persistence.Column;
+import javax.persistence.Table;
 import java.util.List;
 
 /**
@@ -31,16 +33,21 @@ import java.util.List;
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
+@Table(name = "s_department")
 public class SimpleDepartmentEntity extends SimpleTreeSortSupportEntity<String> implements DepartmentEntity {
     private static final long serialVersionUID = -2137579829759620323L;
     //名称
+    @Column
     private String name;
     //所在组织id
+    @Column(name = "org_id")
     private String orgId;
     //部门编码
+    @Column
     private String code;
     //是否启用
-    private Byte   status;
+    @Column
+    private Byte status;
 
     private List<DepartmentEntity> children;