zuihou-admin-boot 2.2 released, tenant mode supports dynamically adding data sources

Today's update log:

Newly added:
1. Added distributed timing task executor (now supports both single machine timing execution and distributed timing execution)

Optimization:
1. Optimize the code generator template file, reduce dependencies
2. Optimize Swagger automatic configuration items, support setting authentication parameters
3. zuihou-admin-ui global user query experience
4. Multi-data source mode independent into a plug-in, free to use Plug and play
5. Optimize mq, scan and other configuration
6. Optimize tenant module package name

Fix:
1. zuihou-admin-ui can't add the operation background account bug
 

Tenant model:

Tenant model description advantage Disadvantages Distributed transaction
NONE (non-tenant model)  No tenant Simple and suitable for independent systems Lack of convenience of tenant system stand by
COLUMN (Field Mode) Tenants share a database and add fields in the business table to distinguish   Simple, uncomplicated, and development-agnostic  Poor data isolation, poor security, and difficult data backup and recovery stand by
SCHEMA (independent schema)  Each tenant is independent of a database (schema), when executing SQL, dynamically add a schema before the table name Simple, non-aware development, good data isolation The root account of the database must be configured in the configuration file, and complex SQL and SQL nested custom functions are not supported Bug
DATASOURCE (independent data source)  Each tenant is independent of a database (data source), when the code is executed, the data source is dynamically switched The database can be deployed independently, with good data isolation, high scalability, and low impact of failure Relatively complex, development needs to pay attention to transaction issues when switching data sources, and requires more databases stand by

Introduction:


Based on SpringBoot (2.2.5.RELEASE) SaaS-type microservice scaffolding, with user management, resource authority management, unified gateway authentication, Xss anti-cross-site attacks, automatic code generation, multiple storage systems, distributed transactions, distributed timing Multiple modules such as tasks support parallel development of multiple business systems and parallel development of multiple services, and can be used as a scaffolding for the development of back-end services. The code is concise and the architecture is clear, which is very suitable for learning. The core technology uses Mybatis, SpringBoot, JWT Token, RabbitMQ, FastDFS and other main frameworks and middleware.

Hope to work hard to build a set of solutions from  SaaS basic framework  -  distributed microservice architecture  -  automated deployment  -  system monitoring  . This project aims to achieve basic capabilities and does not involve specific businesses.
 

Function point introduction:

 Interface authentication:

JWT is used to strengthen the authorization verification of scheduling between services to ensure the security of internal services.

monitor:

Use Spring Boot Admin to monitor the running status of each independent service; use turbine to view the running status and calling frequency of the interface in real time

data permission:

Using the DataScopeInterceptor interceptor based on Mybatis to achieve simple data permissions

SaaS's non-sense solution:

Use the Mybatis interceptor to intercept all SQL and modify the default schema to achieve the purpose of multi-tenant data isolation.

Secondary cache:

Use J2Cache to operate the cache, the first level cache uses memory (Caffeine), and the second level cache uses Redis. Since a large number of cache reads will cause L2's network to become the bottleneck of the entire system, the goal of L1 is to reduce the number of reads to L2. The caching framework is mainly used in cluster environments. It can also be used as a stand-alone machine to avoid the impact on the back-end business after the cold restart of the cache caused by the application restart.

Elegant Bean conversion:

Use Dozer components to optimize the conversion of DTO, DO, PO and other objects

Front and back end unified form verification:

Strict form verification usually requires simultaneous front-end + back-end verification, but for traditional projects, only the front-end and back-end can be tested once, and later rules change, and the front-end and back-end must be modified at the same time. Therefore, the zuihou-validator-starter starting dependency is encapsulated on the basis of hibernate-validator, providing a common interface, which can obtain the rules that need to verify the form, and then the front end uses the rules returned by the back end. Just modify it.

Anti-cross-site scripting attack (XSS):

  •      Filter the form parameters in all requests through filters
  •      Use Json deserializer to filter all application / json type parameters

Current user information injector:

 Annotation for user identity injection

Online API:

Since the native swagger-ui is not friendly enough for some functions, the domestic open source knife4j is adopted, and the statuser is made to facilitate the use of springboot users.

Code generator:

Based on Mybatis-plus-generator, a set of code generator is customized. By configuring the annotations of database fields, it automatically generates enumeration classes, data dictionary annotations, SaveDTO, UpdateDTO, form validation rule annotations, Swagger annotations, etc.

Scheduled task scheduler:

Based on xxl-jobs has been enhanced. (Eg: send tasks at specified time, executor and scheduler merge project, multiple data sources)

Large file / breakpoint / shard resume:

The front-end uses webupload.js, the back-end uses NIO to realize the continuation of large file breakpoints. After starting the Eureka, Zuul and File services, directly open docs / chunkUploadDemo / demo.html to test. After testing, the local maximum stack memory of 128M starts the File service. It can successfully upload large files of 4.6G + within 5 minutes. The official service time will be affected by user bandwidth and server bandwidth, and the time is relatively long.

Distributed transactions:

It integrates Ali's distributed transaction middleware: seata to  solve the distributed transaction problems faced by microservice scenarios in an  efficient  and intrusive manner to the business  .

Automatic injection of related data:

It is used to solve the pain of cross-table, cross-database, cross-service paging data attributes or single object attributes echoing related data, and supports automatic injection of static data attributes (data dictionaries) and dynamic primary key data.

Project code address

project gitee github Remarks
Microservice project https://gitee.com/zuihou111/zuihou-admin-cloud https://github.com/zuihou/zuihou-admin-cloud SpringCloud version backend code
Monolithic project https://gitee.com/zuihou111/zuihou-admin-boot https://github.com/zuihou/zuihou-admin-boot SpringBoot version backend code
Tenant back office https://gitee.com/zuihou111/zuihou-ui https://github.com/zuihou/zuihou-ui | Front end for customers
Development & operation background https://gitee.com/zuihou111/zuihou-admin-ui https://github.com/zuihou/zuihou-admin-ui For the company's internal development & operation & operation and maintenance personnel
Code generator https://gitee.com/zuihou111/zuihou-generator https://github.com/zuihou/zuihou-generator Developers use
Core toolkit https://gitee.com/zuihou111/zuihou-commons https://github.com/zuihou/zuihou-commons Core toolkit

Demonstration address (the demo account does not have write permission, only query)

project Demo address Administrator account Ordinary account
Tenant back office http://tangyh.top:10000/zuihou-ui zuihou / zuihou test/zuiou
Development & operation background http://tangyh.top:180/zuihou-admin-ui demoAdmin / zuihou no

Guess you like

Origin www.oschina.net/news/115023/zuihou-admin-boot-2-2-released