Parcourir la source

新增组织架构CRUD

zhouhao il y a 8 ans
Parent
commit
fc18b4e192
60 fichiers modifiés avec 3136 ajouts et 9 suppressions
  1. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-controller/pom.xml
  2. 0 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-dao/hsweb-system-authorization-dao-api/src/main/java/org/hswebframework/web/dao/authorization/PermissionDao.java
  3. 18 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/PermissionEntity.java
  4. 0 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-entity/src/main/java/org/hswebframework/web/entity/authorization/SimplePermissionEntity.java
  5. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/pom.xml
  6. 6 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-simple/src/main/java/org/hswebframework/web/service/authorization/simple/SimplePermissionService.java
  7. 3 3
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/starter/authorization/PermissionTests.java
  8. 8 0
      hsweb-system/hsweb-system-config/hsweb-system-config-controller/src/main/java/org/hswebframework/web/controller/config/ConfigController.java
  9. 6 0
      hsweb-system/hsweb-system-config/hsweb-system-config-service/hsweb-system-config-service-simple/src/main/java/org/hswebframework/web/service/config/simple/SimpleConfigService.java
  10. 9 1
      hsweb-system/hsweb-system-config/hsweb-system-config-starter/src/test/java/org/hswebframework/web/starter/config/ConfigTests.java
  11. 1 1
      hsweb-system/hsweb-system-explorer/hsweb-system-explorer-starter/src/test/java/org/hswebframework/web/starter/explorer/MenuTests.java
  12. 49 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/pom.xml
  13. 52 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/DepartmentController.java
  14. 52 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/OrganizationalController.java
  15. 52 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/PersonController.java
  16. 64 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/PositionController.java
  17. 45 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/pom.xml
  18. 27 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/DepartmentDao.java
  19. 27 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/OrganizationalDao.java
  20. 27 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/PersonDao.java
  21. 34 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/PersonPositionDao.java
  22. 27 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/PositionDao.java
  23. 44 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/pom.xml
  24. 68 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/DepartmentMapper.xml
  25. 69 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/OrganizationalMapper.xml
  26. 68 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/PersonMapper.xml
  27. 55 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/PersonPositionMapper.xml
  28. 68 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/PositionMapper.xml
  29. 36 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/pom.xml
  30. 40 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/pom.xml
  31. 104 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/DepartmentEntity.java
  32. 118 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/OrganizationalEntity.java
  33. 143 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PersonEntity.java
  34. 59 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PersonPositionEntity.java
  35. 28 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PersonUserBindEntity.java
  36. 117 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PositionEntity.java
  37. 105 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimpleDepartmentEntity.java
  38. 138 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimpleOrganizationalEntity.java
  39. 159 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimplePersonEntity.java
  40. 56 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimplePersonPositionEntity.java
  41. 103 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimplePositionEntity.java
  42. 42 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/pom.xml
  43. 32 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/DepartmentService.java
  44. 38 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/OrganizationalService.java
  45. 29 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/PersonService.java
  46. 30 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/PositionService.java
  47. 42 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/pom.xml
  48. 49 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimpleDepartmentService.java
  49. 74 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimpleOrganizationalService.java
  50. 53 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java
  51. 48 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePositionService.java
  52. 34 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/pom.xml
  53. 91 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/pom.xml
  54. 107 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/main/resources/hsweb-starter.js
  55. 87 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/DepartmentTests.java
  56. 86 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/OrganizationalTests.java
  57. 86 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/PersonTests.java
  58. 84 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/PositionTests.java
  59. 13 0
      hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/resources/application.yml
  60. 24 0
      hsweb-system/hsweb-system-organizational/pom.xml

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-controller/pom.xml

@@ -38,7 +38,7 @@
         <dependency>
             <groupId>org.hswebframework</groupId>
             <artifactId>hsweb-expands-security</artifactId>
-            <version>3.0.0-SNAPSHOT</version>
+            <version>${hsweb.expands.version}</version>
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>

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

@@ -1,7 +1,6 @@
 package org.hswebframework.web.dao.authorization;
 
 import org.hswebframework.web.dao.CrudDao;
-import org.hswebframework.web.entity.authorization.ActionEntity;
 import org.hswebframework.web.entity.authorization.PermissionEntity;
 
 /**

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

@@ -1,3 +1,21 @@
+/*
+ *  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.authorization;
 
 import org.hswebframework.web.commons.entity.GenericEntity;

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

@@ -3,7 +3,6 @@ package org.hswebframework.web.entity.authorization;
 import org.hibernate.validator.constraints.NotBlank;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 

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

@@ -15,7 +15,7 @@
         <dependency>
             <groupId>org.hswebframework</groupId>
             <artifactId>hsweb-expands-security</artifactId>
-            <version>3.0.0-SNAPSHOT</version>
+            <version>${hsweb.expands.version}</version>
         </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>

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

@@ -2,6 +2,7 @@ package org.hswebframework.web.service.authorization.simple;
 
 import org.hswebframework.web.dao.authorization.PermissionDao;
 import org.hswebframework.web.entity.authorization.PermissionEntity;
+import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.GenericEntityService;
 import org.hswebframework.web.service.authorization.PermissionService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +19,11 @@ public class SimplePermissionService extends GenericEntityService<PermissionEnti
     @Autowired
     private PermissionDao permissionDao;
 
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+
     @Override
     public PermissionDao getDao() {
         return permissionDao;

+ 3 - 3
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/starter/authorization/PermissionTests.java

@@ -74,11 +74,11 @@ public class PermissionTests extends SimpleWebApplicationTests {
         Assert.assertEquals(data.getName(), entity.getName());
         Assert.assertEquals(data.getStatus(), entity.getStatus());
         Assert.assertNotNull(data.getDataAccess());
-        Assert.assertEquals(data.getDataAccess().get(0).getAction(),dataAccessEntity.getAction());
-        Assert.assertEquals(data.getDataAccess().get(0).getType(),dataAccessEntity.getType());
+        Assert.assertEquals(data.getDataAccess().get(0).getAction(), dataAccessEntity.getAction());
+        Assert.assertEquals(data.getDataAccess().get(0).getType(), dataAccessEntity.getType());
 
         data.setName("测试修改");
-        permissionService.updateByPk(data);
+        permissionService.updateByPk(data.getId(), data);
         PermissionEntity data2 = permissionService.selectByPk("test");
         Assert.assertEquals(data2.getName(), data.getName());
 

+ 8 - 0
hsweb-system/hsweb-system-config/hsweb-system-config-controller/src/main/java/org/hswebframework/web/controller/config/ConfigController.java

@@ -21,10 +21,13 @@ package org.hswebframework.web.controller.config;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.controller.GenericEntityController;
+import org.hswebframework.web.controller.message.ResponseMessage;
 import org.hswebframework.web.entity.config.ConfigEntity;
 import org.hswebframework.web.logging.AccessLogger;
 import org.hswebframework.web.service.config.ConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -50,4 +53,9 @@ public class ConfigController implements GenericEntityController<ConfigEntity, S
     public ConfigService getService() {
         return configService;
     }
+
+    @Override
+    public ResponseMessage updateByPrimaryKey(@PathVariable String id, @RequestBody ConfigEntity data) {
+        return GenericEntityController.super.updateByPrimaryKey(id, data);
+    }
 }

+ 6 - 0
hsweb-system/hsweb-system-config/hsweb-system-config-service/hsweb-system-config-service-simple/src/main/java/org/hswebframework/web/service/config/simple/SimpleConfigService.java

@@ -20,6 +20,7 @@ package org.hswebframework.web.service.config.simple;
 
 import org.hswebframework.web.dao.config.ConfigDao;
 import org.hswebframework.web.entity.config.ConfigEntity;
+import org.hswebframework.web.id.IDGenerator;
 import org.hswebframework.web.service.GenericEntityService;
 import org.hswebframework.web.service.config.ConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +38,11 @@ public class SimpleConfigService extends GenericEntityService<ConfigEntity, Stri
     @Autowired
     private ConfigDao configDao;
 
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+
     @Override
     public ConfigDao getDao() {
         return configDao;

+ 9 - 1
hsweb-system/hsweb-system-config/hsweb-system-config-starter/src/test/java/org/hswebframework/web/starter/config/ConfigTests.java

@@ -70,6 +70,14 @@ public class ConfigTests extends SimpleWebApplicationTests {
                 .getObject(0, SimpleConfigEntity.class)
                 .get("test")
                 .getNumber(0).intValue(), 1);
+
+        jsonObject = testPut("/config/" + configBean.getId())
+                .setUp(builder -> builder.accept(MediaType.APPLICATION_JSON)
+                        .contentType(MediaType.APPLICATION_JSON)
+                        .content(jsonStr)
+                )
+                .exec().resultAsJson();
+        Assert.assertEquals(200, jsonObject.get("status"));
     }
 
     @Test
@@ -90,7 +98,7 @@ public class ConfigTests extends SimpleWebApplicationTests {
         configBean = configService.selectSingle(QueryParamEntity.empty());
         configBean.addContent("test2", "2", "");
         //test update
-        Assert.assertEquals(configService.updateByPk(configBean), 1);
+        Assert.assertEquals(configService.updateByPk(configBean.getId(), configBean), 1);
         Assert.assertEquals(configBean.get("test2").getNumber(0).intValue(), 2);
         configBean = configService.selectSingle(QueryParamEntity.empty());
         //test delete

+ 1 - 1
hsweb-system/hsweb-system-explorer/hsweb-system-explorer-starter/src/test/java/org/hswebframework/web/starter/explorer/MenuTests.java

@@ -57,7 +57,7 @@ public class MenuTests extends SimpleWebApplicationTests {
     @Test
     public void testCrud() throws Exception {
         MenuEntity<MenuEntity> menuEntity = createMenu("测试1", "C", "R");
-        menuEntity.setSortIndex(1);
+        menuEntity.setSortIndex(1L);
         MenuEntity<MenuEntity> child1 = createMenu("测试2", "C", "R");
         MenuEntity<MenuEntity> child3 = createMenu("测试2", "C", "R");
         menuEntity.setChildren(Arrays.asList(child1, child3));

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

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

+ 52 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/DepartmentController.java

@@ -0,0 +1,52 @@
+/*
+ *  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.controller.organizational;
+
+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.organizational.DepartmentEntity;
+import org.hswebframework.web.logging.AccessLogger;
+import org.hswebframework.web.service.organizational.DepartmentService;
+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.department:department}")
+@Authorize(permission = "department")
+@AccessLogger("部门管理")
+public class DepartmentController implements GenericEntityController<DepartmentEntity, String, QueryParamEntity> {
+
+    private DepartmentService departmentService;
+
+    @Autowired
+    public void setDepartmentService(DepartmentService departmentService) {
+        this.departmentService = departmentService;
+    }
+
+    @Override
+    public DepartmentService getService() {
+        return departmentService;
+    }
+}

+ 52 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/OrganizationalController.java

@@ -0,0 +1,52 @@
+/*
+ *  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.controller.organizational;
+
+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.organizational.OrganizationalEntity;
+import org.hswebframework.web.logging.AccessLogger;
+import org.hswebframework.web.service.organizational.OrganizationalService;
+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.organizational:organizational}")
+@Authorize(permission = "organizational")
+@AccessLogger("组织管理")
+public class OrganizationalController implements GenericEntityController<OrganizationalEntity, String, QueryParamEntity> {
+
+    private OrganizationalService organizationalService;
+
+    @Autowired
+    public void setOrganizationalService(OrganizationalService organizationalService) {
+        this.organizationalService = organizationalService;
+    }
+
+    @Override
+    public OrganizationalService getService() {
+        return organizationalService;
+    }
+}

+ 52 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/PersonController.java

@@ -0,0 +1,52 @@
+/*
+ *  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.controller.organizational;
+
+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.organizational.PersonEntity;
+import org.hswebframework.web.logging.AccessLogger;
+import org.hswebframework.web.service.organizational.PersonService;
+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.person:person}")
+@Authorize(permission = "person")
+@AccessLogger("人员")
+public class PersonController implements GenericEntityController<PersonEntity, String, QueryParamEntity> {
+
+    private PersonService personService;
+
+    @Autowired
+    public void setPersonService(PersonService personService) {
+        this.personService = personService;
+    }
+
+    @Override
+    public PersonService getService() {
+        return personService;
+    }
+}

+ 64 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-controller/src/main/java/org/hswebframework/web/controller/organizational/PositionController.java

@@ -0,0 +1,64 @@
+/*
+ *  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.controller.organizational;
+
+import org.hswebframework.web.authorization.Permission;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.authorization.annotation.RequiresDataAccess;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.controller.GenericEntityController;
+import org.hswebframework.web.controller.QueryController;
+import org.hswebframework.web.controller.message.ResponseMessage;
+import org.hswebframework.web.entity.organizational.PositionEntity;
+import org.hswebframework.web.logging.AccessLogger;
+import org.hswebframework.web.service.organizational.PositionService;
+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.position:position}")
+@Authorize(permission = "position")
+@AccessLogger("职位管理")
+public class PositionController implements GenericEntityController<PositionEntity, String, QueryParamEntity> {
+
+    private PositionService positionService;
+
+    @Autowired
+    public void setPositionService(PositionService positionService) {
+        this.positionService = positionService;
+    }
+
+    @Override
+    public PositionService getService() {
+        return positionService;
+    }
+
+    @Override
+    @RequiresDataAccess(permission = "position", action = Permission.ACTION_QUERY)
+    public ResponseMessage list(QueryParamEntity param) {
+        return GenericEntityController.super.list(param);
+    }
+
+
+}

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

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

+ 27 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/DepartmentDao.java

@@ -0,0 +1,27 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.organizational.DepartmentEntity;
+
+/**
+*  部门 DAO接口
+*  @author hsweb-generator-online
+ */
+public interface DepartmentDao extends CrudDao<DepartmentEntity,String> {
+}

+ 27 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/OrganizationalDao.java

@@ -0,0 +1,27 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.organizational.OrganizationalEntity;
+
+/**
+*  组织 DAO接口
+*  @author hsweb-generator-online
+ */
+public interface OrganizationalDao extends CrudDao<OrganizationalEntity,String> {
+}

+ 27 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/PersonDao.java

@@ -0,0 +1,27 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.organizational.PersonEntity;
+
+/**
+*  人员 DAO接口
+*  @author hsweb-generator-online
+ */
+public interface PersonDao extends CrudDao<PersonEntity,String> {
+}

+ 34 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/PersonPositionDao.java

@@ -0,0 +1,34 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.dao.InsertDao;
+import org.hswebframework.web.dao.dynamic.QueryByEntityDao;
+import org.hswebframework.web.entity.organizational.PersonPositionEntity;
+
+/**
+ * 人员职位关联 DAO接口
+ *
+ * @author hsweb-generator-online
+ */
+public interface PersonPositionDao extends InsertDao<PersonPositionEntity>
+        , QueryByEntityDao<PersonPositionEntity> {
+
+    int deleteByPersonId(String personId);
+
+    int deleteByPositionId(String position);
+}

+ 27 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-api/src/main/java/org/hswebframework/web/dao/organizational/PositionDao.java

@@ -0,0 +1,27 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.dao.CrudDao;
+import org.hswebframework.web.entity.organizational.PositionEntity;
+
+/**
+*  职位 DAO接口
+*  @author hsweb-generator-online
+ */
+public interface PositionDao extends CrudDao<PositionEntity,String> {
+}

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

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

+ 68 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/DepartmentMapper.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Copyright 2016 http://www.hswebframework.org
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.organizational.DepartmentDao">
+    <resultMap id="DepartmentResultMap" type="org.hswebframework.web.entity.organizational.SimpleDepartmentEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+            <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
+            <result property="orgId" column="org_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="code" column="code" javaType="String" jdbcType="VARCHAR"/>
+            <result property="parentId" column="parent_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="treeCode" column="tree_code" javaType="String" jdbcType="VARCHAR"/>
+            <result property="sortIndex" column="sort_index" javaType="Long" jdbcType="DECIMAL"/>
+            <result property="enabled" column="enabled" javaType="Boolean" jdbcType="DECIMAL"/>
+            <result property="level" column="level" javaType="Integer" jdbcType="DECIMAL"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'DepartmentResultMap'"/>
+        <bind name="tableName" value="'s_department'"/>
+    </sql>
+  
+    <insert id="insert" parameterType="org.hswebframework.web.entity.organizational.SimpleDepartmentEntity" >
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_department 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="DepartmentResultMap">
+        <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>

+ 69 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/OrganizationalMapper.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Copyright 2016 http://www.hswebframework.org
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.organizational.OrganizationalDao">
+    <resultMap id="OrganizationalResultMap" type="org.hswebframework.web.entity.organizational.SimpleOrganizationalEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+            <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
+            <result property="fullName" column="full_name" javaType="String" jdbcType="VARCHAR"/>
+            <result property="code" column="code" javaType="String" jdbcType="VARCHAR"/>
+            <result property="optionalRoles" column="optional_roles" javaType="java.util.List" jdbcType="CLOB"/>
+            <result property="parentId" column="parent_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="treeCode" column="tree_code" javaType="String" jdbcType="VARCHAR"/>
+            <result property="sortIndex" column="sort_index" javaType="Long" jdbcType="DECIMAL"/>
+            <result property="enabled" column="enabled" javaType="Boolean" jdbcType="DECIMAL"/>
+            <result property="level" column="level" javaType="Integer" jdbcType="DECIMAL"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'OrganizationalResultMap'"/>
+        <bind name="tableName" value="'S_ORGANIZATION'"/>
+    </sql>
+  
+    <insert id="insert" parameterType="org.hswebframework.web.entity.organizational.SimpleOrganizationalEntity" >
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from S_ORGANIZATION 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="OrganizationalResultMap">
+        <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>

+ 68 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/PersonMapper.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Copyright 2016 http://www.hswebframework.org
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.organizational.PersonDao">
+    <resultMap id="PersonResultMap" type="org.hswebframework.web.entity.organizational.SimplePersonEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+            <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
+            <result property="sex" column="sex" javaType="Byte" jdbcType="DECIMAL"/>
+            <result property="email" column="email" javaType="String" jdbcType="VARCHAR"/>
+            <result property="phone" column="phone" javaType="String" jdbcType="VARCHAR"/>
+            <result property="photo" column="photo" javaType="String" jdbcType="VARCHAR"/>
+            <result property="userId" column="user_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="status" column="status" javaType="Byte" jdbcType="DECIMAL"/>
+            <result property="remark" column="remark" javaType="String" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'PersonResultMap'"/>
+        <bind name="tableName" value="'s_person'"/>
+    </sql>
+  
+    <insert id="insert" parameterType="org.hswebframework.web.entity.organizational.SimplePersonEntity" >
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_person 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="PersonResultMap">
+        <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>

+ 55 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/PersonPositionMapper.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Copyright 2016 http://www.hswebframework.org
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.organizational.PersonPositionDao">
+    <resultMap id="PersonPositionResultMap" type="org.hswebframework.web.entity.organizational.SimplePersonPositionEntity">
+        <result property="personId" column="person_id" javaType="String" jdbcType="VARCHAR"/>
+        <result property="positionId" column="position_id" javaType="String" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'PersonPositionResultMap'"/>
+        <bind name="tableName" value="'s_person_position'"/>
+    </sql>
+
+    <insert id="insert" parameterType="org.hswebframework.web.entity.organizational.SimplePersonPositionEntity">
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPersonId" parameterType="String">
+        delete from s_person_position where person_id=#{personId}
+    </delete>
+
+    <delete id="deleteByPositionId">
+        delete from s_person_position where position_id=#{positionId}
+    </delete>
+
+    <select id="query" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="PersonPositionResultMap">
+        <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>

+ 68 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-dao/hsweb-system-organizational-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/organizational/PositionMapper.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Copyright 2016 http://www.hswebframework.org
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.hswebframework.web.dao.organizational.PositionDao">
+    <resultMap id="PositionResultMap" type="org.hswebframework.web.entity.organizational.SimplePositionEntity">
+        <id property="id" column="u_id" javaType="string" jdbcType="VARCHAR"/>
+            <result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
+            <result property="departmentId" column="department_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="roles" column="roles" javaType="String" jdbcType="CLOB"/>
+            <result property="remark" column="remark" javaType="String" jdbcType="VARCHAR"/>
+            <result property="parentId" column="parent_id" javaType="String" jdbcType="VARCHAR"/>
+            <result property="treeCode" column="tree_code" javaType="String" jdbcType="VARCHAR"/>
+            <result property="sortIndex" column="sort_index" javaType="Long" jdbcType="DECIMAL"/>
+            <result property="level" column="level" javaType="Integer" jdbcType="DECIMAL"/>
+    </resultMap>
+
+    <!--用于动态生成sql所需的配置-->
+    <sql id="config">
+        <bind name="resultMapId" value="'PositionResultMap'"/>
+        <bind name="tableName" value="'s_position'"/>
+    </sql>
+  
+    <insert id="insert" parameterType="org.hswebframework.web.entity.organizational.SimplePositionEntity" >
+        <include refid="config"/>
+        <include refid="BasicMapper.buildInsertSql"/>
+    </insert>
+
+    <delete id="deleteByPk" parameterType="String">
+        delete from s_position 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="PositionResultMap">
+        <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>

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

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

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

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

+ 104 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/DepartmentEntity.java

@@ -0,0 +1,104 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+import org.hswebframework.web.commons.entity.TreeSortSupportEntity;
+
+/**
+ * 部门 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface DepartmentEntity extends TreeSortSupportEntity<String> {
+ /*-------------------------------------------
+    |               属性名常量               |
+    ===========================================*/
+    /**
+     * 名称
+     */
+    String name      = "name";
+    /**
+     * 所在组织id
+     */
+    String orgid     = "orgid";
+    /**
+     * 部门编码
+     */
+    String code      = "code";
+    /**
+     * 父级id
+     */
+    String parentId  = "parentId";
+    /**
+     * 树结构编码
+     */
+    String treeCode  = "treeCode";
+    /**
+     * 排序序号
+     */
+    String sortIndex = "sortIndex";
+    /**
+     * 是否启用
+     */
+    String enabled   = "enabled";
+    /**
+     * 级别
+     */
+    String level     = "level";
+
+    /**
+     * @return 名称
+     */
+    String getName();
+
+    /**
+     * 设置 名称
+     */
+    void setName(String name);
+
+    /**
+     * @return 所在组织id
+     */
+    String getOrgId();
+
+    /**
+     * 设置 所在组织id
+     */
+    void setOrgId(String orgId);
+
+    /**
+     * @return 部门编码
+     */
+    String getCode();
+
+    /**
+     * 设置 部门编码
+     */
+    void setCode(String code);
+
+    /**
+     * @return 是否启用
+     */
+    Boolean isEnabled();
+
+    /**
+     * 设置 是否启用
+     */
+    void setEnabled(Boolean enabled);
+
+}

+ 118 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/OrganizationalEntity.java

@@ -0,0 +1,118 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.TreeSortSupportEntity;
+
+/**
+ * 组织 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface OrganizationalEntity extends TreeSortSupportEntity<String> {
+ /*-------------------------------------------
+    |               属性名常量               |
+    ===========================================*/
+    /**
+     * 名称
+     */
+    String name          = "name";
+    /**
+     * 全称
+     */
+    String fullName      = "fullName";
+    /**
+     * 机构编码
+     */
+    String code          = "code";
+    /**
+     * 可选角色
+     */
+    String optionalRoles = "optionalRoles";
+    /**
+     * 上级机构id
+     */
+    String parentId      = "parentId";
+    /**
+     * 树定位码
+     */
+    String treeCode      = "treeCode";
+    /**
+     * 树结构编码
+     */
+    String sortIndex     = "sortIndex";
+    /**
+     * 是否启用
+     */
+    String enabled       = "enabled";
+    /**
+     * 级别
+     */
+    String level         = "level";
+
+    /**
+     * @return 名称
+     */
+    String getName();
+
+    /**
+     * 设置 名称
+     */
+    void setName(String name);
+
+    /**
+     * @return 全称
+     */
+    String getFullName();
+
+    /**
+     * 设置 全称
+     */
+    void setFullName(String fullName);
+
+    /**
+     * @return 机构编码
+     */
+    String getCode();
+
+    /**
+     * 设置 机构编码
+     */
+    void setCode(String code);
+
+    /**
+     * @return 可选角色
+     */
+    java.util.List<String> getOptionalRoles();
+
+    /**
+     * 设置 可选角色
+     */
+    void setOptionalRoles(java.util.List<String> optionalRoles);
+
+    /**
+     * @return 是否启用
+     */
+    Boolean isEnabled();
+
+    /**
+     * 设置 是否启用
+     */
+    void setEnabled(Boolean enabled);
+
+
+}

+ 143 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PersonEntity.java

@@ -0,0 +1,143 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+
+/**
+ * 人员 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface PersonEntity extends GenericEntity<String> {
+  /*------------------------------------------
+    |               属性名常量               |
+    =========================================*/
+    /**
+     * 姓名
+     */
+    String name   = "name";
+    /**
+     * 性别
+     */
+    String sex    = "sex";
+    /**
+     * 电子邮箱
+     */
+    String email  = "email";
+    /**
+     * 联系电话
+     */
+    String phone  = "phone";
+    /**
+     * 照片
+     */
+    String photo  = "photo";
+    /**
+     * 关联用户id
+     */
+    String userId = "userId";
+    /**
+     * 状态
+     */
+    String status = "status";
+    /**
+     * 备注
+     */
+    String remark = "remark";
+
+    /**
+     * @return 姓名
+     */
+    String getName();
+
+    /**
+     * 设置 姓名
+     */
+    void setName(String name);
+
+    /**
+     * @return 性别
+     */
+    Byte getSex();
+
+    /**
+     * 设置 性别
+     */
+    void setSex(Byte sex);
+
+    /**
+     * @return 电子邮箱
+     */
+    String getEmail();
+
+    /**
+     * 设置 电子邮箱
+     */
+    void setEmail(String email);
+
+    /**
+     * @return 联系电话
+     */
+    String getPhone();
+
+    /**
+     * 设置 联系电话
+     */
+    void setPhone(String phone);
+
+    /**
+     * @return 照片
+     */
+    String getPhoto();
+
+    /**
+     * 设置 照片
+     */
+    void setPhoto(String photo);
+
+    /**
+     * @return 关联用户id
+     */
+    String getUserId();
+
+    /**
+     * 设置 关联用户id
+     */
+    void setUserId(String userId);
+
+    /**
+     * @return 状态
+     */
+    Byte getStatus();
+
+    /**
+     * 设置 状态
+     */
+    void setStatus(Byte status);
+
+    /**
+     * @return 备注
+     */
+    String getRemark();
+
+    /**
+     * 设置 备注
+     */
+    void setRemark(String remark);
+
+}

+ 59 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PersonPositionEntity.java

@@ -0,0 +1,59 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.Entity;
+
+/**
+ * 人员职位关联 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface PersonPositionEntity extends Entity {
+ /*-------------------------------------------
+    |               属性名常量               |
+    ===========================================*/
+    /**
+     * 人员id
+     */
+    String personId   = "personId";
+    /**
+     * 职位id
+     */
+    String positionId = "positionId";
+
+    /**
+     * @return 人员id
+     */
+    String getPersonId();
+
+    /**
+     * 设置 人员id
+     */
+    void setPersonId(String personId);
+
+    /**
+     * @return 职位id
+     */
+    String getPositionId();
+
+    /**
+     * 设置 职位id
+     */
+    void setPositionId(String positionId);
+
+}

+ 28 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PersonUserBindEntity.java

@@ -0,0 +1,28 @@
+/*
+ *  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.organizational;
+
+/**
+ * TODO 完成注释
+ *
+ * @author zhouhao
+ */
+public interface PersonUserBindEntity extends PersonEntity {
+
+}

+ 117 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/PositionEntity.java

@@ -0,0 +1,117 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.TreeSortSupportEntity;
+import org.hswebframework.web.commons.entity.TreeSupportEntity;
+
+import java.util.List;
+
+/**
+ * 职位 实体
+ *
+ * @author hsweb-generator-online
+ */
+public interface PositionEntity extends TreeSortSupportEntity<String> {
+ /*-------------------------------------------
+    |               属性名常量               |
+    ===========================================*/
+    /**
+     * 职位名称
+     */
+    String name         = "name";
+    /**
+     * 部门id
+     */
+    String departmentId = "departmentId";
+    /**
+     * 持有的角色
+     */
+    String roles        = "roles";
+    /**
+     * 备注
+     */
+    String remark       = "remark";
+    /**
+     * 父级id
+     */
+    String parentId     = "parentId";
+    /**
+     * 树结构编码
+     */
+    String treeCode     = "treeCode";
+    /**
+     * 排序索引
+     */
+    String sortIndex    = "sortIndex";
+    /**
+     * 级别
+     */
+    String level        = "level";
+
+    /**
+     * @return 职位名称
+     */
+    String getName();
+
+    /**
+     * 设置 职位名称
+     */
+    void setName(String name);
+
+    /**
+     * @return 部门id
+     */
+    String getDepartmentId();
+
+    /**
+     * 设置 部门id
+     */
+    void setDepartmentId(String departmentId);
+
+    /**
+     * @return 持有的角色
+     */
+    List<String> getRoles();
+
+    /**
+     * 设置 持有的角色
+     */
+    void setRoles(List<String> roles);
+
+    /**
+     * @return 备注
+     */
+    String getRemark();
+
+    /**
+     * 设置 备注
+     */
+    void setRemark(String remark);
+
+    /**
+     * @return 排序索引
+     */
+    Long getSortIndex();
+
+    /**
+     * 设置 排序索引
+     */
+    void setSortIndex(Long sortIndex);
+
+
+}

+ 105 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimpleDepartmentEntity.java

@@ -0,0 +1,105 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
+
+import java.util.List;
+
+/**
+ * 部门
+ *
+ * @author hsweb-generator-online
+ */
+public class SimpleDepartmentEntity extends SimpleTreeSortSupportEntity<String> implements DepartmentEntity {
+    //名称
+    private String  name;
+    //所在组织id
+    private String  orgId;
+    //部门编码
+    private String  code;
+    //是否启用
+    private Boolean enabled;
+
+    private List<SimpleDepartmentEntity> children;
+
+    /**
+     * @return 名称
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * 设置 名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return 所在组织id
+     */
+    public String getOrgId() {
+        return this.orgId;
+    }
+
+    /**
+     * 设置 所在组织id
+     */
+    public void setOrgId(String orgId) {
+        this.orgId = orgId;
+    }
+
+    /**
+     * @return 部门编码
+     */
+    public String getCode() {
+        return this.code;
+    }
+
+    /**
+     * 设置 部门编码
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * @return 是否启用
+     */
+    public Boolean isEnabled() {
+        return this.enabled;
+    }
+
+    /**
+     * 设置 是否启用
+     */
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public List<SimpleDepartmentEntity> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<SimpleDepartmentEntity> children) {
+        this.children = children;
+    }
+}

+ 138 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimpleOrganizationalEntity.java

@@ -0,0 +1,138 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
+import org.hswebframework.web.commons.entity.TreeSupportEntity;
+
+import java.util.List;
+
+/**
+ * 组织
+ *
+ * @author hsweb-generator-online
+ */
+public class SimpleOrganizationalEntity extends SimpleTreeSortSupportEntity<String> implements OrganizationalEntity {
+    //名称
+    private String                           name;
+    //全称
+    private String                           fullName;
+    //机构编码
+    private String                           code;
+    //可选角色
+    private java.util.List<String>           optionalRoles;
+    //是否启用
+    private Boolean                          enabled;
+    //子级组织
+    private List<SimpleOrganizationalEntity> children;
+
+    /**
+     * @return 名称
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * 设置 名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return 全称
+     */
+    public String getFullName() {
+        return this.fullName;
+    }
+
+    /**
+     * 设置 全称
+     */
+    public void setFullName(String fullName) {
+        this.fullName = fullName;
+    }
+
+    /**
+     * @return 机构编码
+     */
+    public String getCode() {
+        return this.code;
+    }
+
+    /**
+     * 设置 机构编码
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * @return 可选角色
+     */
+    public java.util.List<String> getOptionalRoles() {
+        return this.optionalRoles;
+    }
+
+    /**
+     * 设置 可选角色
+     */
+    public void setOptionalRoles(java.util.List<String> optionalRoles) {
+        this.optionalRoles = optionalRoles;
+    }
+
+    /**
+     * @return 上级机构id
+     */
+    public String getParentId() {
+        return this.parentId;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public List<SimpleOrganizationalEntity> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<SimpleOrganizationalEntity> children) {
+        this.children = children;
+    }
+
+    /**
+     * @return 树定位码
+     */
+    public String getTreeCode() {
+        return this.treeCode;
+    }
+
+
+    /**
+     * @return 是否启用
+     */
+    public Boolean isEnabled() {
+        return this.enabled;
+    }
+
+    /**
+     * 设置 是否启用
+     */
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+}

+ 159 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimplePersonEntity.java

@@ -0,0 +1,159 @@
+/*
+ *  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.organizational;
+
+import org.hibernate.validator.constraints.Email;
+import org.hibernate.validator.constraints.NotBlank;
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+/**
+ * 人员
+ *
+ * @author hsweb-generator-online
+ */
+public class SimplePersonEntity extends SimpleGenericEntity<String> implements PersonEntity {
+    //姓名
+    @NotBlank
+    private String name;
+    //性别
+    private Byte   sex;
+    //电子邮箱
+    @Email
+    private String email;
+    //联系电话
+    private String phone;
+    //照片
+    private String photo;
+    //关联用户id
+    private String userId;
+    //状态
+    private Byte   status;
+    //备注
+    private String remark;
+
+    /**
+     * @return 姓名
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * 设置 姓名
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return 性别
+     */
+    public Byte getSex() {
+        return this.sex;
+    }
+
+    /**
+     * 设置 性别
+     */
+    public void setSex(Byte sex) {
+        this.sex = sex;
+    }
+
+    /**
+     * @return 电子邮箱
+     */
+    public String getEmail() {
+        return this.email;
+    }
+
+    /**
+     * 设置 电子邮箱
+     */
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    /**
+     * @return 联系电话
+     */
+    public String getPhone() {
+        return this.phone;
+    }
+
+    /**
+     * 设置 联系电话
+     */
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    /**
+     * @return 照片
+     */
+    public String getPhoto() {
+        return this.photo;
+    }
+
+    /**
+     * 设置 照片
+     */
+    public void setPhoto(String photo) {
+        this.photo = photo;
+    }
+
+    /**
+     * @return 关联用户id
+     */
+    public String getUserId() {
+        return this.userId;
+    }
+
+    /**
+     * 设置 关联用户id
+     */
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * @return 状态
+     */
+    public Byte getStatus() {
+        return this.status;
+    }
+
+    /**
+     * 设置 状态
+     */
+    public void setStatus(Byte status) {
+        this.status = status;
+    }
+
+    /**
+     * @return 备注
+     */
+    public String getRemark() {
+        return this.remark;
+    }
+
+    /**
+     * 设置 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 56 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimplePersonPositionEntity.java

@@ -0,0 +1,56 @@
+/*
+ *  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.organizational;
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+
+/**
+* 人员职位关联
+* @author hsweb-generator-online
+*/
+public class SimplePersonPositionEntity extends SimpleGenericEntity<String> implements PersonPositionEntity{
+  		//人员id
+        private String personId;
+  		//职位id
+        private String positionId;
+
+        /**
+        * @return  人员id
+        */
+        public String getPersonId(){
+			return this.personId;
+        }
+
+        /**
+        * 设置 人员id
+        */
+        public void setPersonId(String personId){
+        	this.personId=personId;
+        }
+        /**
+        * @return  职位id
+        */
+        public String getPositionId(){
+			return this.positionId;
+        }
+
+        /**
+        * 设置 职位id
+        */
+        public void setPositionId(String positionId){
+        	this.positionId=positionId;
+        }
+}

+ 103 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-entity/src/main/java/org/hswebframework/web/entity/organizational/SimplePositionEntity.java

@@ -0,0 +1,103 @@
+/*
+ *  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.organizational;
+
+import org.hswebframework.web.commons.entity.SimpleGenericEntity;
+import org.hswebframework.web.commons.entity.SimpleTreeSortSupportEntity;
+import org.hswebframework.web.commons.entity.TreeSupportEntity;
+
+import java.util.List;
+
+/**
+ * 职位
+ *
+ * @author hsweb-generator-online
+ */
+public class SimplePositionEntity extends SimpleTreeSortSupportEntity<String> implements PositionEntity {
+    //职位名称
+    private String       name;
+    //部门id
+    private String       departmentId;
+    //持有的角色
+    private List<String> roles;
+    //备注
+    private String       remark;
+
+    private List<SimplePositionEntity> children;
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public List<SimplePositionEntity> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<SimplePositionEntity> children) {
+        this.children = children;
+    }
+
+    /**
+     * @return 职位名称
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * 设置 职位名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return 部门id
+     */
+    public String getDepartmentId() {
+        return this.departmentId;
+    }
+
+    /**
+     * 设置 部门id
+     */
+    public void setDepartmentId(String departmentId) {
+        this.departmentId = departmentId;
+    }
+
+    @Override
+    public List<String> getRoles() {
+        return roles;
+    }
+
+    @Override
+    public void setRoles(List<String> roles) {
+        this.roles = roles;
+    }
+
+    /**
+     * @return 备注
+     */
+    public String getRemark() {
+        return this.remark;
+    }
+
+    /**
+     * 设置 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

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

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

+ 32 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/DepartmentService.java

@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational;
+
+import org.hswebframework.web.entity.organizational.DepartmentEntity;
+import org.hswebframework.web.service.CrudService;
+import org.hswebframework.web.service.TreeService;
+
+/**
+ * 部门 服务类
+ *
+ * @author hsweb-generator-online
+ */
+public interface DepartmentService extends
+        TreeService<DepartmentEntity, String>
+        , CrudService<DepartmentEntity, String> {
+
+}

+ 38 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/OrganizationalService.java

@@ -0,0 +1,38 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational;
+
+import org.hswebframework.web.entity.organizational.OrganizationalEntity;
+import org.hswebframework.web.service.CrudService;
+import org.hswebframework.web.service.TreeService;
+
+import java.util.List;
+
+/**
+ * 组织 服务类
+ *
+ * @author hsweb-generator-online
+ */
+public interface OrganizationalService extends
+        TreeService<OrganizationalEntity, String>
+        , CrudService<OrganizationalEntity, String> {
+
+    List<String> getAllCanUseRoleIds();
+
+    List<String> getCanUseRoleIds(List<String> orgIds);
+
+}

+ 29 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/PersonService.java

@@ -0,0 +1,29 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational;
+
+import org.hswebframework.web.entity.organizational.PersonEntity;
+import org.hswebframework.web.service.CrudService;
+
+/**
+ *  人员 服务类
+ *
+ * @author hsweb-generator-online
+ */
+public interface PersonService extends CrudService<PersonEntity, String> {
+
+}

+ 30 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-api/src/main/java/org/hswebframework/web/service/organizational/PositionService.java

@@ -0,0 +1,30 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational;
+
+import org.hswebframework.web.entity.organizational.PositionEntity;
+import org.hswebframework.web.service.CrudService;
+import org.hswebframework.web.service.TreeService;
+
+/**
+ * 职位 服务类
+ *
+ * @author hsweb-generator-online
+ */
+public interface PositionService extends TreeService<PositionEntity, String>, CrudService<PositionEntity, String> {
+
+}

+ 42 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/pom.xml

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

+ 49 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimpleDepartmentService.java

@@ -0,0 +1,49 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational.simple;
+
+import org.hswebframework.web.dao.organizational.DepartmentDao;
+import org.hswebframework.web.entity.organizational.DepartmentEntity;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.AbstractTreeSortService;
+import org.hswebframework.web.service.GenericEntityService;
+import org.hswebframework.web.service.organizational.DepartmentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 默认的服务实现
+ *
+ * @author hsweb-generator-online
+ */
+@Service("departmentService")
+public class SimpleDepartmentService
+        extends AbstractTreeSortService<DepartmentEntity, String>
+        implements DepartmentService {
+    @Autowired
+    private DepartmentDao departmentDao;
+
+    @Override
+    public DepartmentDao getDao() {
+        return departmentDao;
+    }
+
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+}

+ 74 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimpleOrganizationalService.java

@@ -0,0 +1,74 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational.simple;
+
+import org.hswebframework.web.commons.entity.GenericEntity;
+import org.hswebframework.web.dao.organizational.OrganizationalDao;
+import org.hswebframework.web.entity.organizational.OrganizationalEntity;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.AbstractTreeSortService;
+import org.hswebframework.web.service.GenericEntityService;
+import org.hswebframework.web.service.organizational.OrganizationalService;
+import org.hswebframwork.utils.ListUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 默认的服务实现
+ *
+ * @author hsweb-generator-online
+ */
+@Service("organizationalService")
+public class SimpleOrganizationalService extends AbstractTreeSortService<OrganizationalEntity, String>
+        implements OrganizationalService {
+    @Autowired
+    private OrganizationalDao organizationalDao;
+
+    @Override
+    public OrganizationalDao getDao() {
+        return organizationalDao;
+    }
+
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+
+    @Override
+    public List<String> getAllCanUseRoleIds() {
+        // TODO: 17-3-1
+        return null;
+    }
+
+    @Override
+    public List<String> getCanUseRoleIds(List<String> orgIds) {
+        Assert.notNull(orgIds);
+        if (orgIds.isEmpty()) return new ArrayList<>();
+        return createQuery().where().in(GenericEntity.id, orgIds).listNoPaging()
+                .stream().map(OrganizationalEntity::getOptionalRoles) //得到机构可选角色id集合
+                .filter(Objects::nonNull)
+                .flatMap(List::stream)
+                .collect(Collectors.toList());
+    }
+}

+ 53 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePersonService.java

@@ -0,0 +1,53 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational.simple;
+
+import org.hswebframework.web.dao.organizational.PersonDao;
+import org.hswebframework.web.entity.organizational.PersonEntity;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.GenericEntityService;
+import org.hswebframework.web.service.organizational.PersonService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 默认的服务实现
+ *
+ * @author hsweb-generator-online
+ */
+@Service("personService")
+public class SimplePersonService extends GenericEntityService<PersonEntity, String>
+        implements PersonService {
+    @Autowired
+    private PersonDao personDao;
+
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+
+    @Override
+    public PersonDao getDao() {
+        return personDao;
+    }
+
+
+    @Override
+    public String insert(PersonEntity entity) {
+        return super.insert(entity);
+    }
+}

+ 48 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-service/hsweb-system-organizational-service-simple/src/main/java/org/hswebframework/web/service/organizational/simple/SimplePositionService.java

@@ -0,0 +1,48 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *  
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  
+ */
+package org.hswebframework.web.service.organizational.simple;
+
+import org.hswebframework.web.dao.organizational.PositionDao;
+import org.hswebframework.web.entity.organizational.PositionEntity;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.AbstractTreeSortService;
+import org.hswebframework.web.service.GenericEntityService;
+import org.hswebframework.web.service.organizational.PositionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 默认的服务实现
+ *
+ * @author hsweb-generator-online
+ */
+@Service("positionService")
+public class SimplePositionService extends AbstractTreeSortService<PositionEntity, String>
+        implements PositionService {
+    @Autowired
+    private PositionDao positionDao;
+
+    @Override
+    public PositionDao getDao() {
+        return positionDao;
+    }
+
+    @Override
+    protected IDGenerator<String> getIDGenerator() {
+        return IDGenerator.MD5;
+    }
+}

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

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

+ 91 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/pom.xml

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

+ 107 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/main/resources/hsweb-starter.js

@@ -0,0 +1,107 @@
+/*
+ * 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: "https://github.com/hs-web/hsweb-framework/tree/master/hsweb-system/hsweb-system-organizational",
+    author: "admin@hsweb.me",
+    comment: "组织架构"
+};
+
+//版本更新信息
+var versions = [
+    // {
+    //     version: "3.0.0",
+    //     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_organization")
+        .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(32).commit()
+        .addColumn().name("full_name").alias("fullName").comment("全称").jdbcType(java.sql.JDBCType.VARCHAR).length(256).commit()
+        .addColumn().name("code").alias("code").comment("机构编码").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("optional_roles").alias("optionalRoles").comment("可选角色").jdbcType(java.sql.JDBCType.CLOB).commit()
+        .addColumn().name("parent_id").alias("parentId").comment("上级机构id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("tree_code").alias("treeCode").comment("树定位码").jdbcType(java.sql.JDBCType.VARCHAR).length(1024).commit()
+        .addColumn().name("sort_index").alias("sortIndex").comment("树结构编码").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .addColumn().name("enabled").alias("enabled").comment("是否启用").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .addColumn().name("level").alias("level").comment("级别").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .comment("组织").commit();
+
+    database.createOrAlter("s_department")
+        .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(64).commit()
+        .addColumn().name("org_id").alias("orgId").comment("所在组织id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("code").alias("code").comment("部门编码").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("parent_id").alias("parentId").comment("父级id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("tree_code").alias("treeCode").comment("树结构编码").jdbcType(java.sql.JDBCType.VARCHAR).length(3000).commit()
+        .addColumn().name("sort_index").alias("sortIndex").comment("排序序号").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .addColumn().name("enabled").alias("enabled").comment("是否启用").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .addColumn().name("level").alias("level").comment("级别").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .comment("部门").commit();
+
+    database.createOrAlter("s_position")
+        .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(64).commit()
+        .addColumn().name("department_id").alias("departmentId").comment("部门id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("roles").alias("roles").comment("持有的角色").jdbcType(java.sql.JDBCType.CLOB).commit()
+        .addColumn().name("remark").alias("remark").comment("备注").jdbcType(java.sql.JDBCType.VARCHAR).length(256).commit()
+        .addColumn().name("parent_id").alias("parentId").comment("父级id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("tree_code").alias("treeCode").comment("树结构编码").jdbcType(java.sql.JDBCType.VARCHAR).length(4000).commit()
+        .addColumn().name("sort_index").alias("sortIndex").comment("排序索引").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .addColumn().name("level").alias("level").comment("级别").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
+        .comment("职位").commit();
+
+    database.createOrAlter("s_person")
+        .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(32).commit()
+        .addColumn().name("sex").alias("sex").comment("性别").jdbcType(java.sql.JDBCType.DECIMAL).length(4,0).commit()
+        .addColumn().name("email").alias("email").comment("电子邮箱").jdbcType(java.sql.JDBCType.VARCHAR).length(128).commit()
+        .addColumn().name("phone").alias("phone").comment("联系电话").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("photo").alias("photo").comment("照片").jdbcType(java.sql.JDBCType.VARCHAR).length(128).commit()
+        .addColumn().name("user_id").alias("userId").comment("关联用户id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("status").alias("status").comment("状态").jdbcType(java.sql.JDBCType.DECIMAL).length(32,0).commit()
+        .addColumn().name("remark").alias("remark").comment("备注").jdbcType(java.sql.JDBCType.VARCHAR).length(256).commit()
+        .comment("人员").commit();
+
+    database.createOrAlter("s_person_position")
+        .addColumn().name("person_id").alias("personId").comment("人员id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
+        .addColumn().name("position_id").alias("positionId").comment("职位id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).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) { //卸载时执行
+
+    });

+ 87 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/DepartmentTests.java

@@ -0,0 +1,87 @@
+/*
+ *  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.starter.organizational;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.hswebframework.web.entity.organizational.DepartmentEntity;
+import org.hswebframework.web.entity.organizational.SimpleDepartmentEntity;
+import org.hswebframework.web.starter.convert.FastJsonHttpMessageConverter;
+import org.hswebframework.web.tests.SimpleWebApplicationTests;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+/**
+ * TODO 完善单元测试
+ *
+ * @author hsweb-generator-online
+ */
+public class DepartmentTests extends SimpleWebApplicationTests {
+
+    @Autowired
+    private FastJsonHttpMessageConverter fastJsonHttpMessageConverter;
+
+    @Test
+    public void testCrud() throws Exception {
+        DepartmentEntity entity = entityFactory.newInstance(DepartmentEntity.class);
+        //todo 设置测试属性
+        entity.setName("test");
+        entity.setCode("2");
+
+        // test add data
+        String requestBody = JSON.toJSONString(entity);
+        JSONObject result = testPost("/department").setUp(setup -> setup.contentType(MediaType.APPLICATION_JSON).content(requestBody)).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+        String id = result.getString("data");
+        Assert.assertNotNull(id);
+        entity.setId(id);
+        // test get data
+        result = testGet("/department/" + id).exec().resultAsJson();
+        entity = result.getObject("data", entityFactory.getInstanceType(DepartmentEntity.class));
+
+        Assert.assertEquals(200, result.get("status"));
+        Assert.assertNotNull(result.getJSONObject("data"));
+
+        Assert.assertEquals(fastJsonHttpMessageConverter.converter(entity),
+                fastJsonHttpMessageConverter.converter(result.getObject("data", entityFactory.getInstanceType(DepartmentEntity.class))));
+        //todo 修改测试属性
+        DepartmentEntity newEntity = entityFactory.newInstance(DepartmentEntity.class);
+        newEntity.setName("test");
+
+        result = testPut("/department/" + id)
+                .setUp(setup ->
+                        setup.contentType(MediaType.APPLICATION_JSON)
+                                .content(JSON.toJSONString(newEntity)))
+                .exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/department/" + id).exec().resultAsJson();
+        result = result.getJSONObject("data");
+        Assert.assertNotNull(result);
+
+        result = testDelete("/department/" + id).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/department/" + id).exec().resultAsJson();
+        Assert.assertEquals(404, result.get("status"));
+    }
+}

+ 86 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/OrganizationalTests.java

@@ -0,0 +1,86 @@
+/*
+ *  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.starter.organizational;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.hswebframework.web.entity.organizational.OrganizationalEntity;
+import org.hswebframework.web.entity.organizational.SimpleOrganizationalEntity;
+import org.hswebframework.web.starter.convert.FastJsonHttpMessageConverter;
+import org.hswebframework.web.tests.SimpleWebApplicationTests;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+/**
+ * TODO 完善单元测试
+ *
+ * @author hsweb-generator-online
+ */
+public class OrganizationalTests extends SimpleWebApplicationTests {
+
+    @Autowired
+    private FastJsonHttpMessageConverter fastJsonHttpMessageConverter;
+
+    @Test
+    public void testCrud() throws Exception {
+        OrganizationalEntity entity = entityFactory.newInstance(OrganizationalEntity.class);
+        //todo 设置测试属性
+        entity.setName("test");
+
+        // test add data
+        String requestBody = JSON.toJSONString(entity);
+        JSONObject result = testPost("/department").setUp(setup -> setup.contentType(MediaType.APPLICATION_JSON).content(requestBody)).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+        String id = result.getString("data");
+        Assert.assertNotNull(id);
+        entity.setId(id);
+        // test get data
+        result = testGet("/department/" + id).exec().resultAsJson();
+        entity = result.getObject("data", entityFactory.getInstanceType(OrganizationalEntity.class));
+
+        Assert.assertEquals(200, result.get("status"));
+        Assert.assertNotNull(result.getJSONObject("data"));
+
+        Assert.assertEquals(fastJsonHttpMessageConverter.converter(entity),
+                fastJsonHttpMessageConverter.converter(result.getObject("data", entityFactory.getInstanceType(OrganizationalEntity.class))));
+        //todo 修改测试属性
+        OrganizationalEntity newEntity = entityFactory.newInstance(OrganizationalEntity.class);
+        newEntity.setName("test");
+
+        result = testPut("/department/" + id)
+                .setUp(setup ->
+                        setup.contentType(MediaType.APPLICATION_JSON)
+                                .content(JSON.toJSONString(newEntity)))
+                .exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/department/" + id).exec().resultAsJson();
+        result = result.getJSONObject("data");
+        Assert.assertNotNull(result);
+
+        result = testDelete("/department/" + id).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/department/" + id).exec().resultAsJson();
+        Assert.assertEquals(404, result.get("status"));
+    }
+}

+ 86 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/PersonTests.java

@@ -0,0 +1,86 @@
+/*
+ *  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.starter.organizational;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.hswebframework.web.entity.organizational.PersonEntity;
+import org.hswebframework.web.entity.organizational.SimplePersonEntity;
+import org.hswebframework.web.starter.convert.FastJsonHttpMessageConverter;
+import org.hswebframework.web.tests.SimpleWebApplicationTests;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+/**
+ * TODO 完善单元测试
+ *
+ * @author hsweb-generator-online
+ */
+public class PersonTests extends SimpleWebApplicationTests {
+
+    @Autowired
+    private FastJsonHttpMessageConverter fastJsonHttpMessageConverter;
+
+    @Test
+    public void testCrud() throws Exception {
+        PersonEntity entity = entityFactory.newInstance(PersonEntity.class);
+        //todo 设置测试属性
+        entity.setName("test");
+
+        // test add data
+        String requestBody = JSON.toJSONString(entity);
+        JSONObject result = testPost("/person").setUp(setup -> setup.contentType(MediaType.APPLICATION_JSON).content(requestBody)).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+        String id = result.getString("data");
+        Assert.assertNotNull(id);
+        entity.setId(id);
+        // test get data
+        result = testGet("/person/" + id).exec().resultAsJson();
+        entity = result.getObject("data", entityFactory.getInstanceType(PersonEntity.class));
+
+        Assert.assertEquals(200, result.get("status"));
+        Assert.assertNotNull(result.getJSONObject("data"));
+
+        Assert.assertEquals(fastJsonHttpMessageConverter.converter(entity),
+                fastJsonHttpMessageConverter.converter(result.getObject("data", entityFactory.getInstanceType(PersonEntity.class))));
+        //todo 修改测试属性
+        PersonEntity newEntity = entityFactory.newInstance(PersonEntity.class);
+        newEntity.setName("test2");
+
+        result = testPut("/person/" + id)
+                .setUp(setup ->
+                        setup.contentType(MediaType.APPLICATION_JSON)
+                                .content(JSON.toJSONString(newEntity)))
+                .exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/person/" + id).exec().resultAsJson();
+        result = result.getJSONObject("data");
+        Assert.assertNotNull(result);
+
+        result = testDelete("/person/" + id).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/person/" + id).exec().resultAsJson();
+        Assert.assertEquals(404, result.get("status"));
+    }
+}

+ 84 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/java/org/hswebframework/web/starter/organizational/PositionTests.java

@@ -0,0 +1,84 @@
+/*
+ *  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.starter.organizational;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.hswebframework.web.entity.organizational.PositionEntity;
+import org.hswebframework.web.starter.convert.FastJsonHttpMessageConverter;
+import org.hswebframework.web.tests.SimpleWebApplicationTests;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+/**
+ * TODO 完善单元测试
+ *
+ * @author hsweb-generator-online
+ */
+public class PositionTests extends SimpleWebApplicationTests {
+
+    @Autowired
+    private FastJsonHttpMessageConverter fastJsonHttpMessageConverter;
+
+    @Test
+    public void testCrud() throws Exception {
+       PositionEntity entity = entityFactory.newInstance(PositionEntity.class);
+        //todo 设置测试属性
+        entity.setName("test");
+
+        // test add data
+        String requestBody = JSON.toJSONString(entity);
+        JSONObject result = testPost("/position").setUp(setup -> setup.contentType(MediaType.APPLICATION_JSON).content(requestBody)).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+        String id = result.getString("data");
+        Assert.assertNotNull(id);
+        entity.setId(id);
+        // test get data
+        result = testGet("/position/" + id).exec().resultAsJson();
+        entity = result.getObject("data", entityFactory.getInstanceType(PositionEntity.class));
+
+        Assert.assertEquals(200, result.get("status"));
+        Assert.assertNotNull(result.getJSONObject("data"));
+
+        Assert.assertEquals(fastJsonHttpMessageConverter.converter(entity),
+                fastJsonHttpMessageConverter.converter(result.getObject("data", entityFactory.getInstanceType(PositionEntity.class))));
+        //todo 修改测试属性
+        PositionEntity newEntity = entityFactory.newInstance(PositionEntity.class);
+        newEntity.setName("test");
+
+        result = testPut("/position/" + id)
+                .setUp(setup ->
+                        setup.contentType(MediaType.APPLICATION_JSON)
+                                .content(JSON.toJSONString(newEntity)))
+                .exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/position/" + id).exec().resultAsJson();
+        result = result.getJSONObject("data");
+        Assert.assertNotNull(result);
+
+        result = testDelete("/position/" + id).exec().resultAsJson();
+        Assert.assertEquals(200, result.get("status"));
+
+        result = testGet("/position/" + id).exec().resultAsJson();
+        Assert.assertEquals(404, result.get("status"));
+    }
+}

+ 13 - 0
hsweb-system/hsweb-system-organizational/hsweb-system-organizational-starter/src/test/resources/application.yml

@@ -0,0 +1,13 @@
+spring:
+    aop:
+        auto: true
+    datasource:
+       url : jdbc:h2:mem:org_test_mem
+       username : sa
+       password :
+       type: com.alibaba.druid.pool.DruidDataSource
+       driver-class-name : org.h2.Driver
+hsweb:
+    app:
+      name: 组织架构测试
+      version: 3.0.0

+ 24 - 0
hsweb-system/hsweb-system-organizational/pom.xml

@@ -1,4 +1,21 @@
 <?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">
@@ -10,6 +27,13 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>hsweb-system-organizational</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>hsweb-system-organizational-dao</module>
+        <module>hsweb-system-organizational-service</module>
+        <module>hsweb-system-organizational-controller</module>
+        <module>hsweb-system-organizational-entity</module>
+    </modules>
 
 
 </project>