Browse Source

Merge branch 'master' of github.com:/hs-web/hsweb-framework

zhou-hao 7 years ago
parent
commit
1e99a81746
35 changed files with 794 additions and 31 deletions
  1. 1 1
      ISSUE_TEMPLATE.md
  2. 2 2
      hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/AopAuthorizingController.java
  3. 3 4
      hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/DefaultAopMethodAuthorizeDefinitionParser.java
  4. 6 5
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleAuthorizationSettingService.java
  5. 3 5
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java
  6. 25 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationConfiguration.java
  7. 0 3
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationTokenParser.java
  8. 6 0
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-controller/pom.xml
  9. 32 0
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-controller/src/main/java/org/hswebframework/web/controller/form/DynamicFormAuthorizeDefinitionParser.java
  10. 16 3
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-controller/src/main/java/org/hswebframework/web/controller/form/DynamicFormOperationController.java
  11. 1 1
      hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-entity/src/main/java/org/hswebframework/web/entity/form/DynamicFormEntity.java
  12. 32 0
      hsweb-system/hsweb-system-module/hsweb-system-module-controller/pom.xml
  13. 35 0
      hsweb-system/hsweb-system-module/hsweb-system-module-controller/src/main/java/org/hswebframework/web/controller/module/ModuleController.java
  14. 27 0
      hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-api/pom.xml
  15. 11 0
      hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-api/src/main/java/org/hswebframework/web/dao/module/ModuleDao.java
  16. 26 0
      hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-mybatis/pom.xml
  17. 50 0
      hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/module/ModuleMapper.xml
  18. 18 0
      hsweb-system/hsweb-system-module/hsweb-system-module-dao/pom.xml
  19. 22 0
      hsweb-system/hsweb-system-module/hsweb-system-module-entity/pom.xml
  20. 99 0
      hsweb-system/hsweb-system-module/hsweb-system-module-entity/src/main/java/org/hswebframework/web/entity/module/ModuleEntity.java
  21. 100 0
      hsweb-system/hsweb-system-module/hsweb-system-module-entity/src/main/java/org/hswebframework/web/entity/module/SimpleModuleEntity.java
  22. 26 0
      hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-api/pom.xml
  23. 13 0
      hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-api/src/main/java/org/hswebframework/web/service/module/ModuleService.java
  24. 26 0
      hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-simple/pom.xml
  25. 35 0
      hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-simple/src/main/java/org/hswebframework/web/service/module/simple/SimpleModuleService.java
  26. 18 0
      hsweb-system/hsweb-system-module/hsweb-system-module-service/pom.xml
  27. 78 0
      hsweb-system/hsweb-system-module/hsweb-system-module-starter/pom.xml
  28. 46 0
      hsweb-system/hsweb-system-module/hsweb-system-module-starter/src/main/resources/hsweb-starter.js
  29. 22 0
      hsweb-system/hsweb-system-module/pom.xml
  30. 4 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/CustomScopeDataAccessConfigConvert.java
  31. 4 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/ScopeDataAccessConfigConvert.java
  32. 4 3
      hsweb-system/hsweb-system-template/hsweb-system-template-service/hsweb-system-template-service-simple/src/main/java/org/hswebframework/web/service/template/simple/SimpleTemplateService.java
  33. 1 3
      hsweb-system/hsweb-system-template/hsweb-system-template-starter/src/main/java/org/hswebframework/web/template/starter/TemplateAutoConfiguration.java
  34. 1 1
      hsweb-system/hsweb-system-template/hsweb-system-template-starter/src/main/resources/META-INF/spring.factories
  35. 1 0
      hsweb-system/pom.xml

+ 1 - 1
ISSUE_TEMPLATE.md

@@ -1,4 +1,4 @@
 
 1. Bugs,如果你发现了项目中存在bug,请详细描述bug存在的位置,复现的条件,以及bug引起的问题.如果可能,尽量提供复现代码.
 2. 新特性,如果你觉得项目中的某些功能不够好,或者不能满足您的需求,你可以对需求进行详细描述,我会酌情改进.
-3. 项目中遇到疑问,请确定已经看过wiku中的内容,并且在issues中未找到你需要的答案,你可以加入qq群`515649185`询问或者直接提issue.
+3. 项目中遇到疑问,请确定已经看过wiki中的内容,并且在issues中未找到你需要的答案,你可以加入qq群`515649185`询问或者直接提issue.

+ 2 - 2
hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/AopAuthorizingController.java

@@ -51,8 +51,8 @@ public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor
 
             MethodInterceptorContext paramContext = holder.createParamContext();
 
-            AuthorizeDefinition definition = aopMethodAuthorizeDefinitionParser.parse(methodInvocation.getThis().getClass(), methodInvocation.getMethod());
-            Object result = true;
+            AuthorizeDefinition definition = aopMethodAuthorizeDefinitionParser.parse(methodInvocation.getThis().getClass(), methodInvocation.getMethod(), paramContext);
+            Object result = null;
             boolean isControl = false;
             if (null != definition) {
                 Authentication authentication = Authentication.current().orElseThrow(UnAuthorizedException::new);

+ 3 - 4
hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/aop/DefaultAopMethodAuthorizeDefinitionParser.java

@@ -52,7 +52,7 @@ public class DefaultAopMethodAuthorizeDefinitionParser implements AopMethodAutho
         CacheKey key = buildCacheKey(target, method);
 
         AuthorizeDefinition definition = cache.get(key);
-        if ((definition instanceof EmptyAuthorizeDefinition)) {
+        if (definition instanceof EmptyAuthorizeDefinition) {
             return null;
         }
         if (null != definition) {
@@ -64,10 +64,9 @@ public class DefaultAopMethodAuthorizeDefinitionParser implements AopMethodAutho
                     .map(customer -> customer.parse(target, method, context))
                     .filter(Objects::nonNull)
                     .findAny().orElse(null);
-            if (definition == null || definition instanceof EmptyAuthorizeDefinition) {
-                return null;
+            if (definition != null && !(definition instanceof EmptyAuthorizeDefinition)) {
+                return definition;
             }
-
         }
         Authorize classAuth = AopUtils.findAnnotation(target, Authorize.class);
         Authorize methodAuth = AopUtils.findMethodAnnotation(target, method, Authorize.class);

+ 6 - 5
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleAuthorizationSettingService.java

@@ -41,6 +41,7 @@ import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.cache.annotation.Caching;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.*;
 import java.util.function.Function;
@@ -103,7 +104,7 @@ public class SimpleAuthorizationSettingService extends GenericEntityService<Auth
     }
 
     @Override
-    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
+    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME, CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
     public String saveOrUpdate(AuthorizationSettingEntity entity) {
         AuthorizationSettingEntity old = select(entity.getType(), entity.getSettingFor());
         if (old != null) {
@@ -114,7 +115,7 @@ public class SimpleAuthorizationSettingService extends GenericEntityService<Auth
     }
 
     @Override
-    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
+    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME, CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
     public String insert(AuthorizationSettingEntity entity) {
         tryValidateProperty(select(entity.getType(), entity.getSettingFor()) == null, AuthorizationSettingEntity.settingFor, "存在相同的配置!");
         entity.setStatus(STATUS_ENABLED);
@@ -139,7 +140,7 @@ public class SimpleAuthorizationSettingService extends GenericEntityService<Auth
     }
 
     @Override
-    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
+    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME, CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
     public int updateByPk(String id, AuthorizationSettingEntity entity) {
         int size = super.updateByPk(id, entity);
         if (entity.getMenus() != null) {
@@ -167,7 +168,7 @@ public class SimpleAuthorizationSettingService extends GenericEntityService<Auth
     }
 
     @Override
-    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME,CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
+    @CacheEvict(cacheNames = {CacheConstants.USER_AUTH_CACHE_NAME, CacheConstants.USER_MENU_CACHE_NAME}, allEntries = true)
     public int deleteByPk(String id) {
         Objects.requireNonNull(id, "id can not be null");
         authorizationSettingMenuService.deleteBySettingId(id);
@@ -268,7 +269,7 @@ public class SimpleAuthorizationSettingService extends GenericEntityService<Auth
         return TreeSupportEntity.list2tree(getUserMenuAsList(userId), UserMenuEntity::setChildren,
                 (Predicate<UserMenuEntity>) menuEntity ->
                         // parentId为空或者为-1的菜单则认为是根菜单
-                        menuEntity.getParentId() == null || "-1".equals(menuEntity.getParentId()));
+                        StringUtils.isEmpty(menuEntity.getParentId()) || "-1".equals(menuEntity.getParentId()));
     }
 
     @Override

+ 3 - 5
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/AuthorizationAutoConfiguration.java

@@ -25,11 +25,13 @@ import org.hswebframework.web.authorization.token.UserTokenManager;
 import org.hswebframework.web.service.authorization.UserService;
 import org.hswebframework.web.service.authorization.simple.SimpleAuthenticationManager;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
 
 /**
  * @author zhouhao
@@ -38,6 +40,7 @@ import org.springframework.context.annotation.Configuration;
 @ComponentScan({"org.hswebframework.web.service.authorization.simple"
         , "org.hswebframework.web.controller.authorization"})
 @AutoConfigureBefore(DefaultAuthorizationAutoConfiguration.class)
+@Import(BasicAuthorizationConfiguration.class)
 public class AuthorizationAutoConfiguration {
 
     @Bean
@@ -52,9 +55,4 @@ public class AuthorizationAutoConfiguration {
         return new AutoSyncPermission();
     }
 
-    @Bean
-    @ConditionalOnProperty(prefix = "hsweb.authorize", name = "basic-authorization", havingValue = "true")
-    public BasicAuthorizationTokenParser basicAuthorizationTokenParser(UserService userService, UserTokenManager tokenManager) {
-        return new BasicAuthorizationTokenParser(userService, tokenManager);
-    }
 }

+ 25 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationConfiguration.java

@@ -0,0 +1,25 @@
+package org.hswebframework.web.authorization.starter;
+
+import org.hswebframework.web.authorization.basic.web.UserTokenForTypeParser;
+import org.hswebframework.web.authorization.token.UserTokenManager;
+import org.hswebframework.web.service.authorization.UserService;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+@Configuration
+@ConditionalOnProperty(prefix = "hsweb.authorize", name = "basic-authorization", havingValue = "true")
+@ConditionalOnClass(UserTokenForTypeParser.class)
+public class BasicAuthorizationConfiguration {
+
+    @Bean
+    public BasicAuthorizationTokenParser basicAuthorizationTokenParser(UserService userService, UserTokenManager tokenManager) {
+        return new BasicAuthorizationTokenParser(userService, tokenManager);
+    }
+
+}

+ 0 - 3
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/java/org/hswebframework/web/authorization/starter/BasicAuthorizationTokenParser.java

@@ -1,11 +1,8 @@
 package org.hswebframework.web.authorization.starter;
-
-import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.binary.Base64;
 import org.hswebframework.web.authorization.basic.web.AuthorizedToken;
 import org.hswebframework.web.authorization.basic.web.ParsedToken;
 import org.hswebframework.web.authorization.basic.web.UserTokenForTypeParser;
-import org.hswebframework.web.authorization.basic.web.UserTokenParser;
 import org.hswebframework.web.authorization.token.UserToken;
 import org.hswebframework.web.authorization.token.UserTokenManager;
 import org.hswebframework.web.entity.authorization.UserEntity;

+ 6 - 0
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-controller/pom.xml

@@ -28,5 +28,11 @@
             <artifactId>hsweb-commons-controller</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-authorization-basic</artifactId>
+            <version>${project.version}</version>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 </project>

+ 32 - 0
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-controller/src/main/java/org/hswebframework/web/controller/form/DynamicFormAuthorizeDefinitionParser.java

@@ -0,0 +1,32 @@
+package org.hswebframework.web.controller.form;
+
+import org.hswebframework.web.AopUtils;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.authorization.basic.aop.AopMethodAuthorizeDefinitionCustomizerParser;
+import org.hswebframework.web.authorization.define.AuthorizeDefinition;
+import org.hswebframework.web.boost.aop.context.MethodInterceptorContext;
+import org.springframework.util.ClassUtils;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+public interface DynamicFormAuthorizeDefinitionParser extends AopMethodAuthorizeDefinitionCustomizerParser {
+    @Override
+    default AuthorizeDefinition parse(Class target, Method method, MethodInterceptorContext context) {
+        if (!ClassUtils.getUserClass(target).equals(DynamicFormOperationController.class)
+                || context == null) {
+            return null;
+        }
+        Authorize methodAuth = AopUtils.findMethodAnnotation(target, method, Authorize.class);
+
+        //获取表单id
+        return context.<String>getParameter("formId")
+                .map(formId -> getDefinition(formId, methodAuth == null ? new String[0] : methodAuth.action()))
+                .orElse(null);
+    }
+
+    AuthorizeDefinition getDefinition(String formId, String[] action);
+}

+ 16 - 3
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-controller/src/main/java/org/hswebframework/web/controller/form/DynamicFormOperationController.java

@@ -9,7 +9,6 @@ import org.hswebframework.web.commons.entity.param.DeleteParamEntity;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.commons.entity.param.UpdateParamEntity;
 import org.hswebframework.web.controller.message.ResponseMessage;
-import org.hswebframework.web.logging.AccessLogger;
 import org.hswebframework.web.service.form.DynamicFormOperationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -23,7 +22,7 @@ import java.util.Map;
  * @since 3.0
  */
 @RestController
-@Api(value = "动态表单操作",tags = "动态表单-数据操作")
+@Api(value = "动态表单操作", tags = "动态表单-数据操作")
 @RequestMapping("/dynamic/form/operation")
 @Authorize(permission = "dynamic-form-operation", description = "动态表单数据操作")
 public class DynamicFormOperationController {
@@ -37,11 +36,25 @@ public class DynamicFormOperationController {
 
     @GetMapping("/{formId}")
     @ApiOperation("动态查询")
-    @Authorize(action = Permission.ACTION_GET)
+    @Authorize(action = Permission.ACTION_QUERY)
     public ResponseMessage<PagerResult<Object>> selectPager(@PathVariable String formId, QueryParamEntity paramEntity) {
         return ResponseMessage.ok(dynamicFormOperationService.selectPager(formId, paramEntity));
     }
 
+    @GetMapping("/{formId}/single")
+    @ApiOperation("动态查询返回单条数据")
+    @Authorize(action = Permission.ACTION_QUERY)
+    public ResponseMessage<Object> selectSingle(@PathVariable String formId, QueryParamEntity paramEntity) {
+        return ResponseMessage.ok(dynamicFormOperationService.selectSingle(formId, paramEntity));
+    }
+
+    @GetMapping("/{formId}/count")
+    @ApiOperation("动态查询返回数据条数")
+    @Authorize(action = Permission.ACTION_QUERY)
+    public ResponseMessage<Object> selectCount(@PathVariable String formId, QueryParamEntity paramEntity) {
+        return ResponseMessage.ok(dynamicFormOperationService.count(formId, paramEntity));
+    }
+
     @PostMapping("/{formId}")
     @ApiOperation("新增")
     @Authorize(action = Permission.ACTION_ADD)

+ 1 - 1
hsweb-system/hsweb-system-dynamic-form/hsweb-system-dynamic-form-entity/src/main/java/org/hswebframework/web/entity/form/DynamicFormEntity.java

@@ -171,7 +171,7 @@ public interface DynamicFormEntity extends GenericEntity<String> {
     /**
      * @return 触发器
      */
-    @ApiModelProperty(value = "触发器.", example = "[{\"language\":\"groovy\",\"script\":\" return true;\"}]")
+    @ApiModelProperty(value = "触发器.", example = "[{\"trigger\":\"update.before\",\"language\":\"groovy\",\"script\":\" return true;\"}]")
     String getTriggers();
 
     /**

+ 32 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-controller/pom.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hsweb-system-module</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-controller</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-service-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-controller</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 35 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-controller/src/main/java/org/hswebframework/web/controller/module/ModuleController.java

@@ -0,0 +1,35 @@
+package org.hswebframework.web.controller.module;
+
+import io.swagger.annotations.Api;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.controller.SimpleGenericEntityController;
+import org.hswebframework.web.entity.module.ModuleEntity;
+import org.hswebframework.web.service.module.ModuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 系统自定义模块
+ *
+ * @author hsweb-generator-online
+ */
+@RestController
+@RequestMapping("${hsweb.web.mappings.module:module}")
+@Authorize(permission = "module", description = "自定义模块")
+@Api(tags = "自定义模块", value = "自定义模块")
+public class ModuleController implements SimpleGenericEntityController<ModuleEntity, String, QueryParamEntity> {
+
+    private ModuleService moduleService;
+
+    @Autowired
+    public void setModuleService(ModuleService moduleService) {
+        this.moduleService = moduleService;
+    }
+
+    @Override
+    public ModuleService getService() {
+        return moduleService;
+    }
+}

+ 27 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-api/pom.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hsweb-system-module-dao</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-dao-api</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-entity</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 11 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-api/src/main/java/org/hswebframework/web/dao/module/ModuleDao.java

@@ -0,0 +1,11 @@
+package org.hswebframework.web.dao.module;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.module.ModuleEntity;
+
+/**
+*  系统自定义模块 DAO接口
+*  @author hsweb-generator-online
+ */
+public interface ModuleDao extends CrudDao<ModuleEntity,String> {
+}

+ 26 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-mybatis/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-module-dao</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-dao-mybatis</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-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>

+ 50 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-dao/hsweb-system-module-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/module/ModuleMapper.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.module.ModuleDao">
+    <resultMap id="ModuleResultMap" type="org.hswebframework.web.entity.module.SimpleModuleEntity">
+              <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+            <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
+            <result property="permissionId" column="permission_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="remark" column="remark" javaType="String" jdbcType="VARCHAR"/>
+            <result property="listMeta" column="list_meta" javaType="String" jdbcType="CLOB"/>
+            <result property="saveMeta" column="save_meta" javaType="String" jdbcType="CLOB"/>
+            <result property="status" column="status" javaType="Long" jdbcType="DECIMAL"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'ModuleResultMap'"/>
+        <bind name="tableName" value="'S_MODULE_META'"/>
+    </sql>
+  
+    <insert id="insert" parameterType="org.hswebframework.web.entity.module.SimpleModuleEntity" >
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from S_MODULE_META 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="ModuleResultMap">
+        <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>

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

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hsweb-system-module</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-dao</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-module-dao-api</module>
+        <module>hsweb-system-module-dao-mybatis</module>
+    </modules>
+</project>

+ 22 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-entity/pom.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hsweb-system-module</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-entity</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-entity</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 99 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-entity/src/main/java/org/hswebframework/web/entity/module/ModuleEntity.java

@@ -0,0 +1,99 @@
+package org.hswebframework.web.entity.module;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+
+/**
+ * 系统自定义模块 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface ModuleEntity extends GenericEntity<String> {
+ /*-------------------------------------------
+    |               属性名常量               |
+    ===========================================*/
+    /**
+     * 名称
+     */
+    String name         = "name";
+    /**
+     * 权限id
+     */
+    String permissionId = "permissionId";
+    /**
+     * 备注
+     */
+    String remark       = "remark";
+    /**
+     * 列表配置
+     */
+    String listMeta     = "listMeta";
+    /**
+     * 保存页配置
+     */
+    String saveMeta     = "saveMeta";
+    /**
+     * 状态
+     */
+    String status       = "status";
+
+    /**
+     * @return 名称
+     */
+    String getName();
+
+    /**
+     * @param name 名称
+     */
+    void setName(String name);
+
+    /**
+     * @return 权限id
+     */
+    String getPermissionId();
+
+    /**
+     * @param permissionId 权限id
+     */
+    void setPermissionId(String permissionId);
+
+    /**
+     * @return 备注
+     */
+    String getRemark();
+
+    /**
+     * @param remark 备注
+     */
+    void setRemark(String remark);
+
+    /**
+     * @return 列表配置
+     */
+    String getListMeta();
+
+    /**
+     * @param listMeta 列表配置
+     */
+    void setListMeta(String listMeta);
+
+    /**
+     * @return 保存页配置
+     */
+    String getSaveMeta();
+
+    /**
+     * @param saveMeta 保存页配置
+     */
+    void setSaveMeta(String saveMeta);
+
+    /**
+     * @return 状态
+     */
+    Long getStatus();
+
+    /**
+     * @param status 状态
+     */
+    void setStatus(Long status);
+
+}

+ 100 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-entity/src/main/java/org/hswebframework/web/entity/module/SimpleModuleEntity.java

@@ -0,0 +1,100 @@
+package org.hswebframework.web.entity.module;
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+/**
+* 系统自定义模块
+* @author hsweb-generator-online
+*/
+public class SimpleModuleEntity extends SimpleGenericEntity<String> implements ModuleEntity{
+  		//名称
+        private String name;
+  		//权限id
+        private String permissionId;
+  		//备注
+        private String remark;
+  		//列表配置
+        private String listMeta;
+  		//保存页配置
+        private String saveMeta;
+  		//状态
+        private Long status;
+
+        /**
+        * @return  名称
+        */
+        public String getName(){
+			return this.name;
+        }
+
+        /**
+        * @param  name  名称
+        */
+        public void setName(String name){
+        	this.name=name;
+        }
+        /**
+        * @return  权限id
+        */
+        public String getPermissionId(){
+			return this.permissionId;
+        }
+
+        /**
+        * @param  permissionId  权限id
+        */
+        public void setPermissionId(String permissionId){
+        	this.permissionId=permissionId;
+        }
+        /**
+        * @return  备注
+        */
+        public String getRemark(){
+			return this.remark;
+        }
+
+        /**
+        * @param  remark  备注
+        */
+        public void setRemark(String remark){
+        	this.remark=remark;
+        }
+        /**
+        * @return  列表配置
+        */
+        public String getListMeta(){
+			return this.listMeta;
+        }
+
+        /**
+        * @param  listMeta  列表配置
+        */
+        public void setListMeta(String listMeta){
+        	this.listMeta=listMeta;
+        }
+        /**
+        * @return  保存页配置
+        */
+        public String getSaveMeta(){
+			return this.saveMeta;
+        }
+
+        /**
+        * @param  saveMeta  保存页配置
+        */
+        public void setSaveMeta(String saveMeta){
+        	this.saveMeta=saveMeta;
+        }
+        /**
+        * @return  状态
+        */
+        public Long getStatus(){
+			return this.status;
+        }
+
+        /**
+        * @param  status  状态
+        */
+        public void setStatus(Long status){
+        	this.status=status;
+        }
+}

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

+ 13 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-api/src/main/java/org/hswebframework/web/service/module/ModuleService.java

@@ -0,0 +1,13 @@
+package org.hswebframework.web.service.module;
+
+import org.hswebframework.web.entity.module.ModuleEntity;
+import org.hswebframework.web.service.CrudService;
+
+/**
+ *  系统自定义模块 服务类
+ *
+ * @author hsweb-generator-online
+ */
+public interface ModuleService extends CrudService<ModuleEntity, String> {
+
+}

+ 26 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-simple/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-module-service</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-service-simple</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-service-simple</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-service-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 35 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-service/hsweb-system-module-service-simple/src/main/java/org/hswebframework/web/service/module/simple/SimpleModuleService.java

@@ -0,0 +1,35 @@
+package org.hswebframework.web.service.module.simple;
+
+import org.hswebframework.web.dao.module.ModuleDao;
+import org.hswebframework.web.entity.module.ModuleEntity;
+import org.hswebframework.web.service.EnableCacheGenericEntityService;
+import org.hswebframework.web.service.GenericEntityService;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.module.ModuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.stereotype.Service;
+
+/**
+ * 默认的服务实现
+ *
+ * @author hsweb-generator-online
+ */
+@Service("moduleService")
+@CacheConfig(cacheNames = "system-module")
+public class SimpleModuleService extends EnableCacheGenericEntityService<ModuleEntity, String>
+        implements ModuleService {
+    @Autowired
+    private ModuleDao moduleDao;
+
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+
+    @Override
+    public ModuleDao getDao() {
+        return moduleDao;
+    }
+
+}

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

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hsweb-system-module</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-service</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-module-service-api</module>
+        <module>hsweb-system-module-service-simple</module>
+    </modules>
+</project>

+ 78 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-starter/pom.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>hsweb-system-module</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module-starter</artifactId>
+
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-service-simple</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+      
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-dao-mybatis</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+      
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-module-controller</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+      
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.0.26</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-spring-boot-starter</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-tests</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>test</scope>
+        </dependency>
+      
+    </dependencies>
+</project>

+ 46 - 0
hsweb-system/hsweb-system-module/hsweb-system-module-starter/src/main/resources/hsweb-starter.js

@@ -0,0 +1,46 @@
+
+//组件信息
+var info = {
+    groupId: "${project.groupId}",
+    artifactId: "${project.artifactId}",
+    version: "${project.version}",
+    website: "https://github.com/hs-web/hsweb-framework",
+    author: "admin@hsweb.me",
+    comment: "系统自定义模块"
+};
+
+//版本更新信息
+var versions = [
+    // {
+    //     version: "3.0.2",
+    //     upgrade: function (context) {
+    //         java.lang.System.out.println("更新到3.0.2了");
+    //     }
+    // }
+];
+var JDBCType = java.sql.JDBCType;
+function install(context) {
+    var database = context.database;
+    database.createOrAlter("s_module_meta")
+        .addColumn().name("u_id").alias("id").comment("ID").jdbcType(java.sql.JDBCType.VARCHAR).length(32).primaryKey().commit()
+        .addColumn().name("name").alias("name").comment("名称").jdbcType(java.sql.JDBCType.VARCHAR).length(256).commit()
+        .addColumn().name("permission_id").alias("permissionId").comment("权限id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("remark").alias("remark").comment("备注").jdbcType(java.sql.JDBCType.VARCHAR).length(1024).commit()
+        .addColumn().name("list_meta").alias("listMeta").comment("列表配置").jdbcType(java.sql.JDBCType.CLOB).commit()
+        .addColumn().name("save_meta").alias("saveMeta").comment("保存页配置").jdbcType(java.sql.JDBCType.CLOB).commit()
+        .addColumn().name("status").alias("status").comment("状态").jdbcType(java.sql.JDBCType.DECIMAL).length(4,0).commit()
+        .comment("系统自定义模块").commit();
+}
+//设置依赖
+dependency.setup(info)
+    .onInstall(install)
+    .onUpgrade(function (context) { //更新时执行
+        var upgrader = context.upgrader;
+        upgrader.filter(versions)
+            .upgrade(function (newVer) {
+                newVer.upgrade(context);
+            });
+    })
+    .onUninstall(function (context) { //卸载时执行
+
+    });

+ 22 - 0
hsweb-system/hsweb-system-module/pom.xml

@@ -0,0 +1,22 @@
+<?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</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-module</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-module-controller</module>
+        <module>hsweb-system-module-dao</module>
+        <module>hsweb-system-module-entity</module>
+        <module>hsweb-system-module-service</module>
+        <module>hsweb-system-module-starter</module>
+    </modules>
+
+</project>

+ 4 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/CustomScopeDataAccessConfigConvert.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import org.hswebframework.web.authorization.access.DataAccessConfig;
 import org.hswebframework.web.authorization.simple.builder.DataAccessConfigConvert;
 import org.hswebframework.web.organizational.authorization.access.DataAccessType;
+import org.springframework.util.StringUtils;
 
 import java.util.Arrays;
 import java.util.List;
@@ -25,6 +26,9 @@ public class CustomScopeDataAccessConfigConvert implements DataAccessConfigConve
 
     @Override
     public DataAccessConfig convert(String type, String action, String config) {
+        if (StringUtils.isEmpty(config)) {
+            config = "{}";
+        }
         SimpleCustomScopeDataAccessConfig accessConfig = JSON.parseObject(config, SimpleCustomScopeDataAccessConfig.class);
         accessConfig.setAction(action);
 

+ 4 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-authorization/src/main/java/org/hswebframework/web/organizational/authorization/simple/ScopeDataAccessConfigConvert.java

@@ -3,6 +3,7 @@ package org.hswebframework.web.organizational.authorization.simple;
 import com.alibaba.fastjson.JSON;
 import org.hswebframework.web.authorization.access.DataAccessConfig;
 import org.hswebframework.web.authorization.simple.builder.DataAccessConfigConvert;
+import org.springframework.util.StringUtils;
 
 import java.util.Arrays;
 import java.util.List;
@@ -24,6 +25,9 @@ public class ScopeDataAccessConfigConvert implements DataAccessConfigConvert {
 
     @Override
     public DataAccessConfig convert(String type, String action, String config) {
+        if (StringUtils.isEmpty(config)) {
+            config = "{}";
+        }
         SimpleScopeDataAccessConfig accessConfig = JSON.parseObject(config, SimpleScopeDataAccessConfig.class);
         accessConfig.setAction(action);
         accessConfig.setType(type);

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

@@ -2,10 +2,12 @@ package org.hswebframework.web.service.template.simple;
 
 import org.hswebframework.web.dao.template.TemplateDao;
 import org.hswebframework.web.entity.template.TemplateEntity;
+import org.hswebframework.web.service.EnableCacheGenericEntityService;
 import org.hswebframework.web.service.GenericEntityService;
 import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.template.TemplateService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheConfig;
 import org.springframework.stereotype.Service;
 
 /**
@@ -14,7 +16,8 @@ import org.springframework.stereotype.Service;
  * @author hsweb-generator-online
  */
 @Service("templateService")
-public class SimpleTemplateService extends GenericEntityService<TemplateEntity, String>
+@CacheConfig(cacheNames = "template")
+public class SimpleTemplateService extends EnableCacheGenericEntityService<TemplateEntity, String>
         implements TemplateService {
     @Autowired
     private TemplateDao templateDao;
@@ -36,6 +39,4 @@ public class SimpleTemplateService extends GenericEntityService<TemplateEntity,
         entity.setVersion(old.getVersion() + 1);
         return super.updateByPk(id, entity);
     }
-
-
 }

+ 1 - 3
hsweb-system/hsweb-system-template/hsweb-system-template-starter/src/main/java/org/hswebframework/web/template/starter/TemplateAutoConfiguration.java

@@ -4,10 +4,8 @@ import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 
 /**
- * TODO 完成注释
- *
  * @author zhouhao
- * @since
+ * @since 3.0
  */
 @Configuration
 @ComponentScan({"org.hswebframework.web.service.template.simple"

+ 1 - 1
hsweb-system/hsweb-system-template/hsweb-system-template-starter/src/main/resources/META-INF/spring.factories

@@ -1,3 +1,3 @@
 # Auto Configure
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.hswebframework.web.file.starter.FileAutoConfiguration
+org.hswebframework.web.template.starter.TemplateAutoConfiguration

+ 1 - 0
hsweb-system/pom.xml

@@ -29,6 +29,7 @@
         <module>hsweb-system-dictionary</module>
         <module>hsweb-system-oauth2-server</module>
         <module>hsweb-system-oauth2-client</module>
+        <module>hsweb-system-module</module>
     </modules>
     <artifactId>hsweb-system</artifactId>