1.项目运行环境
开发工具:
IDEA2022.3.5
Navicat16.0.11
所需环境:
JDK17及其以上
Mysql8.0及其以上
Tomcat9及其以上版本
2.项目要求
a.实现数据表的CRUD(增删改查)
b.实现网站的实时在线人数
c.实现Filter过滤器对未登录用户的过滤操作
3.项目包结构
src
main
java
com.hbsfdxwlxy.competition
exception(异常包)
mapper(持久层)
pojo(普通java类)
service(业务逻辑层)
utils(工具类)
web(控制层)
resource
logback.xml(logback日志)
mybatis-config.xml(Mybatis核心配置文件)
UserMapper.xml(用户映射文件)
DeptMapper.xml(部门映射文件)
webapp
add.jsp
.....
4.项目模式MVC与三层架构
MVC模式:
使用MVC架构模式,层与层之间采用接口进行解耦合
M(Model)层:主要是mapper,pojo,service包
V(View)层:webapp下
C(Controller)层:web
三层架构:
持久层:mapper(接口层)
直接用getMapper底层调用Javassist即可
业务逻辑层:service
serviceImpl
展示层:web
5.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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hbsfdxwlxy</groupId>
<artifactId>DeptManagedSys</artifactId>
<version>2.0</version>
<packaging>war</packaging>
<name>Competition Web App</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<!--MyBatis依赖-->
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.15</version>
</dependency>
<!--MySql依赖-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<!--logback日志依赖-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.web/jakarta.servlet.jsp.jstl -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>2.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api -->
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>DeptManagedSys</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>