开发流程
软件开发流程

角色分工

软件环境

项目介绍
本项目(瑞吉外卖)是专门为餐饮企业(餐厅、饭店)定制的一款软件产品,包括系统管理后台和移动端应用两部分
其中系统管理后台主要提供给餐饮企业内部员工使用,可以对餐厅的菜品、套餐、订单等进行管理维护。

移动端应用主要提供给消费者使用,可以在线浏览菜品、添加购物车、下单等。

本项目共分为3期进行开发
- 第一期主要实现基本需求,其中移动端应用通过H5实现,用户可以通过手机浏览器访问。
- 第二期主要针对移动端应用进行改进,使用微信小程序实现,用户使用起来更加方便。
- 第三期主要针对系统进行优化升级,提高系统的访问性能。
原型展示



技术选型

功能架构

系统角色

环境搭建
数据库环境搭建
创建项目对应的数据库, 图形界面或者命令行都可以

创建数据表, 资料中提供了建表语句

数据表概览

maven项目搭建
创建maven项目


导入pom.xml文件, 资料/项目配置文件/pom.xml
<?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">
<modelVersion>4.0.0</modelVersion>
<!--继承父工程-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.itheima</groupId>
<artifactId>reggle_take_out</artifactId>
<version>1.0-SNAPSHOT</version>
<!--指定jdk版本-->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<!--项目依赖-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.23</version>
</dependency>
</dependencies>
<!-- 插件-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.5</version>
</plugin>
</plugins>
</build>
</project>
导入Spring Boot配置文件, 资料/项目配置文件/application.yml
server:
port: 8080
spring:
application:
#配置应用名称,可选, 不配置时默认为项目文件夹名
name: reggie_take_out
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/数据库名称?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: 数据库账号
password: 数据库密码
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
创建启动类: 通过启动类启动程序, 控制台输出日志信息
@Slf4j
@SpringBootApplication
public class reggieApplication {
public static void main(String[] args) {
SpringApplication.run(reggieApplication.class, args);
log.info("项目启动成功...");
}
}
引入静态资源, 资料/前端资源, 放在resources目录下
@Slf4j
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
/**
* 设置静态资源映射
*/
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
log.info("开始进行静态资源映射");
// 只要前端访问路径包含backend, 就放行到resources目录下的backend目录下的资源
// classpath代表resources目录
registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
}
}
- 默认情况下, springboot工程的静态资源要放在static或者template文件夹下, 才能被访问到
- 我们可以通过静态资源映射, 让SpringMVC可以访问到指定的静态资源
- 新建config包, 以后所有和配置相关的类都放在这个包下
- 使用@Configuration注解 声明这是一个配置类, 让这个类继承WebMvcConfigurationSupport, 并且重写addResourceHandlers方法, 通过这个方法进行静态资源映射
- 通过registry参数指定具体的映射规则, 先指定前端的访问路径, 再指定访问的资源
- 访问资源: http://localhost:8080/backend/index.html