Cloud E essays - back end_ piece1

1, Project introduction

This project is an online office system for small and medium-sized enterprises. CloudE online office system is a system used to manage daily office affairs.

Specific contents: Daily various process approval, news, notice, announcement, document information, finance, personnel, expenses, assets, administration, project, mobile office, etc.
Function: it is convenient for management through software. Simpler, more flat, efficient and standardized, and improve the overall management and operation level.

In terms of technology, the project uses the current mainstream front-end and back-end separation development mode, and uses the community active and mainstream open source framework Spring Boot to build the back-end, in order to realize the CloudE online office system. Including position management and title management. Department management, employee management, salary management, online chat and other technical modules. The project will also use the industry's mainstream third-party components to expand the skill pool.

Main modules and technical points of the project:

2, Project construction

1. Create parent project



  • pox. Delete part of the configuration from XML, as shown in the figure:
    1. dependencies section
    2. build part
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.8</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.chuci</groupId>
    <artifactId>cloude</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>cloude</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>

</project>
  • Directory structure except POM XML, delete other files

2. Create sub project - > cloud_ e_ server

2.1 new project

Right click the parent project - > New - > module



Parent project POM Automatic update insert under XML file

<modules>
        <module>cloud_e_server</module>
    </modules>


cloud_e_server sub project POM xml

2.2 adding dependencies

Add the required dependencies and temporarily delete the build part of the configuration file

  1. web dependency
  2. lombok dependency
  3. mysql dependency
  4. Mybatis plus dependency
  5. swagger2 dependency
  6. Swagger third party ui dependency
  7. security dependency
  8. JWT dependency
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>cloud_e</artifactId>
        <groupId>com.chuci</groupId>
        <version>0.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>cloud_e_server</artifactId>

    <name>cloud_e_server</name>
    <!-- FIXME change it to the project's website -->
    <url>http://www.example.com</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <!--web rely on-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--lombok rely on-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!--mysql rely on-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--mybatis-plus rely on-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.3.4</version>
        </dependency>
        <!-- swagger2 rely on -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <!-- Swagger Third party ui rely on -->
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>swagger-bootstrap-ui</artifactId>
            <version>1.9.6</version>
        </dependency>
        <!--security rely on-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!--JWT rely on-->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>
    </dependencies>

</project>

2.3 add profile

resources -> new -> file -> application.yml

# port
server:
  port: 8081

# data source
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/db_cloud_e?useUnicode=true&characterEncoding=UTF-
      8&serverTimezone=Asia/Shanghai
    username: root
    password: root
    hikari:
      # Connection pool name
      pool-name: DateHikariCP
      # Minimum number of free connections
      minimum-idle: 5
      # The maximum idle connection lifetime is 600000 (10 minutes) by default
      idle-timeout: 180000
      # The maximum number of connections is 10 by default
      maximum-pool-size: 10
      # Connections returned from the connection pool are automatically submitted
      auto-commit: true
      # Connection maximum lifetime 0 means permanent default 1800000 (30 minutes)
      max-lifetime: 1800000
      # The default connection timeout is 30000 (30 seconds)
      connection-timeout: 30000
      # Test whether the connection is available query statement
      connection-test-query: SELECT 1

# Mybatis plus configuration
mybatis-plus:
  #  Configure Mapper mapping file
  mapper-locations: classpath:/mappers/*Mapper.xml
  #  Configure mybatis data return type alias (default alias is class name)
  type-aliases-package: com.chuci.server.model
  configuration:
    #    Automatic hump naming
    map-underscore-to-camel-case: true

# SQL printing (package of method interface, not Mapper.xml)

logging:
  level:
    com.chuci.server.dao: debug

# jwt configuration
jwt:
  # JWT stored request header
  tokenHeader: Authorization
  # Key used for JWT encryption and decryption
  secret: cloude-secret
  # Overdue time of JWT (60 * 60 * 24)
  expiration: 604800
  # Get the start in the JWT load
  tokenHead: Bearer

2.4 create a new startup class cloudeserverapplication java

Package name: com chuci. server
Startup class: cloudeserverapplication java

package com.chuci.server;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @Auther chuci
 * @Data 2021-12-22 21:21
 * @Description:
 */
@SpringBootApplication
@MapperScan("com.chuci.server.mapper")
public class CloudEServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(CloudEServerApplication.class, args);
    }
}

2.5 Cloud_e_server full directory

This concludes this section~~~

Next section:

this system column with finish whole remember record since Oneself term order through calendar This series is a complete record of your project experience This series is a complete record of your project experience

Keywords: Back-end

Added by Revlet on Wed, 12 Jan 2022 12:03:07 +0200