Multi tenant management system framework implemented by springboot + Vue

Time:2021-12-1

RuoYi-Vue-Multi-Tenant

github:https://github.com/leslie1015/RuoYi-Vue-Multi-Tenant
gitee: https://gitee.com/leslie8195/ruo-yi-vue-multi-tenant
Already in ruoyiProject extensionRecommended in

introduce

Multi tenant framework based on ruoyi Vue extension (front end and back end separated permission management system of spring boot, spring security, JWT, Vue & element)

Environmental preparation

1. Clone project to local

2. Find the script file / Ruo Yi Vue multi tenant / ruoyi / multi in the project directory_ Tenant.sql, import to MySQL

3. Modify the configuration (for the configuration not listed, please adjust it as needed according to the actual situation)

# datasource
spring.datasource.druid.master.url=jdbc:mysql://127.0.0.1:3306/mt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
spring.datasource.druid.master.username=root
spring.datasource.druid.master.password=123456
# redis
spring.redis.host=127.0.0.1
spring.redis.port=6379
#spring.redis.password=

If you use Alibaba cloud OSS storage, you can modify the following configurations, otherwise ignore or delete them (check whether startup has an impact when deleting)

# aliyun oss
aliyun.oss.endpoint = http://oss-cn-shanghai.aliyuncs.com
aliyun.oss.accessKeyId = xxxxxxxxxx
aliyun.oss.accessKeySecret = xxxxxxxxxx
aliyun.oss.defaultBucketName = xxxxxxxxxx
aliyun.oss.endpointContent = oss-cn-shanghai.aliyuncs.com

4. After importing the front-end code, NPM install / cnpm install depends on the installation, and modify devserver.proxy.target in vue.config.js as the back-end address

devServer: {
  host: '0.0.0.0',
  port: port,
  proxy: {
    [process.env.VUE_APP_BASE_API]: {
      target: `http://127.0.0.1:8080`,
      changeOrigin: true,
      pathRewrite: {
        ['^' + process.env.VUE_APP_BASE_API]: ''
      }
    }
  }

5. NPM run dev start the front end

Build test environment: NPM run build: Stage

Build production environment: NPM run build: prod

Function description

--Super administrator, with the highest authority of the system
select * from sys_user where super_admin_flag = 1
--Tenant administrator
select * from sys_user where admin_flag = 1

--Super administrator menu (0 No 1 yes). If the menu bar is not displayed after the menu is created, please check whether this field corresponds correctly
select * from sys_menu where super_flag = 1

multi_ The super administrator account and password are initialized in tenant.sql script

1. Log in to the system using admin / admin123

2. Open tenant management – permission template – add, add a permission template, and specify the menu permissions owned by the template

Multi tenant management system framework implemented by springboot + Vue

Super administrator – add permission template

3. Open tenant management – tenant list – add, add a tenant, and select the permission template just now

Multi tenant management system framework implemented by springboot + Vue

Super administrator – create tenant

4. Log out of the system and log in again with the tenant account just created. The default account is the mobile phone number 1386688888 filled in the above figure, and the default password is 123456

#Default tenant password
sys.default.pwd=123456.
#Under the menu, the tenant data is isolated, and the comid can be obtained from the context login user information
 select * from order where com_id = #{comId}

Log in and enter the tenant home page

Multi tenant management system framework implemented by springboot + Vue

Tenant administrator – home page

The tenant administrator can create a role and assign the existing permissions of the tenant to the role, then create users under the tenant and assign corresponding roles

other

1. The business code generation is changed to the business directory by default, which is different from the relevant functions of the system

2. Position and department are not supported at present, and permission is controlled only by role

3. Some business terms in the code have not been completely changed, such as override home page, tenant / company, work order information on home page, icon, etc. the time reason will be gradually adjusted later. At present, please modify it yourself if necessary

4. Thank youRuoYi, ruoyi project addresshttps://gitee.com/y_project/RuoYi-Vue

5. If you have any questions or encounter bugs, please contact email:[email protected] QQ: 819543722