Actual combat of multi terminal full stack project: the whole process of large-scale commercial driving agent business is implemented [Wan whole]

Link: Extraction code: iamh
Author - \ / 307570512

Microservice architecture of large commercial driving agent business

Microservice architecture (commonly referred to as microservice) is an architecture form used to develop applications. Through microservices, large-scale applications can be decomposed into multiple independent components, each of which has its own responsibility field. When processing a user request, microservice based applications may call many internal microservices to jointly generate their response. Containers are a great example of a microservice architecture because they allow you to focus on developing services without worrying about dependencies.

This monomer application is more suitable for small projects. Its advantages are:
Simple and direct development and centralized management
Basically no repeated development
All functions are local, without distributed management overhead and call overhead

Actual combat of spingboot multi terminal full stack project

Step 1: import the jar package
Import the jar package of mybatis plus into pom. Since code generation will be involved later, we also need to import the page template engine. Here we use freemaker.

<!--mp Code generator -->

Step 2: then write the configuration file

# DataSource Config
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/vueblog?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai
    username: root
    password: admin
  mapper-locations: classpath*:/mapper/**Mapper.xml

In addition to the information of the configuration database, the above also configures the scanning path of the xml file of the mapper of myabtis plus. Don't forget this step.
Step 3: start mapper interface scanning and add paging plug-in
Create a new package: specify the package where the interface to become the implementation class is located through the @ maperscan annotation, and then all interfaces under the package will generate corresponding implementation classes after compilation. PaginationInterceptor is a paging plug-in.


public class MybatisPlusConfig {
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        return paginationInterceptor;

Step 4: code generation
If you don't use other plug-ins, you can use mybatis plus now. The official provides us with a code generator. Then after I write my own parameters, I can directly generate entity, service, mapper and other interfaces and implementation classes according to the database table information.


Because the code is relatively long, it will not be posted. Look at it in the code warehouse!
First, I created a new user table in the database:

CREATE TABLE `m_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `username` varchar(64) DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `email` varchar(64) DEFAULT NULL,
  `password` varchar(64) DEFAULT NULL,
  `status` int(5) NOT NULL,
  `created` datetime DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
CREATE TABLE `m_blog` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `content` longtext,
  `status` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`)
INSERT INTO `vueblog`.`m_user` (`id`, `username`, `avatar`, `email`, `password`, `status`, `created`, `last_login`) VALUES ('1', 'markerhub', '', NULL, '96e79218965eb72c92a549dd5a330112', '0', '2020-04-20 10:44:01', NULL);

Posted by ChrisMartino on Sun, 17 Apr 2022 19:36:09 +0930