Browse Source

🎉 2.0.0.RC6

test
smallchill 6 years ago
parent
commit
800f0bf027
  1. 12
      LICENSE
  2. 2
      blade-auth/pom.xml
  3. 2
      blade-common/pom.xml
  4. 2
      blade-gateway/pom.xml
  5. 2
      blade-ops/blade-admin/pom.xml
  6. 2
      blade-ops/blade-develop/pom.xml
  7. 2
      blade-ops/blade-develop/src/main/resources/templates/sword/edit.js.vm
  8. 2
      blade-ops/blade-develop/src/test/resources/templates/sword/edit.js.vm
  9. 2
      blade-ops/pom.xml
  10. 2
      blade-service-api/blade-desk-api/pom.xml
  11. 2
      blade-service-api/blade-dict-api/pom.xml
  12. 2
      blade-service-api/blade-system-api/pom.xml
  13. 6
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java
  14. 6
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java
  15. 2
      blade-service-api/blade-user-api/pom.xml
  16. 4
      blade-service-api/pom.xml
  17. 2
      blade-service/blade-desk/pom.xml
  18. 2
      blade-service/blade-log/pom.xml
  19. 2
      blade-service/blade-system/pom.xml
  20. 12
      blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java
  21. 13
      blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java
  22. 81
      blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java
  23. 3
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.java
  24. 3
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml
  25. 3
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/RoleMapper.java
  26. 3
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/RoleMapper.xml
  27. 3
      blade-service/blade-system/src/main/java/org/springblade/system/service/IDeptService.java
  28. 3
      blade-service/blade-system/src/main/java/org/springblade/system/service/IRoleService.java
  29. 10
      blade-service/blade-system/src/main/java/org/springblade/system/service/ITenantService.java
  30. 4
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java
  31. 4
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java
  32. 58
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java
  33. 2
      blade-service/blade-user/pom.xml
  34. 8
      blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java
  35. 4
      blade-service/pom.xml
  36. 1109
      doc/sql/bladex-oracle.sql
  37. 20
      doc/sql/bladex-saber-mysql.sql
  38. 18
      doc/sql/bladex-sword-mysql.sql
  39. 8
      doc/sql/bladex-tenant-mysql-update-RC5.sql
  40. 6
      pom.xml
  41. 2
      script/docker/.env

12
LICENSE

@ -1,7 +1,7 @@
BladeX商业授权许可协议
一、 知识产权:
BladeX系列产品知识产权归如梦技术团队独立所有
BladeX系列产品知识产权归BladeX团队独立所有
二、 许可:
1. 在您完全接受并遵守本协议的基础上,本协议授予您使用BladeX的某些权利和非独占性许可。
@ -20,14 +20,14 @@ BladeX系列产品知识产权归如梦技术团队独立所有
您在使用本产品或服务时,不得将本产品产品或服务用于任何非法用途或本协议条款、条件和声明禁止的用途。
五、 免责说明:
1. 本产品按“现状”授予许可,您须自行承担使用本产品的风险。如梦技术团队不对此提供任何明示、暗示或任何其它形式的担保和表示。在任何情况下,对于因使用或无法使用本软件而导致的任何损失(包括但不仅限于商业利润损失、业务中断或业务信息丢失),如梦技术团队无需向您或任何第三方负责,即使如梦技术团队已被告知可能会造成此类损失。在任何情况下, 如梦技术团队均不就任何直接的、间接的、附带的、后果性的、特别的、惩戒性的和处罚性的损害赔偿承担任何责任,无论该主张是基于保证、合同、侵权(包括疏忽)或是基于其他原因作出。
1. 本产品按“现状”授予许可,您须自行承担使用本产品的风险。BladeX团队不对此提供任何明示、暗示或任何其它形式的担保和表示。在任何情况下,对于因使用或无法使用本软件而导致的任何损失(包括但不仅限于商业利润损失、业务中断或业务信息丢失),BladeX团队无需向您或任何第三方负责,即使BladeX团队已被告知可能会造成此类损失。在任何情况下, BladeX团队均不就任何直接的、间接的、附带的、后果性的、特别的、惩戒性的和处罚性的损害赔偿承担任何责任,无论该主张是基于保证、合同、侵权(包括疏忽)或是基于其他原因作出。
2. 本产品可能内置有第三方服务,您应自行评估使用这些第三方服务的风险,由使用此类第三方服务而产生的纠纷,全部责任由您自行承担。
3. 如梦技术团队不对使用本产品构建的网站中任何信息内容以及导致的任何版权纠纷、法律争议和后果承担任何责任,全部责任由您自行承担。
4. 如梦技术团队可能会经常提供产品更新或升级,但如梦技术团队没有为根据本协议许可的产品提供维护或更新的责任。
3. BladeX团队不对使用本产品构建的网站中任何信息内容以及导致的任何版权纠纷、法律争议和后果承担任何责任,全部责任由您自行承担。
4. BladeX团队可能会经常提供产品更新或升级,但BladeX团队没有为根据本协议许可的产品提供维护或更新的责任。
六、 权利和所有权的保留:
如梦技术团队保留所有未在本协议中明确授予您的所有权利。如梦技术团队保留随时更新本协议的权利,并只需公示于对应产品项目的LICENSE文件,无需征得您的事先同意且无需另行通知,更新后的内容应于公示即时生效。您可以随时访问产品地址并查阅最新版许可条款,在更新生效后您继续使用本产品则被视作您已接受了新的条款。
BladeX团队保留所有未在本协议中明确授予您的所有权利。BladeX团队保留随时更新本协议的权利,并只需公示于对应产品项目的LICENSE文件,无需征得您的事先同意且无需另行通知,更新后的内容应于公示即时生效。您可以随时访问产品地址并查阅最新版许可条款,在更新生效后您继续使用本产品则被视作您已接受了新的条款。
七、 协议终止
1. 您一旦开始复制、下载、安装或者使用本产品,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的许可权力同时,也受到相关的约束和限制,本协议许可范围以外的行为,将直接违反本协议并构成侵权。
2. 一旦您违反本协议的条款,如梦技术团队随时可能终止本协议、收回许可和授权,并要求您承担相应法律和经济责任。
2. 一旦您违反本协议的条款,BladeX团队随时可能终止本协议、收回许可和授权,并要求您承担相应法律和经济责任。

2
blade-auth/pom.xml

@ -8,7 +8,7 @@
<parent>
<artifactId>BladeX</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<artifactId>blade-auth</artifactId>

2
blade-common/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>BladeX</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-gateway/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>BladeX</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-ops/blade-admin/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-ops</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-ops/blade-develop/pom.xml

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-ops</artifactId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-ops/blade-develop/src/main/resources/templates/sword/edit.js.vm

@ -10,7 +10,7 @@ const FormItem = Form.Item;
@connect(({ $!{table.entityPath}, loading }) => ({
$!{table.entityPath},
submitting: loading.effects['code/submit'],
submitting: loading.effects['$!{table.entityPath}/submit'],
}))
@Form.create()
class $!{entity}Edit extends PureComponent {

2
blade-ops/blade-develop/src/test/resources/templates/sword/edit.js.vm

@ -10,7 +10,7 @@ const FormItem = Form.Item;
@connect(({ $!{table.entityPath}, loading }) => ({
$!{table.entityPath},
submitting: loading.effects['code/submit'],
submitting: loading.effects['$!{table.entityPath}/submit'],
}))
@Form.create()
class $!{entity}Edit extends PureComponent {

2
blade-ops/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>BladeX</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-service-api/blade-desk-api/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-service-api/blade-dict-api/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-service-api/blade-system-api/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

6
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java

@ -45,6 +45,12 @@ public class Dept implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 租户编号
*/
@ApiModelProperty(value = "租户编号")
private String tenantCode;
/**
* 父主键
*/

6
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java

@ -45,6 +45,12 @@ public class Role implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 租户编号
*/
@ApiModelProperty(value = "租户编号")
private String tenantCode;
/**
* 父主键
*/

2
blade-service-api/blade-user-api/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service-api</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

4
blade-service-api/pom.xml

@ -5,13 +5,13 @@
<parent>
<artifactId>BladeX</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-service-api</artifactId>
<name>${project.artifactId}</name>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
<packaging>pom</packaging>
<description>BladeX 微服务API集合</description>

2
blade-service/blade-desk/pom.xml

@ -6,7 +6,7 @@
<parent>
<groupId>org.springblade</groupId>
<artifactId>blade-service</artifactId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-service/blade-log/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

2
blade-service/blade-system/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

12
blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java

@ -16,11 +16,14 @@
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept;
@ -67,8 +70,9 @@ public class DeptController extends BladeController {
@ApiImplicitParam(name = "fullName", value = "部门全称", paramType = "query", dataType = "string")
})
@ApiOperation(value = "列表", notes = "传入dept", position = 2)
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> dept) {
List<Dept> list = deptService.list(Condition.getQueryWrapper(dept, Dept.class));
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> dept, BladeUser bladeUser) {
QueryWrapper<Dept> queryWrapper = Condition.getQueryWrapper(dept, Dept.class);
List<Dept> list = deptService.list((!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Dept::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
DeptWrapper deptWrapper = new DeptWrapper();
return R.data(deptWrapper.listNodeVO(list));
}
@ -80,8 +84,8 @@ public class DeptController extends BladeController {
*/
@GetMapping("/tree")
@ApiOperation(value = "树形结构", notes = "树形结构", position = 3)
public R<List<DeptVO>> tree() {
List<DeptVO> tree = deptService.tree();
public R<List<DeptVO>> tree(String tenantCode) {
List<DeptVO> tree = deptService.tree(tenantCode);
return R.data(tree);
}

13
blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java

@ -16,13 +16,15 @@
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.node.INode;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Role;
import org.springblade.system.service.IRoleService;
@ -68,8 +70,9 @@ public class RoleController extends BladeController {
@ApiImplicitParam(name = "roleAlias", value = "角色别名", paramType = "query", dataType = "string")
})
@ApiOperation(value = "列表", notes = "传入role", position = 2)
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> role) {
List<Role> list = roleService.list(Condition.getQueryWrapper(role, Role.class));
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> role, BladeUser bladeUser) {
QueryWrapper<Role> queryWrapper = Condition.getQueryWrapper(role, Role.class);
List<Role> list = roleService.list((!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Role::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
RoleWrapper roleWrapper = new RoleWrapper(roleService);
return R.data(roleWrapper.listNodeVO(list));
}
@ -79,8 +82,8 @@ public class RoleController extends BladeController {
*/
@GetMapping("/tree")
@ApiOperation(value = "树形结构", notes = "树形结构", position = 3)
public R<List<RoleVO>> tree() {
List<RoleVO> tree = roleService.tree();
public R<List<RoleVO>> tree(String tenantCode) {
List<RoleVO> tree = roleService.tree(tenantCode);
return R.data(tree);
}

81
blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java

@ -16,15 +16,16 @@
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Tenant;
import org.springblade.system.service.ITenantService;
@ -32,9 +33,11 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 控制器
* 控制器
*
* @author Chill
*/
@ -48,8 +51,8 @@ public class TenantController extends BladeController {
private ITenantService tenantService;
/**
* 详情
*/
* 详情
*/
@GetMapping("/detail")
@ApiOperation(value = "详情", notes = "传入tenant", position = 1)
public R<Tenant> detail(Tenant tenant) {
@ -58,61 +61,59 @@ public class TenantController extends BladeController {
}
/**
* 分页
*/
* 分页
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantCode", value = "参数名称", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "tenantName", value = "角色别名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "contactNumber", value = "联系电话", paramType = "query", dataType = "string")
})
@ApiOperation(value = "分页", notes = "传入tenant", position = 2)
public R<IPage<Tenant>> list(Tenant tenant, Query query) {
IPage<Tenant> pages = tenantService.page(Condition.getPage(query), Condition.getQueryWrapper(tenant));
public R<IPage<Tenant>> list(@ApiIgnore @RequestParam Map<String, Object> tenant, Query query, BladeUser bladeUser) {
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant, Tenant.class);
IPage<Tenant> pages = tenantService.page(Condition.getPage(query), (!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Tenant::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
return R.data(pages);
}
/**
* 自定义分页
*/
* 下拉数据源
*/
@GetMapping("/select")
@ApiOperation(value = "下拉数据源", notes = "传入tenant", position = 3)
public R<List<Tenant>> select(Tenant tenant) {
List<Tenant> list = tenantService.list(Condition.getQueryWrapper(tenant));
return R.data(list);
}
/**
* 自定义分页
*/
@GetMapping("/page")
@ApiOperation(value = "分页", notes = "传入tenant", position = 3)
@ApiOperation(value = "分页", notes = "传入tenant", position = 4)
public R<IPage<Tenant>> page(Tenant tenant, Query query) {
IPage<Tenant> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant);
return R.data(pages);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperation(value = "新增", notes = "传入tenant", position = 4)
public R save(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.save(tenant));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperation(value = "修改", notes = "传入tenant", position = 5)
public R update(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.updateById(tenant));
}
/**
* 新增或修改
*/
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperation(value = "新增或修改", notes = "传入tenant", position = 6)
@ApiOperation(value = "新增或修改", notes = "传入tenant", position = 7)
public R submit(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.saveOrUpdate(tenant));
return R.status(tenantService.saveTenant(tenant));
}
/**
* 删除
*/
* 删除
*/
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 8)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.deleteLogic(Func.toIntList(ids)));
}
}

3
blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.java

@ -42,8 +42,9 @@ public interface DeptMapper extends BaseMapper<Dept> {
/**
* 获取树形节点
*
* @param tenantCode
* @return
*/
List<DeptVO> tree();
List<DeptVO> tree(String tenantCode);
}

3
blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml

@ -33,6 +33,9 @@
<select id="tree" resultMap="treeNodeResultMap">
select id, parent_id, dept_name as title, id as 'value', id as 'key' from blade_dept where is_deleted = 0
<if test="_parameter!=null">
and tenant_code = #{_parameter}
</if>
</select>
</mapper>

3
blade-service/blade-system/src/main/java/org/springblade/system/mapper/RoleMapper.java

@ -42,8 +42,9 @@ public interface RoleMapper extends BaseMapper<Role> {
/**
* 获取树形节点
*
* @param tenantCode
* @return
*/
List<RoleVO> tree();
List<RoleVO> tree(String tenantCode);
}

3
blade-service/blade-system/src/main/java/org/springblade/system/mapper/RoleMapper.xml

@ -32,6 +32,9 @@
<select id="tree" resultMap="treeNodeResultMap">
select id, parent_id, role_name as title, id as 'value', id as 'key' from blade_role where is_deleted = 0
<if test="_parameter!=null">
and tenant_code = #{_parameter}
</if>
</select>
</mapper>

3
blade-service/blade-system/src/main/java/org/springblade/system/service/IDeptService.java

@ -42,8 +42,9 @@ public interface IDeptService extends IService<Dept> {
/**
* 树形结构
*
* @param tenantCode
* @return
*/
List<DeptVO> tree();
List<DeptVO> tree(String tenantCode);
}

3
blade-service/blade-system/src/main/java/org/springblade/system/service/IRoleService.java

@ -43,9 +43,10 @@ public interface IRoleService extends IService<Role> {
/**
* 树形结构
*
* @param tenantCode
* @return
*/
List<RoleVO> tree();
List<RoleVO> tree(String tenantCode);
/**
* 权限配置

10
blade-service/blade-system/src/main/java/org/springblade/system/service/ITenantService.java

@ -21,7 +21,7 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.system.entity.Tenant;
/**
* 服务类
* 服务类
*
* @author Chill
*/
@ -36,4 +36,12 @@ public interface ITenantService extends BaseService<Tenant> {
*/
IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant);
/**
* 新增
*
* @param tenant
* @return
*/
boolean saveTenant(Tenant tenant);
}

4
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java

@ -41,8 +41,8 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
}
@Override
public List<DeptVO> tree() {
return ForestNodeMerger.merge(baseMapper.tree());
public List<DeptVO> tree(String tenantCode) {
return ForestNodeMerger.merge(baseMapper.tree(tenantCode));
}
}

4
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

@ -52,8 +52,8 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
}
@Override
public List<RoleVO> tree() {
return ForestNodeMerger.merge(baseMapper.tree());
public List<RoleVO> tree(String tenantCode) {
return ForestNodeMerger.merge(baseMapper.tree(tenantCode));
}
@Override

58
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java

@ -17,23 +17,79 @@
package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tenant.TenantId;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Role;
import org.springblade.system.entity.Tenant;
import org.springblade.system.mapper.DeptMapper;
import org.springblade.system.mapper.RoleMapper;
import org.springblade.system.mapper.TenantMapper;
import org.springblade.system.service.ITenantService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
* 服务实现类
* 服务实现类
*
* @author Chill
*/
@Service
@AllArgsConstructor
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService {
private final TenantId tenantId;
private final RoleMapper roleMapper;
private final DeptMapper deptMapper;
@Override
public IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant) {
return page.setRecords(baseMapper.selectTenantPage(page, tenant));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveTenant(Tenant tenant) {
if (Func.isEmpty(tenant.getId())) {
List<Tenant> tenants = baseMapper.selectList(Wrappers.<Tenant>query().lambda().eq(Tenant::getIsDeleted, BladeConstant.DB_NOT_DELETED));
List<String> codes = tenants.stream().map(Tenant::getTenantCode).collect(Collectors.toList());
String tenantCode = getTenantCode(codes);
tenant.setTenantCode(tenantCode);
// 新建租户对应的默认角色
Role role = new Role();
role.setTenantCode(tenantCode);
role.setParentId(1);
role.setRoleName("管理员");
role.setRoleAlias("admin");
role.setSort(2);
role.setIsDeleted(0);
roleMapper.insert(role);
// 新建租户对应的默认部门
Dept dept = new Dept();
dept.setTenantCode(tenantCode);
dept.setParentId(0);
dept.setDeptName(tenant.getTenantName());
dept.setFullName(tenant.getTenantName());
dept.setSort(2);
dept.setIsDeleted(0);
deptMapper.insert(dept);
}
return super.saveOrUpdate(tenant);
}
private String getTenantCode(List<String> codes) {
String code = tenantId.generate();
if (codes.contains(code)) {
return getTenantCode(codes);
}
return code;
}
}

2
blade-service/blade-user/pom.xml

@ -5,7 +5,7 @@
<parent>
<artifactId>blade-service</artifactId>
<groupId>org.springblade</groupId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

8
blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

@ -17,6 +17,7 @@
package org.springblade.system.user.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -25,7 +26,9 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.feign.IDictClient;
@ -73,8 +76,9 @@ public class UserController {
@ApiImplicitParam(name = "realName", value = "姓名", paramType = "query", dataType = "string")
})
@ApiOperation(value = "列表", notes = "传入account和realName", position = 2)
public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query) {
IPage<User> pages = userService.page(Condition.getPage(query), Condition.getQueryWrapper(user, User.class));
public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query, BladeUser bladeUser) {
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
IPage<User> pages = userService.page(Condition.getPage(query), (!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(User::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
UserWrapper userWrapper = new UserWrapper(userService, dictClient);
return R.data(userWrapper.pageVO(pages));
}

4
blade-service/pom.xml

@ -6,14 +6,14 @@
<artifactId>blade-service</artifactId>
<name>${project.artifactId}</name>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
<packaging>pom</packaging>
<description>BladeX 微服务集合</description>
<parent>
<groupId>org.springblade</groupId>
<artifactId>BladeX</artifactId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
</parent>
<modules>

1109
doc/sql/bladex-oracle.sql

File diff suppressed because it is too large Load Diff

20
doc/sql/bladex-saber-mysql.sql

File diff suppressed because one or more lines are too long

18
doc/sql/bladex-sword-mysql.sql

File diff suppressed because one or more lines are too long

8
doc/sql/bladex-tenant-mysql-update-RC5.sql

@ -5,16 +5,8 @@ ALTER TABLE `bladex`.`blade_notice`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_dept`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_dict`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_menu`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_role`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_role_menu`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_param`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_user`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_log_api`

6
pom.xml

@ -5,12 +5,12 @@
<groupId>org.springblade</groupId>
<artifactId>BladeX</artifactId>
<version>2.0.0.RC5</version>
<version>2.0.0.RC6</version>
<packaging>pom</packaging>
<properties>
<bladex.tool.version>2.0.0.RC5</bladex.tool.version>
<bladex.project.version>2.0.0.RC5</bladex.project.version>
<bladex.tool.version>2.0.0.RC6</bladex.tool.version>
<bladex.project.version>2.0.0.RC6</bladex.project.version>
<java.version>1.8</java.version>
<swagger.version>2.9.2</swagger.version>

2
script/docker/.env

@ -1,2 +1,2 @@
REGISTER=192.168.186.129/blade
TAG=2.0.0.RC5
TAG=2.0.0.RC6

Loading…
Cancel
Save