zuihou-admin-cloud 2.0 release, support for multiple tenants select mode

Update log Today:

New

  • New Controller Interface Base, Delete, Poi, Save, Update, Query six functions to facilitate the business side and provides default implementations SuperSimpleController, SuperNoPoiController, SuperController, SuperCacheController.
  • Add SuperCacheController, SuperCacheService, SuperCacheServiceImpl a default base class cached
  • Add SuperController, SuperService, SuperServiceImpl 3 without a base class cache base used to distinguish the above 
  • New manual query the current logged-on user, role, job, organizational information. (Formerly only used @LoginUser SysUser way injection)
  • New project features compatible with mysql 8.0.19 (nacos use mysql8 need to modify the source code version nacos official driver, and compile it yourself !!!)
  • The front end of the project: All paging query request into POST, when the historical memory paging switch pages selected item, click anywhere on the table row that is checked by default Created supports sorting, screening all forms head into the back-end screening.
  • Support operation log record DB stores and store FILE 2 choices, and redefine log format, support information application name, port number, tenant ID, user ID, link ID, log
  • Multi-tenant mode configured to support tenants field mode
  • User management page support export, import check function
  • Add new LbqWrapper (entity); method, when the entity has a field of type RemoteData, key blank ignore this field splicing. 

optimization

  • Dependence upgrade: springboot -> 2.2.5, mysql -> 8.0.18, lombok -> 1.18.12, fastjson -> 1.2.66, mybatis-> 3.5.3, guava -> 22.0, hutool -> 5.2.1, knife4j -> 2.0.2
  • Completely independent zuihou-commons package, and optimized configuration that perfectly compatible cloud and boot project
  • zuihou-commons-related jar to release official central repository .
  • Generating optimized code, compatible with several new base class (Super *)
  • Waste zuihou-api module, zuihou - * - api zuihou- * module to the next module, to facilitate deployment compiled
  • BaseController abandoned the original base class, and all of the code originally written, inherits a new base class.
  • Jinzun greater than convention principle configuration, optimization zuihou-user-stater, zuihou-scan-stater Feign selected such that, when Service, Rabbit other modes of implementation class initialization completely
  • Pom inside the original configurations to the src / main / filters / config-ENV.properties
  • Recording operation log optimization, the switch support, covering inheritance.
  • Stored in the original configuration zuihou-config files to a third-party / nacos / clientConfig
  • New Methods for cleaning up operation logs and log in the log within the specified time period

repair

  • Repair MultiTenantInterceptor interceptor classes can not replace bug part of a complex SQL table name
  • zuihou-admin-ui refresh the page, the console error when switching menus.

zuihou-admin-cloud project 1.9.x version of the code update Update instructions:
0. following applies only to no code changes or modifications in version 1.x fewer cases, if the code of the original project larger and more, Please re-find a directory clone project
1. in IDEA2019.3, click update projects, check: Merge the incoming changes into the current branch point after the OK
2. Once the code has been updated, in the file Explorer `zuihou -commons`, `zuihou-backend`,` zuihou-dependencies`3 folders deleted directly.


Profile changes (including but not limited to, the following configuration):
0.nacos in New commmon.yml:

zuihou:
  log:
    enabled: true
    type: DB         # 存储的Mysql还是Logger打印在日志文件中


1.nacos in zuihou-order-server.yml sum zuihou-demo-server.yml: personal reformation

zuihou:
  database:
    multiTenantType: NONE       # 修改前:     isMultiTenant: false


2.nacos in mysql.yml: Modify

zuihou:
  database:
    multiTenantType: SCHEMA   # 修改前:isMultiTenant: true  


3. Project: zuihou-admin-cloud / zuihou-dependencies / pom.xml in the configuration of the mobile profiles related to zuihou-admin-cloud / src / main / filters / config-dev.properties

nacos.ip=127.0.0.1
nacos.port=8848
nacos.namespace=b16f7baf-56e7-4f4e-a26c-425ee0668016
seata.namespace=


4. The original is stored in zuihou-commons / src / main / resources in nacos profile, moved to the third-party / nacos / clientConfig

 

Why should zuihou-commons module is independent?
    1. Tools code and business code stored in a project, when you copy the project, will increase redundant code.
    All modules in 2.zuihou-commons project are independent toolkit, she uses are not limited to zuihou-admin-cloud and zuihou-admin-boot2 projects, but for any project SpringBoot or SpringCloud

Why should the project be split into so many sub-modules?
    This is the best embodiment of the high cohesion and low coupling
    enhance the readability of the code, reusability, maintainability, and ease of changing
    the interior of the module code, the stronger the connection between each other, the higher the cohesion, the module independence the better. A module should try to separate, to complete the independent functional!
    If there are codes have to be introduced into separate modules, split into multiple modules recommended! Low cohesive code, poor maintenance, code is also robust enough
 

Summary:


Based on `SpringCloud (Hoxton.SR1)` + `SpringBoot (2.2.5.RELEASE)` the SaaS service micro-scaffold, with user management, resource rights management, unified gateway authentication, Xss anti-cross-site attacks, automatic code generation, multi-storage systems, distributed transactions, and other regular tasks distributed modules, multi-service system to support parallel development, multi-service support parallel development, can be used as scaffolding to develop back-end services. Code is simple and clear structure, is very suitable for learning. The core technology employed Nacos, Fegin, Ribbon, Zuul, Hystrix, JWT Token, Mybatis, SpringBoot, Seata, Nacos, Sentinel, RabbitMQ, FastDFS other main framework and middleware.

Hope and strive to create a set from  SaaS basic framework  -  distributed micro-services architecture  -  Automated deployment  -  system monitoring  solutions. The project aims to achieve basic skills, not related to specific operations.
 

Function Point presentation:

Registration and service call:

Service registration and call Eureka implemented based on using Feign in Spring Cloud, we can do it using an HTTP request remote services can call the local method and the same coding experience, developers fully perceive this is not a remote method, more aware this is not a HTTP request.

 Authentication Service:

Permission to schedule the service to enhance the way by JWT verification, to ensure internal security services.

Load Balancing:

The service keeps the rest proxy and gateway control, in addition to the usual frequently used node.js, nginx, Spring Cloud series zuul and ribbon, can help us carry out normal gateway control and load balancing. Which extend and learn from foreign expansion project based on JWT's Zuul limit to limit the current flow plug-respect.

 Fuse mechanism:

Since taking the distribution of services, in order to avoid service calls between the "avalanche", we adopted Hystrix as fuses, to avoid the "avalanche" between services.

monitor:

Use Spring Boot Admin to monitor the operating status of each individual Service; using the turbine to view state and calling frequency interface in real time; to see the call chain between the various services through Zipkin and so on.

data permission:

Based Mybatis DataScopeInterceptor use of interceptors to achieve a simple data permissions

No sense of SaaS solutions:

Use Mybatis interceptors to achieve the interception of all SQL, modify the default Schema, in order to achieve the purpose of multi-tenant data isolation.

Secondary cache:

Using J2Cache cache operation, using a first level cache memory (the Caffeine), second-level cache use Redis. Because a large number of L2 cache reads may result in the bottleneck of the network system, the target is to reduce the number of reads L1 to L2. The frame buffer is mainly used in a clustered environment. It can also be used stand-alone, to avoid the impact of the back-end business application cache after the restart due to a cold start.

Elegant Bean conversion:

Dozer assembly employed to optimize the conversion of the DTO, DO, PO object, etc.

Front and rear end unified form validation:

Strict form validation usually takes the front + back-end and to verify, but the traditional project are only done once before and after the end of each test, the late rule change, they have to end at the same time before and after the modification. Therefore, on the basis of the package on the hibernate-validator zuihou-validator-starter starting-dependent, provides a common interface, access rules can be verified form, then the front end of the rear end of the returned usage rule, if after the rule change, only the rear end modifications.

Anti-cross-site scripting attacks (XSS):

  •      To filter all requests in the form parameter through the filter
  •      To filter all application / json type parameter Json deserializer implemented by

The current user information Injector:

 By injection annotations achieve user identity

Online API:

Since the primary function of certain swagger-ui support friendly enough, so the use of domestic open-source knife4j, and produced a stater, convenient springboot users.

Code generator:

Mybatis-plus-generator based on the custom code generator set, by configuring the annotation database fields, generated automatically enumerated classes, dictionary data annotation, SaveDTO, UpdateDTO, validation rules form annotations, annotation Swagger like.

Timing task scheduler:

Enhancements were based xxl-jobs. (Example: send task specified time, and a scheduler performing combined projects, multiple data sources)

Speaking Eureka registry page:

Please switch branches View

Large file / break / slice Resume:

Front-end webupload.js, the back-end uses NIO to achieve a break after large files fragmented resume, start Eureka, Zuul, File Services, directly open docs / chunkUploadDemo / demo.html can be tested. After testing, the local limit maximum stack memory 128M start File Services, within five minutes can be successfully uploaded 4.6G + large files, the official service will be affected user consuming bandwidth and server bandwidth, long time.

Distributed Transaction:

Ali integrated distributed transaction middleware: seata, with  high efficiency  and business  0 intrusive  way to solve the problems facing distributed transaction scenario of micro-services.

Gray Release:
    
In order to solve the frequent update service line, version rollback, fast iterative, collaborative development within the company, this project uses load balancing strategy is implemented to modify the gray ribbon of release.     

Automatic injection associated data:

To solve cross table, cross-database, cross-service properties of individual objects or paged data attributes echo of the pain associated data, support for static data attribute (data dictionary), dynamic data is automatically injected into the primary key.

Item code address

project gitee github Remark
Micro Services https://gitee.com/zuihou111/zuihou-admin-cloud https://github.com/zuihou/zuihou-admin-cloud SpringCloud version of the back-end code
Single project https://gitee.com/zuihou111/zuihou-admin-boot https://github.com/zuihou/zuihou-admin-boot SpringBoot version of the back-end code
Tenant Background https://gitee.com/zuihou111/zuihou-ui https://github.com/zuihou/zuihou-ui | To use front-end customer
Development & Operations background https://gitee.com/zuihou111/zuihou-admin-ui https://github.com/zuihou/zuihou-admin-ui The company developed in-house & Operations & operation and maintenance personnel
Code generator https://gitee.com/zuihou111/zuihou-generator https://github.com/zuihou/zuihou-generator Developers use
Core Kit https://gitee.com/zuihou111/zuihou-commons https://github.com/zuihou/zuihou-commons Core Kit

Demo (demo account does not have write permissions can only query)

project Demo Address Administrator account Ordinary Account
Tenant Background http://tangyh.top:10000/zuihou-ui zuihou / zuihou test/zuiou
Development & Operations background http://tangyh.top:180/zuihou-admin-ui demoAdmin / zuihou no

Guess you like

Origin www.oschina.net/news/114054/zuihou-admin-cloud-2-0-released