基于springboot的员工管理系统

员工管理系统

数据库结构

image-20220613210911567

代码结构

image-20220613211429231

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>

登录

登录页面支持中英文切换

登录中文

image-20220613205228094

登录英文

image-20220613205324995

进入首页

目前只做到增删改查,后续有时间会继续完善

image-20220613211757952

添加员工

image-20220613212147046

添加成功

image-20220613212202563

修改员工

image-20220613212247158

删除员工

image-20220613212317757

查询员工

发现没有查询,那就自己写一个吧

<!--根据员工名字模糊查询-->
<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

image-20220614110422779

查询成功则会打印出所查询到的所有用户

image-20220614110446074

Druid后台数据监控

image-20220614110716885

SQL语句监控

image-20220614110810821

log4j日志

打印控制台输出内容

image-20220614111113826

》到此项目的增删改查基本完成,后续有时间会在此基础上继续完善。

posted @ 2022-06-14 11:29  海边蓝贝壳  阅读(568)  评论(0编辑  收藏  举报