瑞吉外卖-Day1-项目简介

瑞吉外卖-业务开发

一、软件开发整体介绍

1.1、软件开发流程

瑞吉外卖-Day1-项目简介_第1张图片

1.2、角色分工

瑞吉外卖-Day1-项目简介_第2张图片

1.3、软件环境

瑞吉外卖-Day1-项目简介_第3张图片

二、项目介绍

瑞吉外卖-Day1-项目简介_第4张图片

2.1、项目简介

瑞吉外卖-Day1-项目简介_第5张图片

2.2、技术选型

瑞吉外卖-Day1-项目简介_第6张图片

2.3、功能架构

瑞吉外卖-Day1-项目简介_第7张图片

2.4、角色

瑞吉外卖-Day1-项目简介_第8张图片

三、开发环境搭建

3.1、数据库环境搭建(navicat)

3.1.1、创建数据库

瑞吉外卖-Day1-项目简介_第9张图片

3.1.2、导入表结构

瑞吉外卖-Day1-项目简介_第10张图片

3.1.3、数据库表

瑞吉外卖-Day1-项目简介_第11张图片

3.2、maven项目搭建

3.2.1、创建maven项目瑞吉外卖-Day1-项目简介_第12张图片

3.2.2、导入依赖

pom.xml


<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">
    <modelVersion>4.0.0modelVersion>

    
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.4.5version>
        <relativePath/> 
    parent>

    <groupId>com.xxxitgroupId>
    <artifactId>reggie_take_outartifactId>
    <version>1.0-SNAPSHOTversion>

    
    <properties>
        <java.version>1.8java.version>
    properties>

    <dependencies>

        
        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starterartifactId>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>

        
        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
            <scope>runtimescope>
        dependency>

        
        <dependency>
            <groupId>com.alibabagroupId>
            <artifactId>druid-spring-boot-starterartifactId>
            <version>1.1.23version>
        dependency>

        
        <dependency>
            <groupId>com.baomidougroupId>
            <artifactId>mybatis-plus-boot-starterartifactId>
            <version>3.4.2version>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
            <scope>compilescope>
        dependency>

        
        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <version>1.18.20version>
        dependency>

        
        <dependency>
            <groupId>com.alibabagroupId>
            <artifactId>fastjsonartifactId>
            <version>1.2.76version>
        dependency>

        
        <dependency>
            <groupId>commons-langgroupId>
            <artifactId>commons-langartifactId>
            <version>2.6version>
        dependency>

    dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
                <version>2.4.5version>
            plugin>
        plugins>
    build>

project>

3.2.3、编写配置文件

server:
  port: 8080

spring: #spring配置
  application:
    name: reggie_take_out     #项目名称
  datasource:     #数据库连接池
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/reggie?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
      username: root
      password: root

mybatis-plus:
    configuration:
      #在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
      map-underscore-to-camel-case: true
      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl   #开启日志
    global-config:
      db-config:    #表全局配置
        id-type: ASSIGN_ID    #所有表id使用ASSIGN_ID生成

3.2.4、启动类编写

package com.xxxit.reggie;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication
public class ReggieApplication {
    public static void main(String[] args) {
        SpringApplication.run(ReggieApplication.class, args);
        log.info("项目启动成功");
    }
}

3.2.5、导入前端页面

瑞吉外卖-Day1-项目简介_第13张图片

3.2.6、配置SpringMVC配置类设置静态资源映射

package com.xxxit.reggie.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
@Slf4j
public class WebMvcConfig extends WebMvcConfigurationSupport {

    /**
     *
     * @param registry
     */

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        log.info("开始进行静态资源映射...");
        registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
        registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
    }
}

你可能感兴趣的:(SpringBoot项目,spring,boot,spring,mvc)