基于springboot的员工管理系统
作者:互联网
员工管理系统
数据库结构
代码结构
Maven依赖
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.dahai</groupId>
<artifactId>springboot-03-web</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot-03-web</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--log4j-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!--Druid-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<!-- 由于commons-fileupload组件不属于Spring Boot,所以需要加上版本 -->
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 单元测试 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
登录
登录页面支持中英文切换
登录中文
登录英文
进入首页
目前只做到增删改查,后续有时间会继续完善
添加员工
添加成功
修改员工
删除员工
查询员工
发现没有查询,那就自己写一个吧
<!--根据员工名字模糊查询-->
<select id="queryEmployeeByName" resultType="com.dahai.pojo.Employee">
select e.id, e.lastName, e.email, e.gender, e.birth, e.did, departmentName
from employ e
inner join department d on d.id = e.did
where lastName like concat('%',#{lastName},'%')
</select>
注意
- 这里要把部门名字打印出来,不然到时候查询到的部门为null
- 千万不要在
< select>< /select>
标签里面写注释,不然会报SQL语句参数越界异常。
如果没有该用户则会提示error
查询成功则会打印出所查询到的所有用户
Druid后台数据监控
SQL语句监控
log4j日志
打印控制台输出内容
》到此项目的增删改查基本完成,后续有时间会在此基础上继续完善。
标签:springboot,管理系统,spring,boot,springframework,员工,org,starter 来源: https://www.cnblogs.com/ldh-0319/p/16373912.html