Browse Source

调整结构,优化代码

zhouhao 8 years ago
parent
commit
9489d44155
36 changed files with 189 additions and 470 deletions
  1. 6 0
      hsweb-authorization/hsweb-authorization-shiro/pom.xml
  2. 1 0
      hsweb-commons/hsweb-commons-controller/src/main/java/org/hswebframework/web/controller/GenericEntityController.java
  3. 2 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/QueryService.java
  4. 2 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/TreeService.java
  5. 3 1
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/AbstractService.java
  6. 22 14
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/AbstractTreeSortService.java
  7. 7 3
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/DefaultDSLUpdateService.java
  8. 4 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java
  9. 2 2
      hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ThreadLocalUtils.java
  10. 7 7
      hsweb-examples/hsweb-examples-simple/pom.xml
  11. 2 2
      hsweb-examples/hsweb-examples-simple/src/main/java/org/hswebframework/web/example/simple/SpringBootExample.java
  12. 10 3
      hsweb-examples/hsweb-examples-simple/src/main/java/org/hswebframework/web/example/simple/TestController.java
  13. 1 0
      hsweb-message/hsweb-message-api/src/test/java/org/hswebframework/web/message/SimpleMessager.java
  14. 1 1
      hsweb-system/README.md
  15. 17 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-controller/src/main/java/org/hswebframework/web/controller/authorization/PermissionController.java
  16. 5 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/pom.xml
  17. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleRoleService.java
  18. 6 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleUserService.java
  19. 0 5
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/starter/authorization/UserTests.java
  20. 0 2
      hsweb-system/hsweb-system-explorer/README.md
  21. 0 30
      hsweb-system/hsweb-system-explorer/hsweb-system-explorer-dao/hsweb-system-explorer-dao-api/src/main/java/org/hswebframework/web/dao/explorer/MenuDao.java
  22. 0 195
      hsweb-system/hsweb-system-explorer/hsweb-system-explorer-entity/src/main/java/org/hswebframework/web/entity/explorer/SimpleMenuEntity.java
  23. 0 49
      hsweb-system/hsweb-system-explorer/hsweb-system-explorer-service/hsweb-system-explorer-service-simple/pom.xml
  24. 0 37
      hsweb-system/hsweb-system-explorer/hsweb-system-explorer-service/pom.xml
  25. 0 68
      hsweb-system/hsweb-system-explorer/hsweb-system-explorer-starter/src/main/resources/hsweb-starter.js
  26. 45 3
      hsweb-system/hsweb-system-menu/hsweb-system-menu-controller/src/main/java/org/hswebframework/web/controller/menu/MenuController.java
  27. 1 1
      hsweb-system/hsweb-system-menu/hsweb-system-menu-dao/hsweb-system-menu-dao-api/src/main/java/org/hswebframework/web/dao/menu/MenuDao.java
  28. 3 9
      hsweb-system/hsweb-system-menu/hsweb-system-menu-entity/src/main/java/org/hswebframework/web/entity/menu/MenuEntity.java
  29. 9 5
      hsweb-system/hsweb-system-menu/hsweb-system-menu-entity/src/main/java/org/hswebframework/web/entity/menu/SimpleMenuEntity.java
  30. 1 1
      hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-api/src/main/java/org/hswebframework/web/service/menu/MenuGroupService.java
  31. 4 4
      hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-api/src/main/java/org/hswebframework/web/service/menu/MenuService.java
  32. 14 8
      hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-simple/src/main/java/org/hswebframework/web/service/menu/simple/SimpleMenuGroupService.java
  33. 5 5
      hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-simple/src/main/java/org/hswebframework/web/service/menu/simple/SimpleMenuService.java
  34. 5 5
      hsweb-system/hsweb-system-menu/hsweb-system-menu-starter/src/test/java/org/hswebframework/web/starter/menu/MenuTests.java
  35. 3 1
      hsweb-system/pom.xml
  36. 0 5
      pom.xml

+ 6 - 0
hsweb-authorization/hsweb-authorization-shiro/pom.xml

@@ -78,6 +78,12 @@
             <version>2.5</version>
             <optional>true</optional>
         </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-authorization-oauth2-client</artifactId>
+            <version>${project.version}</version>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 
 </project>

+ 1 - 0
hsweb-commons/hsweb-commons-controller/src/main/java/org/hswebframework/web/controller/GenericEntityController.java

@@ -60,4 +60,5 @@ public interface GenericEntityController<E extends GenericEntity<PK>, PK, Q exte
         entity.setId(id);
         return ResponseMessage.ok(getService().saveOrUpdate(modelToEntity(data, entity)));
     }
+
 }

+ 2 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/QueryService.java

@@ -27,6 +27,8 @@ import java.util.List;
 public interface QueryService<E, PK> {
     E selectByPk(PK id);
 
+    List<E> selectByPk(List<PK> id);
+
     List<E> select();
 
     int count();

+ 2 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/src/main/java/org/hswebframework/web/service/TreeService.java

@@ -33,4 +33,6 @@ public interface TreeService<E extends TreeSupportEntity, PK> extends Service {
     List<E> selectAllChildNode(PK parentId);
 
     int updateBatch(Collection<E> data);
+
+    List<PK> insertBatch(Collection<E> data);
 }

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

@@ -13,9 +13,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import javax.validation.Validator;
 
 /**
- * TODO 完成注释
+ * 抽象服务类,提供通用模板方法、类,如验证器,实体工厂等
  *
  * @author zhouhao
+ * @see CreateEntityService
+ * @see Service
  */
 public abstract class AbstractService<E extends Entity, PK> implements CreateEntityService<E>, Service {
     protected Logger logger = LoggerFactory.getLogger(this.getClass());

+ 22 - 14
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/AbstractTreeSortService.java

@@ -26,11 +26,14 @@ import org.springframework.util.Assert;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
- * TODO 完成注释
+ * 抽象树形结构服务类
  *
  * @author zhouhao
+ * @see TreeSortSupportEntity
+ * @since 3.0
  */
 public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK>, PK>
         extends GenericEntityService<E, PK> implements TreeService<E, PK> {
@@ -53,7 +56,7 @@ public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK
 
     @Override
     public PK insert(E entity) {
-        entity.setId(getIDGenerator().generate());
+        if (entity.getId() == null) entity.setId(getIDGenerator().generate());
         List<E> childrenList = new ArrayList<>();
         TreeSupportEntity.expandTree2List(entity, childrenList, getIDGenerator());
         super.insert(entity);
@@ -61,33 +64,38 @@ public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK
         return entity.getId();
     }
 
+    @Override
+    public List<PK> insertBatch(Collection<E> data) {
+        return data.parallelStream()
+                .map(this::insert)
+                .collect(Collectors.toList());
+    }
+
     public int updateBatch(Collection<E> data) {
-        Assert.notNull(data);
+        assertNotNull(data);
         return data.stream().map(this::updateByPk).reduce(Math::addExact).orElse(0);
     }
 
     @Override
     public int updateByPk(E entity) {
-        Assert.notNull(entity);
+        assertNotNull(entity);
         List<E> childrenList = new ArrayList<>();
         TreeSupportEntity.expandTree2List(entity, childrenList, getIDGenerator());
-        return this.saveOrUpdateForSingle(entity) +
-                childrenList.stream()
-                        .map(this::saveOrUpdateForSingle)
-                        .reduce(Math::addExact)
-                        .orElse(0);
+        this.saveOrUpdateForSingle(entity);
+        childrenList.forEach(this::saveOrUpdateForSingle);
+        return childrenList.size() + 1;
     }
 
-    public int saveOrUpdateForSingle(E entity) {
-        Assert.notNull(entity);
+    public PK saveOrUpdateForSingle(E entity) {
+        assertNotNull(entity);
         PK id = entity.getId();
         if (null == id || this.selectByPk(id) == null) {
             if (null == id)
                 entity.setId(getIDGenerator().generate());
-            super.insert(entity);
-            return 1;
+            return super.insert(entity);
         }
-        return super.updateByPk(entity);
+        super.updateByPk(entity);
+        return id;
     }
 
     @Override

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

@@ -23,16 +23,20 @@ import org.hswebframework.web.dao.dynamic.UpdateByEntityDao;
 import org.hswebframework.web.commons.entity.param.UpdateParamEntity;
 
 /**
- * TODO 完成注释
+ * 默认的DSL方式更新服务
  *
  * @author zhouhao
  */
-public interface DefaultDSLUpdateService<E,PK> extends UpdateService<E,PK> {
+public interface DefaultDSLUpdateService<E, PK> extends UpdateService<E, PK> {
 
     UpdateByEntityDao getDao();
 
     default Update<E, UpdateParamEntity<E>> createUpdate(E data) {
-        return Update.build(getDao()::update, new UpdateParamEntity<>(data));
+        return createUpdate(getDao(), data);
+    }
+
+    default Update<E, UpdateParamEntity<E>> createUpdate() {
+        return createUpdate(getDao());
     }
 
     static <E> Update<E, UpdateParamEntity<E>> createUpdate(UpdateByEntityDao dao) {

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

@@ -109,4 +109,8 @@ public abstract class GenericEntityService<E extends GenericEntity<PK>, PK>
         return createQuery().where(GenericEntity.id, pk).single();
     }
 
+    @Override
+    public List<E> selectByPk(List<PK> id) {
+        return createQuery().where().in(GenericEntity.id, id).listNoPaging();
+    }
 }

+ 2 - 2
hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ThreadLocalUtils.java

@@ -50,10 +50,10 @@ public class ThreadLocalUtils {
     /**
      * @since 3.0
      */
-    public static <T> T get(String key, Supplier<T> supplierOnNull) {
+    public static <T> T get(String key, Supplier<T> other) {
         T val = ((T) local.get().get(key));
         if (null != val) return val;
-        val = supplierOnNull.get();
+        val = other.get();
         local.get().put(key, val);
         return val;
     }

+ 7 - 7
hsweb-examples/hsweb-examples-simple/pom.xml

@@ -99,17 +99,17 @@
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-system-explorer-starter</artifactId>
+            <artifactId>hsweb-system-menu-starter</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <!--<dependency>-->
-            <!--<groupId>org.hswebframework.web</groupId>-->
-            <!--<artifactId>hsweb-authorization-shiro</artifactId>-->
-            <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
         <dependency>
             <groupId>org.hswebframework.web</groupId>
-            <artifactId>hsweb-authorization-oauth2-server-starter</artifactId>
+            <artifactId>hsweb-authorization-shiro</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-oauth2-server-starter</artifactId>
             <version>${project.version}</version>
         </dependency>
 

+ 2 - 2
hsweb-examples/hsweb-examples-simple/src/main/java/org/hswebframework/web/example/simple/SpringBootExample.java

@@ -22,14 +22,14 @@ import org.hsweb.ezorm.rdb.executor.SqlExecutor;
 import org.hswebframework.web.authorization.Authentication;
 import org.hswebframework.web.authorization.Permission;
 import org.hswebframework.web.authorization.access.DataAccessConfig;
+import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2ClientEntity;
 import org.hswebframework.web.commons.entity.factory.EntityFactory;
-import org.hswebframework.web.dao.authorization.oauth2.OAuth2ClientDao;
+import org.hswebframework.web.dao.oauth2.OAuth2ClientDao;
 import org.hswebframework.web.dao.datasource.DataSourceHolder;
 import org.hswebframework.web.dao.datasource.DatabaseType;
 import org.hswebframework.web.entity.authorization.*;
 import org.hswebframework.web.entity.authorization.bind.BindPermissionRoleEntity;
 import org.hswebframework.web.entity.authorization.bind.BindRoleUserEntity;
-import org.hswebframework.web.entity.authorization.oauth2.OAuth2ClientEntity;
 import org.hswebframework.web.service.authorization.PermissionService;
 import org.hswebframework.web.service.authorization.RoleService;
 import org.hswebframework.web.service.authorization.UserService;

+ 10 - 3
hsweb-examples/hsweb-examples-simple/src/main/java/org/hswebframework/web/example/simple/TestController.java

@@ -3,11 +3,9 @@ package org.hswebframework.web.example.simple;
 import io.swagger.annotations.ApiOperation;
 import org.hswebframework.web.AuthorizeException;
 import org.hswebframework.web.authorization.Authentication;
-import org.hswebframework.web.authorization.AuthenticationHolder;
 import org.hswebframework.web.authorization.Permission;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.RequiresDataAccess;
-import org.hswebframework.web.authorization.annotation.RequiresExpression;
 import org.hswebframework.web.authorization.annotation.RequiresFieldAccess;
 import org.hswebframework.web.commons.entity.Entity;
 import org.hswebframework.web.commons.entity.PagerResult;
@@ -19,8 +17,12 @@ import org.hswebframework.web.entity.authorization.UserEntity;
 import org.hswebframework.web.model.authorization.UserModel;
 import org.hswebframework.web.service.QueryByEntityService;
 import org.hswebframework.web.service.QueryService;
+import org.hswebframework.web.service.authorization.UserService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.ContextLoader;
 
+import javax.annotation.PostConstruct;
 import java.util.List;
 
 /**
@@ -33,7 +35,6 @@ import java.util.List;
 @Authorize(permission = "test")
 public class TestController implements QueryController<UserEntity, String, QueryParamEntity> {
 
-
     @GetMapping("/test1")
     @Authorize(action = "query")
     public ResponseMessage testSimple(Authentication authentication) {
@@ -52,6 +53,7 @@ public class TestController implements QueryController<UserEntity, String, Query
     @RequiresFieldAccess(permission = "test", action = Permission.ACTION_QUERY)
     @ApiOperation("测试查询")
     public ResponseMessage<QueryParamEntity> testQuery(QueryParamEntity entity) {
+
         /*
         @RequiresFieldAccess 字段级别权限控制
         entity.getExcludes() 自动填充不能访问的字段
@@ -86,6 +88,11 @@ public class TestController implements QueryController<UserEntity, String, Query
             return userEntity;
         }
 
+        @Override
+        public List<UserEntity> selectByPk(List<String> id) {
+            return null;
+        }
+
         @Override
         public List<UserEntity> select() {
             return null;

+ 1 - 0
hsweb-message/hsweb-message-api/src/test/java/org/hswebframework/web/message/SimpleMessager.java

@@ -42,6 +42,7 @@ public class SimpleMessager implements Messager {
     List<MessagePublishHanlder> publishHanlders = new ArrayList<>();
 
     public SimpleMessager() {
+        //just support TextMessage
         publishHanlders.add(new MessagePublishHanlder() {
             @Override
             public boolean isSupport(Message message) {

+ 1 - 1
hsweb-system/README.md

@@ -14,7 +14,7 @@
 |[hsweb-system-dictionary](hsweb-system-dictionary)| 数据字典功能|  50%|
 |[hsweb-system-document](hsweb-system-document)|文档管理功能| 0%|
 |[hsweb-system-dynamic-form](hsweb-system-dynamic-form)|动态表单| 0%|
-|[hsweb-system-explorer](hsweb-system-explorer)|**系统资源管理(菜单,按钮)**| 20%|
+|[hsweb-system-explorer](hsweb-system-menu)|**系统菜单**| 80%|
 |[hsweb-system-file](hsweb-system-file)|文件管理| 0%|
 |[hsweb-system-history](hsweb-system-history)|历史记录管理| 0%|
 |[hsweb-system-monitor](hsweb-system-monitor)|系统监控| 0%|

+ 17 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-controller/src/main/java/org/hswebframework/web/controller/authorization/PermissionController.java

@@ -20,7 +20,12 @@ package org.hswebframework.web.controller.authorization;
 
 import io.swagger.annotations.Api;
 import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.controller.GenericEntityController;
+import org.hswebframework.web.entity.authorization.PermissionEntity;
 import org.hswebframework.web.logging.AccessLogger;
+import org.hswebframework.web.service.authorization.PermissionService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -32,6 +37,17 @@ import org.springframework.web.bind.annotation.RestController;
 @AccessLogger("{permission_manager}")
 @Authorize(permission = "permission")
 @Api(tags = "permission-manager", description = "权限管理")
-public class PermissionController {
+public class PermissionController implements GenericEntityController<PermissionEntity, String, QueryParamEntity, PermissionEntity> {
 
+    private PermissionService permissionService;
+
+    @Autowired
+    public void setPermissionService(PermissionService permissionService) {
+        this.permissionService = permissionService;
+    }
+
+    @Override
+    public PermissionService getService() {
+        return permissionService;
+    }
 }

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

@@ -27,5 +27,10 @@
             <artifactId>hsweb-system-authorization-entity</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-authorization-dao-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/src/main/java/org/hswebframework/web/service/authorization/simple/SimpleRoleService.java

@@ -143,7 +143,7 @@ public class SimpleRoleService extends AbstractService<RoleEntity, String>
                 .set(RoleEntity.name, roleEntity.getName())
                 .set(RoleEntity.describe, roleEntity.getDescribe())
                 .where(RoleEntity.id, roleEntity.getId()).exec();
-        if (roleEntity.getProperties() != null) {
+        if (roleEntity.getPermissions() != null) {
             permissionRoleDao.deleteByRoleId(roleEntity.getId());
             syncPermissions(roleEntity.getId(), roleEntity.getPermissions());
         }

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

@@ -23,10 +23,14 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 import org.springframework.util.StringUtils;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
 import java.util.stream.Collectors;
 
-import static org.hswebframework.web.service.authorization.simple.CacheConstants.*;
+import static org.hswebframework.web.service.authorization.simple.CacheConstants.USER_AUTH_CACHE_NAME;
+import static org.hswebframework.web.service.authorization.simple.CacheConstants.USER_CACHE_NAME;
 
 /**
  * TODO 完成注释

+ 0 - 5
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/starter/authorization/UserTests.java

@@ -120,17 +120,12 @@ public class UserTests extends SimpleWebApplicationTests {
         UserEntity entityInDb = userService.selectByUsername(userEntity.getUsername());
         Assert.assertEquals(entityInDb.isEnabled(), true);
         Assert.assertNotNull(entityInDb.getCreateTime());
-        Assert.assertTrue(entityInDb.getLastLoginTime() == null);
-        Assert.assertTrue(entityInDb.getLastLoginIp() == null);
 
         Assert.assertEquals(entityInDb.getPassword(), userService.encodePassword("password_1234", entityInDb.getSalt()));
 
-        userService.updateLoginInfo(id, "127.0.0.1", System.currentTimeMillis());
         entityInDb = userService.selectByUsername(userEntity.getUsername());
         Assert.assertEquals(entityInDb.isEnabled(), true);
         Assert.assertNotNull(entityInDb.getCreateTime());
-        Assert.assertNotNull(entityInDb.getLastLoginTime());
-        Assert.assertNotNull(entityInDb.getLastLoginIp());
         try {
             userService.updatePassword(id, "test", "test");
             Assert.assertTrue(false);

+ 0 - 2
hsweb-system/hsweb-system-explorer/README.md

@@ -1,2 +0,0 @@
-## 系统资源管理器
-用于管理系统 菜单,按钮等功能

+ 0 - 30
hsweb-system/hsweb-system-explorer/hsweb-system-explorer-dao/hsweb-system-explorer-dao-api/src/main/java/org/hswebframework/web/dao/explorer/MenuDao.java

@@ -1,30 +0,0 @@
-/*
- * Copyright 2016 http://www.hswebframework.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.hswebframework.web.dao.explorer;
-
-import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.entity.authorization.ActionEntity;
-import org.hswebframework.web.entity.explorer.MenuEntity;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public interface MenuDao extends CrudDao<MenuEntity<MenuEntity>, String> {
-}

+ 0 - 195
hsweb-system/hsweb-system-explorer/hsweb-system-explorer-entity/src/main/java/org/hswebframework/web/entity/explorer/SimpleMenuEntity.java

@@ -1,195 +0,0 @@
-/*
- * Copyright 2016 http://www.hswebframework.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.hswebframework.web.entity.explorer;
-
-import org.hswebframework.web.commons.entity.CloneableEntity;
-import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
-import org.hswebframework.web.entity.authorization.ActionEntity;
-
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public class SimpleMenuEntity extends SimpleTreeSortSupportEntity<String>
-        implements MenuEntity<SimpleMenuEntity> {
-
-    //菜单名称
-    private String name;
-
-    //备注
-    private String describe;
-
-    //权限ID
-    private String permissionId;
-
-    //菜单对应的url
-    private String url;
-
-    //图标
-    private String icon;
-
-    //授权方式
-    private String authentication;
-
-    //授权配置
-    private Map<String, Object> authenticationConfig;
-
-    //菜单初始化时,执行脚本
-    private String onInit;
-
-    //是否启用
-    private boolean enabled = true;
-
-    //子菜单
-    private List<SimpleMenuEntity> children;
-
-    //可选操作(按钮)
-    private List<ActionEntity> actions;
-
-    public List<ActionEntity> getActions() {
-        return actions;
-    }
-
-    public void setActions(List<ActionEntity> actions) {
-        this.actions = actions;
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public List<SimpleMenuEntity> getChildren() {
-        return children;
-    }
-
-    @Override
-    public void setChildren(List<SimpleMenuEntity> children) {
-        this.children = children;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDescribe() {
-        return describe;
-    }
-
-    public void setDescribe(String describe) {
-        this.describe = describe;
-    }
-
-    public String getPermissionId() {
-        return permissionId;
-    }
-
-    public void setPermissionId(String permissionId) {
-        this.permissionId = permissionId;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getIcon() {
-        return icon;
-    }
-
-    public void setIcon(String icon) {
-        this.icon = icon;
-    }
-
-    public String getAuthentication() {
-        return authentication;
-    }
-
-    public void setAuthentication(String authentication) {
-        this.authentication = authentication;
-    }
-
-    public Map<String, Object> getAuthenticationConfig() {
-        return authenticationConfig;
-    }
-
-    public void setAuthenticationConfig(Map<String, Object> authenticationConfig) {
-        this.authenticationConfig = authenticationConfig;
-    }
-
-    public String getOnInit() {
-        return onInit;
-    }
-
-    public void setOnInit(String onInit) {
-        this.onInit = onInit;
-    }
-
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    @Override
-    public SimpleMenuEntity clone() {
-        SimpleMenuEntity target = new SimpleMenuEntity();
-        target.setId(getId());
-        target.setName(getName());
-        target.setDescribe(getDescribe());
-        target.setEnabled(isEnabled());
-        target.setPermissionId(getPermissionId());
-        target.setOnInit(getOnInit());
-        target.setAuthentication(getAuthentication());
-        target.setUrl(getUrl());
-        target.setIcon(getIcon());
-        target.setProperties(cloneProperties());
-        target.setParentId(getParentId());
-        target.setTreeCode(getTreeCode());
-        target.setSortIndex(getSortIndex());
-        if (null != getAuthenticationConfig()) {
-            target.setAuthenticationConfig(getAuthenticationConfig()
-                    .entrySet().stream().collect(Collectors.toMap(
-                            Map.Entry::getKey,
-                            e -> {
-                                if (e.getValue() instanceof CloneableEntity) {
-                                    return ((CloneableEntity) e.getValue()).clone();
-                                }
-                                return e.getValue();
-                            })));
-        }
-        if (null != getActions()) {
-            target.setActions(getActions().stream().map(ActionEntity::clone).collect(Collectors.toList()));
-        }
-        if (null != getChildren()) {
-            target.setChildren(getChildren().stream().map(SimpleMenuEntity::clone).collect(Collectors.toList()));
-        }
-        return target;
-    }
-}

+ 0 - 49
hsweb-system/hsweb-system-explorer/hsweb-system-explorer-service/hsweb-system-explorer-service-simple/pom.xml

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

+ 0 - 37
hsweb-system/hsweb-system-explorer/hsweb-system-explorer-service/pom.xml

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

+ 0 - 68
hsweb-system/hsweb-system-explorer/hsweb-system-explorer-starter/src/main/resources/hsweb-starter.js

@@ -1,68 +0,0 @@
-/*
- * Copyright 2016 http://www.hswebframework.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-//组件信息
-var info = {
-    groupId: "${project.groupId}",
-    artifactId: "${project.artifactId}",
-    version: "${project.version}",
-    website: "http://github.com/hs-web/hsweb-framework",
-    author: "zh.sqy@qq.com",
-    comment: "资源管理器"
-};
-
-//版本更新信息
-var versions = [
-    // {
-    //     version: "3.0.0",
-    //     upgrade: function (context) {
-    //     }
-    // }
-];
-var JDBCType = java.sql.JDBCType;
-function install(context) {
-    var database = context.database;
-    database.createOrAlter("s_menu")
-        .addColumn().name("u_id").varchar(32).notNull().primaryKey().comment("uid").commit()
-        .addColumn().name("name").varchar(64).notNull().comment("名称").commit()
-        .addColumn().name("parent_id").varchar(32).comment("父级ID").commit()
-        .addColumn().name("permission_id").varchar(32).comment("权限ID").commit()
-        .addColumn().name("tree_code").varchar(2048).notNull().comment("树编码").commit()
-        .addColumn().name("sort_index").number(32).notNull().comment("树编码").commit()
-        .addColumn().name("describe").varchar(128).comment("备注").commit()
-        .addColumn().name("url").varchar(2000).comment("URL").commit()
-        .addColumn().name("icon").varchar(512).comment("图标").commit()
-        .addColumn().name("authentication").varchar(128).comment("认证方式").commit()
-        .addColumn().name("authentication_config").clob().comment("认证配置").commit()
-        .addColumn().name("on_init").clob().comment("加载后执行脚本").commit()
-        .addColumn().name("enabled").varchar(32).comment("是否有效").commit()
-        .addColumn().name("actions").clob().comment("可选操作集合").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) { //卸载时执行
-
-    });

+ 45 - 3
hsweb-system/hsweb-system-menu/hsweb-system-menu-controller/src/main/java/org/hswebframework/web/controller/menu/MenuController.java

@@ -18,18 +18,31 @@
 
 package org.hswebframework.web.controller.menu;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.hswebframework.web.authorization.Authentication;
+import org.hswebframework.web.authorization.Role;
 import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.commons.entity.TreeSupportEntity;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.controller.GenericEntityController;
+import org.hswebframework.web.controller.message.ResponseMessage;
 import org.hswebframework.web.entity.menu.MenuEntity;
-import org.hswebframework.web.entity.menu.MenuGroupEntity;
 import org.hswebframework.web.logging.AccessLogger;
 import org.hswebframework.web.service.menu.MenuGroupService;
 import org.hswebframework.web.service.menu.MenuService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.hswebframework.web.controller.message.ResponseMessage.ok;
+
 /**
  * 菜单分组
  *
@@ -39,17 +52,46 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("${hsweb.web.mappings.menu:menu}")
 @Authorize(permission = "menu")
 @AccessLogger("菜单")
-public class MenuController implements GenericEntityController<MenuEntity<MenuEntity>, String, QueryParamEntity, MenuEntity> {
+@Api(value = "menu-manager", description = "系统菜单管理")
+public class MenuController implements GenericEntityController<MenuEntity, String, QueryParamEntity, MenuEntity> {
 
     private MenuService menuService;
 
+    private MenuGroupService menuGroupService;
+
     @Autowired
-    public void setMenuGroupService(MenuService menuService) {
+    public void setMenuService(MenuService menuService) {
         this.menuService = menuService;
     }
 
+    @Autowired
+    public void setMenuGroupService(MenuGroupService menuGroupService) {
+        this.menuGroupService = menuGroupService;
+    }
+
     @Override
     public MenuService getService() {
         return menuService;
     }
+
+    @GetMapping("/user-own/list")
+    @Authorize(merge = false)
+    @ApiOperation("获取当前用户的菜单列表")
+    public ResponseMessage<List<MenuEntity>> getUserMenuAsList(@ApiParam(hidden = true) Authentication authentication) {
+        List<MenuEntity> menuEntities = menuGroupService
+                .getMenuByGroupId(authentication.getRoles()
+                        .stream()
+                        .map(Role::getId)
+                        .collect(Collectors.toList()));
+        return ok(menuEntities);
+    }
+
+    @GetMapping("/user-own/tree")
+    @Authorize(merge = false)
+    @ApiOperation("获取当前用户的菜单树")
+    public ResponseMessage<List<MenuEntity>> getUserMenuAsTree(@ApiParam(hidden = true) Authentication authentication) {
+        List<MenuEntity> menuEntities = getUserMenuAsList(authentication).getResult();
+        //list转tree
+        return ok(TreeSupportEntity.list2tree(menuEntities, (menu, children) -> menu.setChildren(new ArrayList<>(children))));
+    }
 }

+ 1 - 1
hsweb-system/hsweb-system-menu/hsweb-system-menu-dao/hsweb-system-menu-dao-api/src/main/java/org/hswebframework/web/dao/menu/MenuDao.java

@@ -26,5 +26,5 @@ import org.hswebframework.web.entity.menu.MenuEntity;
  *
  * @author zhouhao
  */
-public interface MenuDao extends CrudDao<MenuEntity<MenuEntity>, String> {
+public interface MenuDao extends CrudDao<MenuEntity, String> {
 }

+ 3 - 9
hsweb-system/hsweb-system-menu/hsweb-system-menu-entity/src/main/java/org/hswebframework/web/entity/menu/MenuEntity.java

@@ -24,11 +24,9 @@ import org.hswebframework.web.entity.authorization.ActionEntity;
 import java.util.List;
 
 /**
- * TODO 完成注释
- *
  * @author zhouhao
  */
-public interface MenuEntity<C extends MenuEntity>
+public interface MenuEntity
         extends TreeSortSupportEntity<String> {
     String getName();
 
@@ -54,11 +52,7 @@ public interface MenuEntity<C extends MenuEntity>
 
     void setEnabled(boolean enabled);
 
-    void setChildren(List<C> children);
-
-    @Override
-    @SuppressWarnings("unchecked")
-    List<C> getChildren();
+    void setChildren(List<MenuEntity> children);
 
-    MenuEntity<C> clone();
+    MenuEntity clone();
 }

+ 9 - 5
hsweb-system/hsweb-system-menu/hsweb-system-menu-entity/src/main/java/org/hswebframework/web/entity/menu/SimpleMenuEntity.java

@@ -20,6 +20,7 @@ package org.hswebframework.web.entity.menu;
 
 import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -29,7 +30,7 @@ import java.util.stream.Collectors;
  * @author zhouhao
  */
 public class SimpleMenuEntity extends SimpleTreeSortSupportEntity<String>
-        implements MenuEntity<SimpleMenuEntity> {
+        implements MenuEntity {
 
     //菜单名称
     private String name;
@@ -55,12 +56,13 @@ public class SimpleMenuEntity extends SimpleTreeSortSupportEntity<String>
     @Override
     @SuppressWarnings("unchecked")
     public List<SimpleMenuEntity> getChildren() {
-        return children;
+        return new ArrayList<>(children);
     }
 
     @Override
-    public void setChildren(List<SimpleMenuEntity> children) {
-        this.children = children;
+    public void setChildren(List<MenuEntity> children) {
+        // TODO: 17-4-6 有待优化
+        this.children = ((List) children);
     }
 
     public String getName() {
@@ -116,7 +118,9 @@ public class SimpleMenuEntity extends SimpleTreeSortSupportEntity<String>
         SimpleMenuEntity target = (SimpleMenuEntity) super.clone();
         target.setProperties(cloneProperties());
         if (null != getChildren()) {
-            target.setChildren(getChildren().stream().map(SimpleMenuEntity::clone).collect(Collectors.toList()));
+            target.setChildren(getChildren().stream()
+                    .map(MenuEntity::clone)
+                    .collect(Collectors.toList()));
         }
         return target;
     }

+ 1 - 1
hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-api/src/main/java/org/hswebframework/web/service/menu/MenuGroupService.java

@@ -32,7 +32,7 @@ public interface MenuGroupService extends
         CrudService<MenuGroupEntity, String>
         , TreeService<MenuGroupEntity, String> {
 
-    List<MenuEntity<MenuEntity>> getMenuByGroupId(List<String> groupId);
+    List<MenuEntity> getMenuByGroupId(List<String> groupId);
 
     void enable(String id);
 

+ 4 - 4
hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-api/src/main/java/org/hswebframework/web/service/menu/MenuService.java

@@ -31,9 +31,9 @@ import java.util.List;
  * @author zhouhao
  */
 public interface MenuService
-        extends CrudService<MenuEntity<MenuEntity>, String>
-        , TreeService<MenuEntity<MenuEntity>, String> {
-    MenuEntity<MenuEntity> getByPermissionId(String permissionId);
+        extends CrudService<MenuEntity, String>
+        , TreeService<MenuEntity, String> {
+    MenuEntity getByPermissionId(String permissionId);
 
-    List<MenuEntity<MenuEntity>> getByPermissionId(List<String> permissionId);
+    List<MenuEntity> getByPermissionId(List<String> permissionId);
 }

+ 14 - 8
hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-simple/src/main/java/org/hswebframework/web/service/menu/simple/SimpleMenuGroupService.java

@@ -18,10 +18,12 @@ package org.hswebframework.web.service.menu.simple;
 
 import org.hswebframework.web.dao.menu.MenuGroupDao;
 import org.hswebframework.web.entity.authorization.PermissionRoleEntity;
+import org.hswebframework.web.entity.authorization.UserEntity;
 import org.hswebframework.web.entity.authorization.bind.BindPermissionRoleEntity;
 import org.hswebframework.web.entity.menu.MenuEntity;
 import org.hswebframework.web.entity.menu.MenuGroupBindEntity;
 import org.hswebframework.web.entity.menu.MenuGroupEntity;
+import org.hswebframework.web.entity.menu.SimpleMenuGroupEntity;
 import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.AbstractTreeSortService;
 import org.hswebframework.web.service.DefaultDSLUpdateService;
@@ -29,7 +31,6 @@ import org.hswebframework.web.service.authorization.RoleService;
 import org.hswebframework.web.service.menu.MenuGroupBindService;
 import org.hswebframework.web.service.menu.MenuGroupService;
 import org.hswebframework.web.service.menu.MenuService;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheConfig;
 import org.springframework.cache.annotation.CacheEvict;
@@ -37,6 +38,7 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.function.Consumer;
@@ -85,11 +87,12 @@ public class SimpleMenuGroupService
     }
 
     @Cacheable(key = "'group-id-list:'+#groupId==null?0:#groupId.hashCode()")
-    public List<MenuEntity<MenuEntity>> getMenuByGroupId(List<String> groupId) {
+    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()));
     }
 
@@ -134,10 +137,10 @@ public class SimpleMenuGroupService
     @CacheEvict(allEntries = true)
     public void enable(String id) {
         tryValidateProperty(StringUtils.hasLength(id), MenuGroupEntity.id, "{id_is_null}");
-        DefaultDSLUpdateService
-                .createUpdate(getDao())
+        createUpdate()
                 .set(MenuGroupEntity.enabled, true)
-                .where(MenuGroupEntity.id, id).exec();
+                .where(MenuGroupEntity.id, id)
+                .exec();
         if (checkRoleServiceIsEnable())
             roleService.enable(id);
     }
@@ -149,7 +152,8 @@ public class SimpleMenuGroupService
         DefaultDSLUpdateService
                 .createUpdate(getDao())
                 .set(MenuGroupEntity.enabled, false)
-                .where(MenuGroupEntity.id, id).exec();
+                .where(MenuGroupEntity.id, id)
+                .exec();
         if (checkRoleServiceIsEnable())
             roleService.disable(id);
     }
@@ -159,7 +163,9 @@ public class SimpleMenuGroupService
         if (!checkRoleServiceIsEnable()) return;
         //角色的操作,新增or更新
         Consumer<BindPermissionRoleEntity<PermissionRoleEntity>> roleEntityConsumer =
-                roleService.selectByPk(menuGroupEntity.getId()) == null ? roleService::insert : roleService::update;
+                roleService.selectByPk(menuGroupEntity.getId()) == null
+                        ? roleService::insert
+                        : roleService::update;
 
         //设置属性
         BindPermissionRoleEntity<PermissionRoleEntity> roleEntity = entityFactory.newInstance(BindPermissionRoleEntity.class);
@@ -174,7 +180,7 @@ public class SimpleMenuGroupService
                                 //转换 MenuGroupBindEntity 为PermissionRoleEntity
                                 PermissionRoleEntity permission = entityFactory.newInstance(PermissionRoleEntity.class, bind);
                                 permission.setRoleId(bind.getGroupId());
-                                MenuEntity<? extends MenuEntity> menuEntity = menuService.selectByPk(bind.getMenuId());
+                                MenuEntity menuEntity = menuService.selectByPk(bind.getMenuId());
                                 assertNotNull(menuEntity, "menu " + bind.getMenuId() + " not found");
                                 permission.setPermissionId(menuEntity.getPermissionId());
                                 return permission;

+ 5 - 5
hsweb-system/hsweb-system-menu/hsweb-system-menu-service/hsweb-system-menu-service-simple/src/main/java/org/hswebframework/web/service/menu/simple/SimpleMenuService.java

@@ -39,7 +39,7 @@ import java.util.List;
 @Service("menuService")
 @CacheConfig(cacheNames = CacheConstants.MENU_CACHE_NAME)
 public class SimpleMenuService
-        extends AbstractTreeSortService<MenuEntity<MenuEntity>, String>
+        extends AbstractTreeSortService<MenuEntity, String>
         implements MenuService {
 
     private MenuDao menuDao;
@@ -61,13 +61,13 @@ public class SimpleMenuService
 
     @Override
     @CacheEvict(allEntries = true)
-    public int updateByPk(List<MenuEntity<MenuEntity>> data) {
+    public int updateByPk(List<MenuEntity> data) {
         return super.updateByPk(data);
     }
 
     @Override
     @CacheEvict(allEntries = true)
-    public String insert(MenuEntity<MenuEntity> entity) {
+    public String insert(MenuEntity entity) {
         return super.insert(entity);
     }
 
@@ -79,13 +79,13 @@ public class SimpleMenuService
 
     @Override
     @Cacheable(key = "'permission-ids:'+#permissionId==null?'0':#permissionId.hashCode()")
-    public List<MenuEntity<MenuEntity>> getByPermissionId(List<String> permissionId) {
+    public List<MenuEntity> getByPermissionId(List<String> permissionId) {
         return createQuery().noPaging().where().in("permissionId", permissionId).list();
     }
 
     @Override
     @Cacheable(key = "'permission-id:'+#permissionId")
-    public MenuEntity<MenuEntity> getByPermissionId(String permissionId) {
+    public MenuEntity getByPermissionId(String permissionId) {
         return createQuery().noPaging().where().is("permissionId", permissionId).single();
     }
 }

+ 5 - 5
hsweb-system/hsweb-system-menu/hsweb-system-menu-starter/src/test/java/org/hswebframework/web/starter/menu/MenuTests.java

@@ -47,18 +47,18 @@ public class MenuTests extends SimpleWebApplicationTests {
         sqlExecutor.delete("delete from s_menu");
     }
 
-    public MenuEntity<MenuEntity> createMenu(String name) {
-        MenuEntity<MenuEntity> menuEntity = menuService.createEntity();
+    public MenuEntity createMenu(String name) {
+        MenuEntity menuEntity = menuService.createEntity();
         menuEntity.setName(name);
         return menuEntity;
     }
 
     @Test
     public void testCrud() throws Exception {
-        MenuEntity<MenuEntity> menuEntity = createMenu("测试1");
+        MenuEntity menuEntity = createMenu("测试1");
         menuEntity.setSortIndex(1L);
-        MenuEntity<MenuEntity> child1 = createMenu("测试2");
-        MenuEntity<MenuEntity> child3 = createMenu("测试2");
+        MenuEntity child1 = createMenu("测试2");
+        MenuEntity child3 = createMenu("测试2");
         menuEntity.setChildren(Arrays.asList(child1, child3));
 
         String id = menuService.insert(menuEntity);

+ 3 - 1
hsweb-system/pom.xml

@@ -29,8 +29,10 @@
         <module>hsweb-system-history</module>
         <module>hsweb-system-dictionary</module>
         <module>hsweb-system-document</module>
-        <module>hsweb-system-explorer</module>
+        <module>hsweb-system-menu</module>
         <module>hsweb-system-crawler</module>
+        <module>hsweb-system-oauth2-server</module>
+        <module>hsweb-system-oauth2-client</module>
     </modules>
     <artifactId>hsweb-system</artifactId>
 

+ 0 - 5
pom.xml

@@ -178,11 +178,6 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>ch.qos.logback</groupId>
             <artifactId>logback-classic</artifactId>