项目框架:登录跳转页面

Posted Terminator of Bug

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了项目框架:登录跳转页面相关的知识,希望对你有一定的参考价值。

项目框架:登录跳转页面

运行结果:





代码整体布局:


代码如下:

proj_hr_yzh7.sql :(数据表备份代码)

/*
Navicat mysql Data Transfer

Source Server         : aaa
Source Server Version : 80012
Source Host           : localhost:3306
Source Database       : proj_hr_yzh7

Target Server Type    : MYSQL
Target Server Version : 80012
File Encoding         : 65001

Date: 2022-08-29 11:12:39
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for tbl_dept
-- ----------------------------
DROP TABLE IF EXISTS `tbl_dept`;
CREATE TABLE `tbl_dept` (
  `dept_id` int(11) NOT NULL AUTO_INCREMENT,
  `dept_name` varchar(20) DEFAULT NULL,
  `dept_desc` varchar(100) DEFAULT NULL,
  `state_flag` int(11) DEFAULT '0',
  `del_flag` int(11) DEFAULT '0',
  `create_by` varchar(20) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `update_by` varchar(20) DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`dept_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tbl_dept
-- ----------------------------
INSERT INTO `tbl_dept` VALUES ('1', '人事部', '管理员工', '0', '0', 'admin', '2022-08-29 10:17:41', null, null);
INSERT INTO `tbl_dept` VALUES ('2', 'IT部', '管理系统', '0', '0', 'admin', '2022-08-29 10:17:41', null, null);

-- ----------------------------
-- Table structure for tbl_emp
-- ----------------------------
DROP TABLE IF EXISTS `tbl_emp`;
CREATE TABLE `tbl_emp` (
  `emp_id` int(11) NOT NULL AUTO_INCREMENT,
  `emp_name` varchar(20) NOT NULL COMMENT '姓名',
  `username` varchar(20) DEFAULT NULL COMMENT '账号',
  `password` varchar(200) DEFAULT NULL COMMENT '密码',
  `sex` char(1) NOT NULL COMMENT '性别',
  `birthday` date DEFAULT NULL COMMENT '生日',
  `phone` varchar(11) NOT NULL COMMENT '手机',
  `email` varchar(50) NOT NULL COMMENT '邮箱',
  `address` varchar(100) DEFAULT NULL COMMENT '籍贯',
  `hire_date` date DEFAULT NULL COMMENT '入职日期',
  `leave_date` date DEFAULT NULL COMMENT '离职日期',
  `state_flag` int(11) DEFAULT '0' COMMENT '在职状态:0在职 1离职',
  `del_flag` int(11) DEFAULT '0' COMMENT '是否删除:0未删除 1删除',
  `avatar` varchar(200) DEFAULT NULL COMMENT '头像',
  `dept_id` int(11) DEFAULT NULL COMMENT '部门编号',
  `create_by` varchar(20) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(20) DEFAULT NULL COMMENT '修改人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`emp_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tbl_emp
-- ----------------------------
INSERT INTO `tbl_emp` VALUES ('1', '张三', 'zhangsan', '123456', '男', '2000-01-01', '13112345678', 'aaa@qq.com', '河南', '2010-10-10', null, '0', '0', null, '1', 'admin', '2022-08-29 10:23:02', null, null);
INSERT INTO `tbl_emp` VALUES ('2', '李四', 'lisi', '123456', '女', '2001-01-01', '13112345677', 'a22@qq.com', '河南', '2013-10-10', null, '0', '0', null, '2', 'admin', '2022-08-29 10:23:02', null, null);

-- ----------------------------
-- Table structure for tbl_emp_role
-- ----------------------------
DROP TABLE IF EXISTS `tbl_emp_role`;
CREATE TABLE `tbl_emp_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `emp_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tbl_emp_role
-- ----------------------------
INSERT INTO `tbl_emp_role` VALUES ('1', '1', '1');
INSERT INTO `tbl_emp_role` VALUES ('2', '2', '2');

-- ----------------------------
-- Table structure for tbl_menu
-- ----------------------------
DROP TABLE IF EXISTS `tbl_menu`;
CREATE TABLE `tbl_menu` (
  `menu_id` int(11) NOT NULL,
  `menu_name` varchar(100) NOT NULL COMMENT '菜单名字',
  `parent_id` int(11) DEFAULT NULL COMMENT '父级菜单编号',
  `menu_type` varchar(10) DEFAULT NULL COMMENT '菜单类型',
  `url` varchar(100) DEFAULT NULL COMMENT '菜单链接',
  `icon` varchar(100) DEFAULT NULL COMMENT '菜单图标',
  `create_by` varchar(20) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `update_by` varchar(20) DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`menu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tbl_menu
-- ----------------------------
INSERT INTO `tbl_menu` VALUES ('1', '系统管理', '0', 'M', '#', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('2', '性格测试', '0', 'M', '#', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('3', '问卷调查', '0', 'M', '#', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('4', '日志监控', '0', 'M', '#', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('5', '部门管理', '1', 'C', '/forward/toDept', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('6', '员工管理', '1', 'C', '/forward/toEmp', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('7', '角色管理', '1', 'C', '/forward/toRole', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('8', '权限管理', '1', 'C', '/forward/toMenu', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('9', '题目管理', '2', 'C', '/forward/toQuestion', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('10', '测试管理', '2', 'C', '/forward/toQuestionTester', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('11', '报表统计', '2', 'C', '/forward/toQuestionReport', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('12', '问卷管理', '3', 'C', '/forward/toQuestionnaire', null, null, null, null, null);
INSERT INTO `tbl_menu` VALUES ('13', '操作日志', '4', 'C', '/forward/toLog', null, null, null, null, null);

-- ----------------------------
-- Table structure for tbl_role
-- ----------------------------
DROP TABLE IF EXISTS `tbl_role`;
CREATE TABLE `tbl_role` (
  `role_id` int(11) NOT NULL AUTO_INCREMENT,
  `role_name` varchar(20) NOT NULL,
  `role_desc` varchar(200) NOT NULL,
  `state_flag` int(11) DEFAULT '0',
  `del_flag` int(11) DEFAULT '0',
  `create_by` varchar(20) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `update_by` varchar(20) DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tbl_role
-- ----------------------------
INSERT INTO `tbl_role` VALUES ('1', '管理员', '管理员', '0', '0', 'admin', '2022-08-29 10:25:38', null, null);
INSERT INTO `tbl_role` VALUES ('2', '人事经理', '人事经理', '0', '0', 'admin', '2022-08-29 10:25:38', null, null);
INSERT INTO `tbl_role` VALUES ('3', '测试人员', '测试人员', '0', '0', 'admin', '2022-08-29 10:25:38', null, null);

-- ----------------------------
-- Table structure for tbl_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `tbl_role_menu`;
CREATE TABLE `tbl_role_menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role_id` int(11) DEFAULT NULL,
  `menu_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tbl_role_menu
-- ----------------------------
INSERT INTO `tbl_role_menu` VALUES ('1', '1', '1');
INSERT INTO `tbl_role_menu` VALUES ('2', '1', '2');
INSERT INTO `tbl_role_menu` VALUES ('3', '1', '3');
INSERT INTO `tbl_role_menu` VALUES ('4', '1', '4');
INSERT INTO `tbl_role_menu` VALUES ('5', '1', '5');
INSERT INTO `tbl_role_menu` VALUES ('6', '1', '6');
INSERT INTO `tbl_role_menu` VALUES ('7', '1', '7');
INSERT INTO `tbl_role_menu` VALUES ('8', '1', '8');
INSERT INTO `tbl_role_menu` VALUES ('9', '1', '9');
INSERT INTO `tbl_role_menu` VALUES ('10', '1', '10');
INSERT INTO `tbl_role_menu` VALUES ('11', '1', '11');
INSERT INTO `tbl_role_menu` VALUES ('12', '1', '12');
INSERT INTO `tbl_role_menu` VALUES ('13', '1', '13');
INSERT INTO `tbl_role_menu` VALUES ('16', '2', '1');
INSERT INTO `tbl_role_menu` VALUES ('17', '2', '5');
INSERT INTO `tbl_role_menu` VALUES ('18', '2', '6');
INSERT INTO `tbl_role_menu` VALUES ('19', '2', '7');
INSERT INTO `tbl_role_menu` VALUES ('20', '2', '8');

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>

  <groupId>org.example</groupId>
  <artifactId>lesson0829_HRProj</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>lesson0829_HRProj Maven Webapp</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
    <servlet.version>4.0.1</servlet.version>
    <jsp.version>2.2</jsp.version>
    <jstl.version>1.2</jstl.version>
    <spring.version>5.3.14</spring.version>
    <commons-dbcp.version>1.4</commons-dbcp.version>
    <mybatis.version>3.4.6</mybatis.version>
    <mybatis-spring.version>1.3.3</mybatis-spring.version>
    <mysql-connector-java.version>8.0.11</mysql-connector-java.version>
    <fastjson.version>1.2.78</fastjson.version>
  </properties>
  <dependencies>
    <!-- 添加javaEE支持 -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>$servlet.version</version>
      <!-- provided只在编译时支持,发布时不拷贝文件 -->
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>$jsp.version</version>
      <!-- provided只在编译时支持,发布时不拷贝文件 -->
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>$jstl.version</version>
    </dependency>
    <!--引入spring基础模块-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>$spring.version</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>$spring.version</version>
    </dependency>
    <!-- dbcp连接池 -->
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>$commons-dbcp.version</version>
    </dependency>
    <!-- mybatis -->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>$mybatis.version</version>
    </dependency>
    <!-- mybatis spring整合 -->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>$mybatis-spring.version</version>
    </dependency>
    <!--mybatis插件PageHelper-->
    <dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper</artifactId>
      <version>5.1.0</version>
    </dependency>
    <dependency>
      <groupId>com.github.abel533</groupId>
      <artifactId>mapper</artifactId>
      <version>3.0.1</version>
    </dependency>
    <!-- mysql驱动类 -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>$mysql-connector-java.version</version>
    </dependency>
    <!--fastjson处理json数据-->
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>$fastjson.version</version>
    </dependency>
    <!--lombok 简化实体内容-->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.24</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.13.2.2</version>
    </dependency>
  </dependencies>
</project>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">

  <!--定义spring的配置文件,用于在spring监听器监听网站启动的时候,创建spring容器-->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring-mybatis.xml</param-value>
  </context-param>
  <!--配置spring监听器,用于创建spring容器-->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>


  <!--配置spring的编码过滤器-->
  <filter>
    <filter-name>characterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>characterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!--配置springMVC前端控制器-->
  <servlet>
    <servlet-name>springMVC</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <!--springMVC需要配置相关的组件(处理器映射器,适配器。。。)
         因此我们要自己定义配置文件,在配置文件中定义这些组件。
         如果自己没有定义这个配置文件,springMVC的前端控制器默认加载 servlet名字+servlet.xml这个文件
         找不到则报错。
         一般情况下,我们要自己在init-param中配置这个文件,param-name固定是contextConfigLocation
      -->
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:spring-mvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>springMVC</servlet-name>
    <!--凡是以.do结尾的请求都让springMVC来处理
    <url-pattern>*.do</url-pattern>
    -->
    <!-- 斜杠配置(/):表示所有的默认请求都交给DisaptherServlet来处理
                     导致的问题就是请求静态资源的时候无法处理
    -->
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</web-app>

ForwardController :

package com.aaa.hr.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/forward")
public class ForwardController 
    @RequestMapping(path = "/toLogin","/")
    public String toLogin()
        return "login";
    

    @RequestMapping("/toMain")
    public String toMain(Model model)
        //应该查询左侧菜单数据,渲染到页面上
        return "main";
    

    @RequestMapping("/toEmp")
    public String toEmp()
        return "emp";
    


EmpMapper.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.aaa.mapper.EmpMapper">

</mapper>

db.properties:

jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/proj_hr_yzh7?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true
jdbc.username=root
jdbc.password=123456

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <!-- 配置日志工具 -->
        <setting name="logImpl" value="STDOUT_LOGGING"/>
        <!--配置将下划线字段转为小驼峰-->
        <setting name="mapUnderscoreToCamelCase" value="true"/>
    </settings>
    <!--配置分页插件和通用Mapper插件-->
    <plugins>
        <!--拦截器-->
        <plugin interceptor="com.github.pagehelper.PageInterceptor">

            <property name="offsetAsPageNum" value="true"/>
            <!--配置数据库方言 4.0版本以后不用写-->
            <!--<property name="helperDialect" value="mysql"/>-->
            <!--是否做count查询-->
            <property name="rowBoundsWithCount" value="true"/>
            <!--合理化分页-->
            <property name="reasonable" value="true"/>
        </plugin>
        <plugin interceptor="com.github.abel533.mapperhelper.MapperInterceptor">
            <!--主键自增回写方法,默认值MYSQL -->
            <!--<property name="IDENTITY" value="MYSQL" />-->
            <!--通用Mapper默认接口,我们定义的Mapper需要实现该接口 -->
            <property name="mappers" value="com.github.abel533.mapper.Mapper" />
        </plugin>
    </plugins>
</configuration>

spring-mvc.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <!--扫描controller包,管理其中定义的controller类-->
    <context:component-scan base-package="com.aaa.hr.controller"/>
    <!--启用注解方式配置 springMVC请求使用的相关组件
        处理器映射器,处理器适配器,处理器(Controller...其他注解)
    -->
    <mvc:annotation-driven/>
    <!--视图解析器-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!--配置视图前缀-->
        <property name="prefix" value="/WEB-INF/page/"/>
        <!--配置视图后缀-->
        <property name="suffix" value=".jsp"/>
    </bean>

    <!--配置DefaultServlet处理其他请求(静态资源)-->
    <mvc:default-servlet-handler/>

</beans>

spring-mybatis.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

    <!--配置spring扫描包-->
    <context:component-scan base-package="com.aaa.hr.service"/>

    <!--通过spring配置数据库的连接属性文件-->
    <context:property-placeholder location="classpath:db.properties"/>
    <!--通过spring来配置数据库连接池的数据源对象-->
    <bean id="ds" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close">
        <!--配置连接池数据源需要使用四大金刚(数据库连接属性)-->
        <property name="driverClassName" value="$jdbc.driver"/>
        <property name="url" value="$jdbc.url"/>
        <property name="username" value="$jdbc.username"/>
        <property name="password" value="$jdbc.password"/>
    </bean>

    <!--通过spring来配置mybatis的会话工厂和其他相关配置
        原来的时候,mybatis的会话工厂由程序员来创建,现在通过spring来创建管理
        这个就体现了Spring的IoC特征(控制反转)
    -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <!--配置SqlSession依赖的数据源对象-->
        <property name="dataSource" ref="ds"/>
        <!--配置mybatis要使用的类型别名定义-->
        <property name="typeAliasesPackage" value="com.aaa.demo.entity"/>
        <!--配置mybatis的主配置文件的路径,spring会自动加载mybatis的配置文件-->
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
        <!--配置mybatis的Mapper文件的路径:spring中Mapper接口和Mapper文件路径可以由区别-->
        <property name="mapperLocations" value="classpath:com/mapper/*.xml"/>

    </bean>
    <!--通过spring来配置Mybatis的Mapper接口
        通过包扫描的方式进行配置
    -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <!--配置Mybatis的Mapper接口-->
        <property name="basePackage" value="com.aaa.demo.mapper"/>
        <!--配置可以创建Mapper接口对象的SqlSession使用的SqlSessionFactory对象的名字-->
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
    </bean>

</beans>


emp.jsp:

<%--
  Created by IntelliJ IDEA.
  User: henry
  Date: 2022/8/29
  Time: 10:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台主页</title>
    <link rel="stylesheet" href="$pageContext.request.contextPath/assets/layui/css/layui.css">
    <script src="$pageContext.request.contextPath/assets/layui/layui.all.js"></script>
</head>
<body style="">

<form style="display: none;" class="layui-form" lay-filter="staffForm" id="staffForm">
    <input name="sfid" style="display: none;">
    <div class="layui-form-item">
        <label class="layui-form-label">员工姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="sfname" placeholder="请输入员工姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-inline">
            <select name="sfsex" id="sfsex">
                <option value="">-请选择-</option>
                <option value="男">男</option>
                <option value="女">女</option>
            </select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="-请选择-" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">-请选择-</dd><dd lay-value="男" class="">男</dd><dd lay-value="女" class="">女</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-inline">
            <input type="text" name="sfage" id="sfage" placeholder="请输入年龄" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">身份证号</label>
        <div class="layui-input-inline">
            <input type="text" name="sfcode" id="sfcode" placeholder="请输入身份证号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话号</label>
        <div class="layui-input-inline">
            <input type="text" name="sftel" id="sftel" placeholder="请输入电话号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" id="area-picker">
        <div class="layui-input-inline" style="width: 100px;margin-left: 30px">
            <select name="province" class="province-selector" data-value="请选择" lay-filter="province-1" id="province"><option value=""></option><option value="北京市">北京市</option><option value="天津市">天津市</option><option value="河北省">河北省</option><option value="山西省">山西省</option><option value="内蒙古自治区">内蒙古自治区</option><option value="辽宁省">辽宁省</option><option value="吉林省">吉林省</option><option value="黑龙江省">黑龙江省</option><option value="上海市">上海市</option><option value="江苏省">江苏省</option><option value="浙江省">浙江省</option><option value="安徽省">安徽省</option><option value="福建省">福建省</option><option value="江西省">江西省</option><option value="山东省">山东省</option><option value="河南省">河南省</option><option value="湖北省">湖北省</option><option value="湖南省">湖南省</option><option value="广东省">广东省</option><option value="广西壮族自治区">广西壮族自治区</option><option value="海南省">海南省</option><option value="重庆市">重庆市</option><option value="四川省">四川省</option><option value="贵州省">贵州省</option><option value="云南省">云南省</option><option value="西藏自治区">西藏自治区</option><option value="陕西省">陕西省</option><option value="甘肃省">甘肃省</option><option value="青海省">青海省</option><option value="宁夏回族自治区">宁夏回族自治区</option><option value="新疆维吾尔自治区">新疆维吾尔自治区</option><option value="台湾省">台湾省</option><option value="香港特别行政区">香港特别行政区</option><option value="澳门特别行政区">澳门特别行政区</option><option value="海外">海外</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="请选择" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">请选择</dd><dd lay-value="北京市" class="">北京市</dd><dd lay-value="天津市" class="">天津市</dd><dd lay-value="河北省" class="">河北省</dd><dd lay-value="山西省" class="">山西省</dd><dd lay-value="内蒙古自治区" class="">内蒙古自治区</dd><dd lay-value="辽宁省" class="">辽宁省</dd><dd lay-value="吉林省" class="">吉林省</dd><dd lay-value="黑龙江省" class="">黑龙江省</dd><dd lay-value="上海市" class="">上海市</dd><dd lay-value="江苏省" class="">江苏省</dd><dd lay-value="浙江省" class="">浙江省</dd><dd lay-value="安徽省" class="">安徽省</dd><dd lay-value="福建省" class="">福建省</dd><dd lay-value="江西省" class="">江西省</dd><dd lay-value="山东省" class="">山东省</dd><dd lay-value="河南省" class="">河南省</dd><dd lay-value="湖北省" class="">湖北省</dd><dd lay-value="湖南省" class="">湖南省</dd><dd lay-value="广东省" class="">广东省</dd><dd lay-value="广西壮族自治区" class="">广西壮族自治区</dd><dd lay-value="海南省" class="">海南省</dd><dd lay-value="重庆市" class="">重庆市</dd><dd lay-value="四川省" class="">四川省</dd><dd lay-value="贵州省" class="">贵州省</dd><dd lay-value="云南省" class="">云南省</dd><dd lay-value="西藏自治区" class="">西藏自治区</dd><dd lay-value="陕西省" class="">陕西省</dd><dd lay-value="甘肃省" class="">甘肃省</dd><dd lay-value="青海省" class="">青海省</dd><dd lay-value="宁夏回族自治区" class="">宁夏回族自治区</dd><dd lay-value="新疆维吾尔自治区" class="">新疆维吾尔自治区</dd><dd lay-value="台湾省" class="">台湾省</dd><dd lay-value="香港特别行政区" class="">香港特别行政区</dd><dd lay-value="澳门特别行政区" class="">澳门特别行政区</dd><dd lay-value="海外" class="">海外</dd></dl></div>
        </div>
        <div class="layui-input-inline" style="width: 100px;margin-left: 10px">
            <select name="city" class="city-selector" data-value="请选择" lay-filter="city-1" id="city"><option value=""></option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="请选择" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">请选择</dd></dl></div>
        </div>
        <div class="layui-input-inline" style="width:100px;margin-left: 10px">
            <select name="county" class="county-selector" data-value="请选择" lay-filter="county-1" id="county"><option value=""></option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="请选择" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">请选择</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">家庭住址</label>
        <div class="layui-input-inline">
            <input type="text" name="sfaddress" placeholder="请输入地址" autocomplete="off" class="layui-input" id="address" lay-verify="address">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">入职日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="sfentry" id="test11" placeholder="yyyy年MM月dd日" lay-key="2">
            </div>
        </div>
    </div>
    <div class="layui-form-item" id="dp">
        <label class="layui-form-label">部门类型</label>
        <div class="layui-input-inline">
            <select name="dpid" id="dpType">
                <option value="">--请选择--</option>
                <option value="1">管理部</option><option value="2">人事部</option><option value="4">盘点部</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择--</dd><dd lay-value="1" class="">管理部</dd><dd lay-value="2" class="">人事部</dd><dd lay-value="4" class="">盘点部</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item" id="ps">
        <label class="layui-form-label">职位类型</label>
        <div class="layui-input-inline">
            <select name="rid" id="psType">
                <option value="">--请选择--</option>
                <option value="1">店长</option><option value="2">盘点员</option><option value="7">普通员工</option><option value="8">财务员</option><option value="9">老板</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择--</dd><dd lay-value="1" class="">店长</dd><dd lay-value="2" class="">盘点员</dd><dd lay-value="7" class="">普通员工</dd><dd lay-value="8" class="">财务员</dd><dd lay-value="9" class="">老板</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item" id="sta">
        <label class="layui-form-label">员工状态</label>
        <div class="layui-input-inline">
            <select name="sfstatus">
                <option value="">--请选择--</option>
                <option value="1">任职</option>
                <option value="2">冻结</option>
            </select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择--</dd><dd lay-value="1" class="">任职</dd><dd lay-value="2" class="">冻结</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-inline">
            <button class="layui-btn" lay-submit="" lay-filter="formDemo" style="margin-left: 110px">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary" style="margin: -38px 0 0 210px">重置</button>
        </div>
    </div>
</form>
<form style="display: none;" class="layui-form" lay-filter="branchForm" id="branchForm">
    <input name="sfid" style="display: none;">
    <div class="layui-form-item">
        <label class="layui-form-label">平调员工</label>
        <div class="layui-input-inline">
            <input type="text" name="sfname" autocomplete="off" class="layui-input" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属分店</label>
        <div class="layui-input-inline">
            <input type="text" name="brname" id="brone" autocomplete="off" class="layui-input" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属职位</label>
        <div class="layui-input-inline">
            <input type="text" name="pttype" id="rone" autocomplete="off" class="layui-input" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属部门</label>
        <div class="layui-input-inline">
            <input type="text" name="dpname" id="dpone" autocomplete="off" class="layui-input" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">平调分店</label>
        <div class="layui-input-inline">
            <select name="brid" id="brType1">
                <option value="">--请选择--</option>
            </select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择--</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">平调部门</label>
        <div class="layui-input-inline">
            <select name="dpid" id="dpType1">
                <option value="">--请选择--</option>
                <option value="1">管理部</option><option value="2">人事部</option><option value="4">盘点部</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择--</dd><dd lay-value="1" class="">管理部</dd><dd lay-value="2" class="">人事部</dd><dd lay-value="4" class="">盘点部</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">平调职位</label>
        <div class="layui-input-inline">
            <select name="rid" id="psType1">
                <option value="">--请选择--</option>
                <option value="1">店长</option><option value="2">盘点员</option><option value="7">普通员工</option><option value="8">财务员</option><option value="9">老板</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择--</dd><dd lay-value="1" class="">店长</dd><dd lay-value="2" class="">盘点员</dd><dd lay-value="7" class="">普通员工</dd><dd lay-value="8" class="">财务员</dd><dd lay-value="9" class="">老板</dd></dl></div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-inline">
            <button class="layui-btn" lay-submit="" lay-filter="formDemo2" style="margin-left: 150px">提交审核</button>
        </div>
    </div>
</form>


<div class="layui-collapse">
    <div class="layui-colla-item">
        <h2 class="layui-colla-title">搜索<i class="layui-icon layui-colla-icon"></i></h2>
        <div class="layui-colla-content layui-show">
            <div class="demoTable layui-form">
                <div class="layui-inline">
                    <input class="layui-input" placeholder="请输入员工编号" name="sfid" id="sfid" autocomplete="off">
                </div>
                <div class="layui-inline">
                    <input class="layui-input" placeholder="请输入员工姓名" name="sfname" id="sfname" autocomplete="off">
                </div>
                <div class=" layui-input-inline">
                    <select name="dpid" id="searchType">
                        <option value="">--请选择部门--</option>
                        <option value="1">管理部</option><option value="2">人事部</option><option value="4">盘点部</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择部门--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择部门--</dd><dd lay-value="1" class="">管理部</dd><dd lay-value="2" class="">人事部</dd><dd lay-value="4" class="">盘点部</dd></dl></div>
                </div>
                <div class=" layui-input-inline" id="brths">
                    <select name="brid" id="branchType">
                        <option value="">--请选择分店--</option>
                        <option value="1">总店</option><option value="2">北京二号店</option><option value="14">北京一号店1</option><option value="20">北京朝阳区分店</option><option value="21">河南</option><option value="22">郑州一号店</option></select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="--请选择分店--" value="" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit"><dd lay-value="" class="layui-select-tips">--请选择分店--</dd><dd lay-value="1" class="">总店</dd><dd lay-value="2" class="">北京二号店</dd><dd lay-value="14" class="">北京一号店1</dd><dd lay-value="20" class="">北京朝阳区分店</dd><dd lay-value="21" class="">河南</dd><dd lay-value="22" class="">郑州一号店</dd></dl></div>
                </div>
                <div class="layui-inline">
                    <input type="text" class="layui-input" name="testtime" id="test10" placeholder="入职日期时间范围" lay-key="1">
                </div>
                <button class="layui-btn" id="staffSearch" data-type="reload">搜索</button>
            </div>
        </div>
    </div>
</div>
<table id="demo" lay-filter="test" style="margin-top: -10px;"></table><div class="layui-form layui-border-box layui-table-view" lay-filter="LAY-table-1" lay-id="test" style=" "><div class="layui-table-tool"><div class="layui-table-tool-temp"> <div class="layui-btn-container"> <button class="layui-btn layui-btn-sm" lay-event="add">新增</button> <button class="layui-btn layui-btn-sm" lay-event="refresh">刷新</button> </div> </div><div class="layui-table-tool-self"><div class="layui-inline" title="筛选列" lay-event="LAYTABLE_COLS"><i class="layui-icon layui-icon-cols"></i></div><div class="layui-inline" title="导出" lay-event="LAYTABLE_EXPORT"><i class="layui-icon layui-icon-export"></i></div><div class="layui-inline" title="打印" lay-event="LAYTABLE_PRINT"><i class="layui-icon layui-icon-print"></i></div></div></div><div class="layui-table-box"><div class="layui-table-header"><table class="layui-table" lay-even="" cellspacing="0" cellpadding="0" border="0"><thead><tr><th data-field="sfid" data-key="1-0-0" class=" layui-unselect"><div class="layui-table-cell laytable-cell-1-0-0" align="center"><span>员工编号</span><span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc" title="升序"></i><i class="layui-edge layui-table-sort-desc" title="降序"></i></span></div></th><th data-field="sfname" data-key="1-0-1" class=""><div class="layui-table-cell laytable-cell-1-0-1" align="center"><span>姓名</span></div></th><th data-field="sfsex" data-key="1-0-2" class=" layui-unselect"><div class="layui-table-cell laytable-cell-1-0-2" align="center"><span>性别</span><span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc" title="升序"></i><i class="layui-edge layui-table-sort-desc" title="降序"></i></span></div></th><th data-field="sfage" data-key="1-0-3" class=""><div class="layui-table-cell laytable-cell-1-0-3" align="center"><span>年龄</span></div></th><th data-field="sfcode" data-key="1-0-4" class=""><div class="layui-table-cell laytable-cell-1-0-4"><span>身份证号</span></div></th><th data-field="sftel" data-key="1-0-5" class=""><div class="layui-table-cell laytable-cell-1-0-5"><span>电话号</span></div></th><th data-field="sfaddress" data-key="1-0-6" class=""><div class="layui-table-cell laytable-cell-1-0-6"><span>家庭住址</span></div></th><th data-field="sfentry" data-key="1-0-7" class=" layui-unselect"><div class="layui-table-cell laytable-cell-1-0-7"><span>入职时间</span><span class="layui-table-sort layui-inline"><i class="layui-edge layui-table-sort-asc" title="升序"></i><i class="layui-edge layui-table-sort-desc" title="降序"></i></span></div></th><th data-field="sfquit" data-key="1-0-8" class="layui-hide"><div class="layui-table-cell laytable-cell-1-0-8"><span>离职时间</span></div></th><th data-field="dpid" data-key="1-0-9" class="layui-hide"><div class="layui-table-cell laytable-cell-1-0-9"><span>部门编号</span></div></th><th data-field="rid" data-key="1-0-10" class="layui-hide"><div class="layui-table-cell laytable-cell-1-0-10"><span>职位编号</span></div></th><th data-field="position.pttype" data-key="1-0-11" class=""><div class="layui-table-cell laytable-cell-1-0-11" align="center"><span>职位</span></div></th><th data-field="department.dpname" data-key="1-0-12" class=""><div class="layui-table-cell laytable-cell-1-0-12" align="center"><span>部门</span></div></th><th data-field="branch.brname" data-key="1-0-13" class=""><div class="layui-table-cell laytable-cell-1-0-13" align="center"><span>分店</span></div></th><th data-field="sfstatus" data-key="1-0-14" class=""><div class="layui-table-cell laytable-cell-1-0-14" align="center"><span>员工状态</span></div></th><th data-field="15" data-key="1-0-15" class=" layui-table-col-special"><div class="layui-table-cell laytable-cell-1-0-15"><span>操作</span></div></th></tr></thead></table></div><div class="layui-table-body layui-table-main"><table class="layui-table" lay-even="" cellspacing="0" cellpadding="0" border="0"><tbody><tr data-index

以上是关于项目框架:登录跳转页面的主要内容,如果未能解决你的问题,请参考以下文章

thinkphp 退出登录跳转页面时怎么从框架(frame)里跳出来?

jsp页面frame框架中的src指向另一个系统的asp登录页面不能跳转

若依前后端分离框架去掉首页 登录后跳转至动态路由的第一个路由

vue-element-admin 登出切换用户后重新登录跳转404页面Bug-解决记录

JSP中解决session超时跳转到登陆页面并跳出iframe框架或局部区域的方法

web项目长时间未操作,退出登录,跳转到登录页面