Browse Source

增加多租户模块,优化代码生成

test
smallchill 6 years ago
parent
commit
3855b2abff
  1. 20
      blade-ops/blade-develop/src/main/resources/templates/sql/menu.sql.vm
  2. 11
      blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGenerator.java
  3. 20
      blade-ops/blade-develop/src/test/resources/templates/sql/menu.sql.vm
  4. 66
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Tenant.java
  5. 118
      blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java
  6. 41
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/TenantMapper.java
  7. 25
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/TenantMapper.xml
  8. 39
      blade-service/blade-system/src/main/java/org/springblade/system/service/ITenantService.java
  9. 39
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java
  10. 4
      doc/sql/bladex-saber-mysql.sql
  11. 8
      doc/sql/bladex-sword-mysql.sql
  12. 46
      doc/sql/bladex-tenant-mysql-update-RC5.sql

20
blade-ops/blade-develop/src/main/resources/templates/sql/menu.sql.vm

@ -1,11 +1,11 @@
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.serviceName}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', 0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
set @parentid = (SELECT LAST_INSERT_ID());
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.serviceName}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.serviceName}/$!{cfg.entityKey}/edit', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/$!{cfg.serviceName}/$!{cfg.entityKey}/delete', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.serviceName}/$!{cfg.entityKey}/view', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);

11
blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGenerator.java

@ -29,11 +29,15 @@ public class CodeGenerator {
/**
* 代码生成的模块名
*/
public static String CODE_NAME = "自定义模块";
public static String CODE_NAME = "租户管理";
/**
* 代码所在服务名
*/
public static String SERVICE_NAME = "blade-system";
/**
* 代码生成的包名
*/
public static String PACKAGE_NAME = "org.springblade.demo";
public static String PACKAGE_NAME = "org.springblade.system";
/**
* 前端代码生成所属系统
*/
@ -49,7 +53,7 @@ public class CodeGenerator {
/**
* 需要生成的表名(两者只能取其一)
*/
public static String[] INCLUDE_TABLES = {"blade_notice"};
public static String[] INCLUDE_TABLES = {"blade_tenant"};
/**
* 需要排除的表名(两者只能取其一)
*/
@ -70,6 +74,7 @@ public class CodeGenerator {
public static void main(String[] args) {
BladeCodeGenerator generator = new BladeCodeGenerator();
generator.setCodeName(CODE_NAME);
generator.setServiceName(SERVICE_NAME);
generator.setSystemName(SYSTEM_NAME);
generator.setPackageName(PACKAGE_NAME);
generator.setPackageWebDir(PACKAGE_WEB_DIR);

20
blade-ops/blade-develop/src/test/resources/templates/sql/menu.sql.vm

@ -1,11 +1,11 @@
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.serviceName}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', 0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
set @parentid = (SELECT LAST_INSERT_ID());
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.serviceName}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.serviceName}/$!{cfg.entityKey}/edit', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/$!{cfg.serviceName}/$!{cfg.entityKey}/delete', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES (@parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.serviceName}/$!{cfg.entityKey}/view', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);

66
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Tenant.java

@ -0,0 +1,66 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("blade_tenant")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Tenant对象", description = "Tenant对象")
public class Tenant extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 租户编号
*/
@ApiModelProperty(value = "租户编号")
private String tenantCode;
/**
* 租户名称
*/
@ApiModelProperty(value = "租户名称")
private String tenantName;
/**
* 联系人
*/
@ApiModelProperty(value = "联系人")
private String linkman;
/**
* 联系电话
*/
@ApiModelProperty(value = "联系电话")
private String contactNumber;
/**
* 联系地址
*/
@ApiModelProperty(value = "联系地址")
private String address;
}

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

@ -0,0 +1,118 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Tenant;
import org.springblade.system.service.ITenantService;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
/**
* 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tenant")
@ApiIgnore
@Api(value = "租户管理", tags = "接口")
public class TenantController extends BladeController {
private ITenantService tenantService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperation(value = "详情", notes = "传入tenant", position = 1)
public R<Tenant> detail(Tenant tenant) {
Tenant detail = tenantService.getOne(Condition.getQueryWrapper(tenant));
return R.data(detail);
}
/**
* 分页
*/
@GetMapping("/list")
@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));
return R.data(pages);
}
/**
* 自定义分页
*/
@GetMapping("/page")
@ApiOperation(value = "分页", notes = "传入tenant", position = 3)
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)
public R submit(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.saveOrUpdate(tenant));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.deleteLogic(Func.toIntList(ids)));
}
}

41
blade-service/blade-system/src/main/java/org/springblade/system/mapper/TenantMapper.java

@ -0,0 +1,41 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.system.entity.Tenant;
import java.util.List;
/**
* Mapper 接口
*
* @author Chill
*/
public interface TenantMapper extends BaseMapper<Tenant> {
/**
* 自定义分页
*
* @param page
* @param tenant
* @return
*/
List<Tenant> selectTenantPage(IPage page, Tenant tenant);
}

25
blade-service/blade-system/src/main/java/org/springblade/system/mapper/TenantMapper.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.system.mapper.TenantMapper">
<!-- 通用查询映射结果 -->
<resultMap id="tenantResultMap" type="org.springblade.system.entity.Tenant">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="tenant_name" property="tenantName"/>
<result column="linkman" property="linkman"/>
<result column="contact_number" property="contactNumber"/>
<result column="address" property="address"/>
</resultMap>
<select id="selectTenantPage" resultMap="tenantResultMap">
select * from blade_tenant where is_deleted = 0
</select>
</mapper>

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

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.entity.Tenant;
/**
* 服务类
*
* @author Chill
*/
public interface ITenantService extends BaseService<Tenant> {
/**
* 自定义分页
*
* @param page
* @param tenant
* @return
*/
IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant);
}

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

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.system.entity.Tenant;
import org.springblade.system.mapper.TenantMapper;
import org.springblade.system.service.ITenantService;
import org.springframework.stereotype.Service;
/**
* 服务实现类
*
* @author Chill
*/
@Service
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService {
@Override
public IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant) {
return page.setRecords(baseMapper.selectTenantPage(page, tenant));
}
}

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

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

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

@ -1,3 +1,6 @@
-- ----------------------------
-- 租户字段增加
-- ----------------------------
ALTER TABLE `bladex`.`blade_notice`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_dept`
@ -20,3 +23,46 @@ ALTER TABLE `bladex`.`blade_log_error`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
ALTER TABLE `bladex`.`blade_log_usual`
ADD COLUMN `tenant_code` varchar(12) NULL DEFAULT '000000' COMMENT '租户编号' AFTER `id`;
-- ----------------------------
-- 租户菜单增加
-- ----------------------------
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', 56, 'tenant', '租户管理', 'menu', '/blade-system/tenant', NULL, 1, 1, 0, 1, NULL, 0);
set @parentid = (SELECT LAST_INSERT_ID());
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, 'tenant_add', '新增', 'add', '/blade-system/tenant/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, 'tenant_edit', '修改', 'edit', '/blade-system/tenant/edit', 'form', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, 'tenant_delete', '删除', 'delete', '/blade-system/tenant/delete', 'delete', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('000000', @parentid, 'tenant_view', '查看', 'view', '/blade-system/tenant/view', 'file-text', 1, 2, 1, 1, NULL, 0);
-- ----------------------------
-- 租户表创建
-- ----------------------------
DROP TABLE IF EXISTS `blade_tenant`;
CREATE TABLE `blade_tenant` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`tenant_code` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户编号',
`tenant_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户名称',
`linkman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人',
`contact_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系地址',
`create_user` int(11) NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` int(11) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
`is_deleted` int(2) NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
-- ----------------------------
-- 租户表数据插入
-- ----------------------------
BEGIN;
INSERT INTO `blade_tenant` VALUES (1, '000000', '管理组', 'admin', '666666', '管理组', 1, '2019-01-01 00:00:39', 1, '2019-01-01 00:00:39', 1, 0);
COMMIT;

Loading…
Cancel
Save