SSM企业权限管理系统

本次案例以实现功能为思路编写,如果想了解SSM整合思路,可以阅览SSM综合整合基础案例

一、功能介绍

  1. 商品查询: 基于SSM整合基础上完成商品查询
  2. 商品添加: 完成商品添加功能,实现事务操作
  3. 订单分页查询: 使用mybatis分页插件PageHelper完成简单的多表查询操作
  4. 订单详情查询: 订单详情是用于查询某一个订单的完整信息
  5. 用户管理: 实现基于spring Security的用户登录、退出操作;以及用户查询、添加、详情操作
  6. 角色管理: 角色管理主要完成角色查询、角色添加、角色删除
  7. 资源权限管理: 资源权限管理主要完成查询、添加、删除操作,用于赋予角色操作权限
  8. 权限关联与控制: 主要会讲解用户角色关联、角色权限关联
  9. AOP日志处理: 使用spring AOP切面来完成系统级别的日志收集

二、实现步骤

1.创建数据库

  1. 产品表
CREATE TABLE product(
	id INT NOT NULL AUTO_INCREMENT,		--无意义,主键
	productNum VARCHAR(60),			--产品编号
	productName VARCHAR(60),		--产品名称(路线名称)
	cityName VARCHAR(60),			--出发城市
	DepartureTime TIMESTAMP,		--出发时间
	productPrice DOUBLE,			--产品价格
	productDesc VARCHAR(600),		--产品描述
	productStatus INT,				--状态(0 关闭 1 开启)
	PRIMARY KEY (id)
);

  1. 会员表
CREATE TABLE member(
       id INT PRIMARY KEY AUTO_INCREMENT, --无意义、主键
       NAME VARCHAR(20),	--姓名
       nickname VARCHAR(20),	--昵称
       phoneNum VARCHAR(20),	--电话号码
       email VARCHAR(20) 	--邮箱
);

  1. 订单表
CREATE TABLE orders(
  id INT PRIMARY KEY AUTO_INCREMENT,	--无意义、主键
  orderNum VARCHAR(20) NOT NULL UNIQUE,	--订单编号 不为空 唯一
  orderTime TIMESTAMP,		--下单时间
  peopleCount INT,		--出行人数
  orderDesc VARCHAR(500),	--订单描述(其它信息)
  payType INT,		--支付方式(0 支付宝 1 微信 2其它)
  orderStatus INT,	--订单状态(0 未支付 1 已支付)
  productId INT,	--产品id 外键
  memberId INT,		--会员(联系人)id 外键
  FOREIGN KEY (productId) REFERENCES product(id),
  FOREIGN KEY (memberId) REFERENCES member(id)
);

  1. 游客表
CREATE TABLE traveller(
  id INT PRIMARY KEY AUTO_INCREMENT,	--无意义、主键
  NAME VARCHAR(20),		--姓名
  sex VARCHAR(20),		--性别
  phoneNum VARCHAR(20),		--电话号码
  credentialsType INT,		--证件类型 0身份证 1护照 2军官证
  credentialsNum VARCHAR(50),	--证件号码
  travellerType INT		--旅客类型(人群) 0 成人 1 儿童
);

  1. 订单与游客中间表
CREATE TABLE order_traveller(
  orderId INT,		--订单主键
  travellerId INT(32),		--旅客主键
  PRIMARY KEY (orderId,travellerId),
  FOREIGN KEY (orderId) REFERENCES orders(id),
  FOREIGN KEY (travellerId) REFERENCES traveller(id)
);

  1. 产品、会员、订单、游客之间的表结构
    在这里插入图片描述

  2. 用户表

CREATE TABLE users(
	id INT PRIMARY KEY AUTO_INCREMENT,	--无意义,主键
	email VARCHAR(60) UNIQUE NOT NULL,	--非空,唯一
	username VARCHAR(60),				--用户名
	usersPASSWORD VARCHAR(60),			--密码(加密)
	phoneNum VARCHAR(60),				--电话
	usersSTATUS INT						-- 状态0 未开启 1 开启
);

  1. 角色表
CREATE TABLE role(
	id INT PRIMARY KEY AUTO_INCREMENT,	--无意义,主键
	roleName VARCHAR(60) ,				--角色名
	roleDesc VARCHAR(60)				--角色描述
);

  1. 用户角色关联表
CREATE TABLE users_role(
	userId INT,
	roleId INT,
	PRIMARY KEY(userId,roleId),
	FOREIGN KEY (userId) REFERENCES users(id),
	FOREIGN KEY (roleId) REFERENCES role(id)
);

  1. 资源权限表
CREATE TABLE permission(
	id INT PRIMARY KEY AUTO_INCREMENT,	--无意义,主键
	permissionName VARCHAR(60) ,		--权限名
	url VARCHAR(60)						--资源路径
);

  1. 角色权限关联表
CREATE TABLE role_permission(
	permissionId INT,
	roleId INT,
	PRIMARY KEY(permissionId,roleId),
	FOREIGN KEY (permissionId) REFERENCES permission(id),
	FOREIGN KEY (roleId) REFERENCES role(id)
);

  1. 用户、角色、权限之间的表结构
    在这里插入图片描述

  2. 日志表

CREATE TABLE sysLog(
	id INT PRIMARY KEY AUTO_INCREMENT,	--主键 无意义
	visitTime TIMESTAMP,			--访问时间
	username VARCHAR(60),			--操作者用户名
	ip VARCHAR(30),					--访问ip
	url VARCHAR(60),				--访问资源url
	executionTime INT,				--执行时长
	method VARCHAR(300)				--访问方法
);

2.jar坐标依赖

1.引入父工程jar坐标依赖

<?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>com.hzxy</groupId>
    <artifactId>ssm_day01</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>maven_web</module>
        <module>maven_dao</module>
        <module>maven_domain</module>
        <module>maven_utils</module>
        <module>maven_service</module>
    </modules>
    <properties>
        <spring.version>5.0.2.RELEASE</spring.version>
        <slf4j.version>1.6.6</slf4j.version>
        <log4j.version>1.2.12</log4j.version>
        <mysql.version>8.0.13</mysql.version>
        <mybatis.version>3.4.5</mybatis.version>
        <spring.security.version>5.0.1.RELEASE</spring.security.version>
    </properties>

    <dependencies>        <!-- spring -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.6.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>

        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>        <!-- log start -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
        </dependency>        <!-- log end -->

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>${mybatis.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>5.1.2</version>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
    
</project>

2.引入子工程jar坐标依赖

  1. maven_utils
<?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">
    <parent>
        <artifactId>ssm_day01</artifactId>
        <groupId>com.hzxy</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>maven_utils</artifactId>
</project>

  1. maven_domain
<?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">
    <parent>
        <artifactId>ssm_day01</artifactId>
        <groupId>com.hzxy</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>maven_domain</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.hzxy</groupId>
            <artifactId>maven_utils</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

    </dependencies>

</project>

  1. maven_dao
<?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">
    <parent>
        <artifactId>ssm_day01</artifactId>
        <groupId>com.hzxy</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>maven_dao</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.hzxy</groupId>
            <artifactId>maven_domain</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

    </dependencies>

</project>

  1. maven_service
<?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">
    <parent>
        <artifactId>ssm_day01</artifactId>
        <groupId>com.hzxy</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>maven_service</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.hzxy</groupId>
            <artifactId>maven_domain</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.hzxy</groupId>
            <artifactId>maven_dao</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>

  1. maven_web
<?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">
    <parent>
        <artifactId>ssm_day01</artifactId>
        <groupId>com.hzxy</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>maven_web</artifactId>
    <packaging>war</packaging>

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.hzxy</groupId>
            <artifactId>maven_service</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>

3.编写配置文件

1.applicationContext.xml

编写Spring配置文件applicationContext.xml(Spring整合MyBatis)

1. 导入约束
2.开启注解扫描,管理service和dao

Spring整合MyBatis框架
1. 配置连接池
2. 配置SqlSessionFactory工厂
3. 配置接口所在包

配置Spring框架声明式事务管理
1. 配置事务管理器
2. 配置事务通知
3. 配置AOP增强

<?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:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans.xsd
	http://www.springframework.org/schema/context
	http://www.springframework.org/schema/context/spring-context.xsd
	http://www.springframework.org/schema/aop
	http://www.springframework.org/schema/aop/spring-aop.xsd
	http://www.springframework.org/schema/tx
	http://www.springframework.org/schema/tx/spring-tx.xsd">

    <!-- 开启注解扫描,管理service和dao -->
    <context:component-scan base-package="com.hzxy.service">
    </context:component-scan>
    <context:component-scan base-package="com.hzxy.dao">
    </context:component-scan>

    <context:property-placeholder location="classpath:jdbcConfig.properties"/>

    <!-- 配置连接池 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="${jdbc.driver}"/>
        <property name="jdbcUrl" value="${jdbc.url}"/>
        <property name="user" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>

    <!--配置SqlSessionFactory工厂,把交给IOC管理 SqlSessionFactory-->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <!-- 传入PageHelper的插件 -->
        <property name="plugins">
            <array>
                <!-- 传入插件的对象 -->
                <bean class="com.github.pagehelper.PageInterceptor">
                    <property name="properties">
                        <props>
                            <prop key="helperDialect">mysql</prop>
                            <prop key="reasonable">true</prop>
                        </props>
                    </property>
                </bean>
            </array>
        </property>
    </bean>

    <!--配置接口所在包,扫描dao接口-->
    <bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.hzxy.dao"/>
    </bean>

    <!-- 配置Spring的声明式事务管理 -->
    <!-- 配置事务管理器 -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>
</beans>

2.web.xml

web.xml配置Spring MVC核心控制器(Spring整合Spring MVC和实现spring-security功能)

1.配置加载类路径的配置文件:applicationContext.xml、spring-security.xml
2.配置前端核心控制器(DispatcherServlet)
3.解决乱码问题
4.配置监听器
5.实现spring-security功能

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

    <!-- 配置加载类路径的配置文件 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:applicationContext.xml,classpath*:spring-security.xml</param-value>
    </context-param>

    <!-- 配置监听器 -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- 前端控制器(加载classpath:springmvc.xml 服务器启动创建servlet) -->
    <servlet>
        <servlet-name>dispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <!-- 配置初始化参数,创建完DispatcherServlet对象,加载springmvc.xml配置文件 -->
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring-mvc.xml</param-value>
        </init-param>
        <!-- 服务器启动的时候,让DispatcherServlet对象创建 -->
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcherServlet</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- 解决中文乱码过滤器 -->
    <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>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <error-page>
        <error-code>403</error-code>
        <location>/403.jsp</location>
    </error-page>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
</web-app>

3.springmvc.xml

Spring MVC配置文件springmvc.xml

1. 开启注解扫描,只扫描Controller注解
2. 配置的视图解析器对象
3. 过滤静态资源
4. 开启SpringMVC注解的支持
5.AOP的注解支持

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

    <!-- 扫描controller的注解,别的不扫描 -->
    <context:component-scan base-package="com.hzxy.controller">
    </context:component-scan>

    <!-- 配置视图解析器 -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!-- JSP文件所在的目录 -->
        <property name="prefix" value="/pages/" />
        <!-- 文件的后缀名 -->
        <property name="suffix" value=".jsp" />
    </bean>

    <!-- 设置静态资源不过滤 -->
    <mvc:resources location="/css/" mapping="/css/**" />
    <mvc:resources location="/img/" mapping="/img/**" />
    <mvc:resources location="/js/" mapping="/js/**" />
    <mvc:resources location="/plugins/" mapping="/plugins/**" />

    <!-- 开启对SpringMVC注解的支持 -->
    <mvc:annotation-driven />

    <!--
        支持AOP的注解支持,AOP底层使用代理技术
        JDK动态代理,要求必须有接口
        cglib代理,生成子类对象,proxy-target-class="true" 默认使用cglib的方式
    -->
    <aop:aspectj-autoproxy proxy-target-class="true"/>

</beans>

4.spring-security.xml

(spring security配置文件)

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


    <!-- 配置不拦截的资源 -->
    <security:http pattern="/login.jsp" security="none"/>
    <security:http pattern="/failer.jsp" security="none"/>
    <security:http pattern="/css/**" security="none"/>
    <security:http pattern="/img/**" security="none"/>
    <security:http pattern="/plugins/**" security="none"/>


    <!--
    	配置具体的规则
    	auto-config="true"	不用自己编写登录的页面,框架提供默认登录页面
    	use-expressions="false"	是否使用SPEL表达式(没学习过)
    -->
    <security:http auto-config="true" use-expressions="false">
        <!-- 配置具体的拦截的规则 pattern="请求路径的规则" access="访问系统的人,必须有ROLE_USER的角色" -->
        <security:intercept-url pattern="/**" access="ROLE_USER,ROLE_ADMIN"/>

        <!-- 定义跳转的具体的页面 -->
        <security:form-login
                login-page="/login.jsp"
                login-processing-url="/login.do"
                default-target-url="/index.jsp"
                authentication-failure-url="/failer.jsp"
                authentication-success-forward-url="/pages/main.jsp"
        />

        <!-- 关闭跨域请求 -->
        <security:csrf disabled="true"/>
        <!-- 退出 -->
        <security:logout invalidate-session="true" logout-url="/logout.do" logout-success-url="/login.jsp" />

    </security:http>

    <!-- 切换成数据库中的用户名和密码 -->
    <security:authentication-manager>
        <security:authentication-provider user-service-ref="userService">
            <!-- 配置加密的方式
            <security:password-encoder ref="passwordEncoder"/>-->
        </security:authentication-provider>
    </security:authentication-manager>

    <!-- 配置加密类 -->
    <bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/>

</beans>

4.各实现类和接口

1.utils模块

package com.hzxy.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    //日期转换成字符串
    public static String date2String(Date date, String patt) {
        SimpleDateFormat sdf = new SimpleDateFormat(patt);
        String format = sdf.format(date);
        return format;
    }

    //字符串转换成日期
    public static Date string2Date(String str, String patt) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat(patt);
        Date parse = sdf.parse(str);
        return parse;
    }
}

2.domain模块

  1. Product
package com.hzxy.domain;

import com.hzxy.utils.DateUtils;

import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class Product {
    private String id; // 主键
    private String productNum; // 编号 唯一
    private String productName; // 名称
    private String cityName; // 出发城市
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    private Date departureTime; // 出发时间
    private String departureTimeStr;    //页面只能展示String类型,方便页面的展示
    private double productPrice; // 产品价格
    private String productDesc; // 产品描述
    private Integer productStatus; // 状态 0 关闭 1 开启
    private String productStatusStr;    //页面只能展示String类型,方便页面的展示

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getProductNum() {
        return productNum;
    }

    public void setProductNum(String productNum) {
        this.productNum = productNum;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public Date getDepartureTime() {
        return departureTime;
    }

    public void setDepartureTime(Date departureTime) {
        this.departureTime = departureTime;
    }

    public String getDepartureTimeStr() {
        if(departureTime!=null){
            departureTimeStr= DateUtils.date2String(departureTime,"yyyy-MM-dd HH:mm:ss");
        }
        return departureTimeStr;
    }

    public void setDepartureTimeStr(String departureTimeStr) {
        this.departureTimeStr = departureTimeStr;
    }

    public double getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(double productPrice) {
        this.productPrice = productPrice;
    }

    public String getProductDesc() {
        return productDesc;
    }

    public void setProductDesc(String productDesc) {
        this.productDesc = productDesc;
    }

    public Integer getProductStatus() {
        return productStatus;
    }

    public void setProductStatus(Integer productStatus) {
        this.productStatus = productStatus;
    }

    public String getProductStatusStr() {
        if (productStatus != null) {
            // 状态 0 关闭 1 开启
            if(productStatus==0)
                productStatusStr="关闭";
            if(productStatus==1)
                productStatusStr="开启";
        }
        return productStatusStr;
    }

    public void setProductStatusStr(String productStatusStr) {
        this.productStatusStr = productStatusStr;
    }
}


  1. Orders
package com.hzxy.domain;

import com.hzxy.utils.DateUtils;

import java.util.Date;
import java.util.List;

//订单
public class Orders {
    private String id;
    private String orderNum;
    private Date orderTime;
    private String orderTimeStr;
    private int orderStatus;
    private String orderStatusStr;
    private int peopleCount;
    private Product product;
    private List<Traveller> travellers;
    private Member member;
    private Integer payType;
    private String payTypeStr;
    private String orderDesc;

    public String getOrderStatusStr() {
        //订单状态(0 未支付 1 已支付)
        if(orderStatus==0){
            orderStatusStr="未支付";
        }else if(orderStatus==1){
            orderStatusStr="已支付";
        }
        return orderStatusStr;
    }

    public void setOrderStatusStr(String orderStatusStr) {
        this.orderStatusStr = orderStatusStr;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderTimeStr() {
        if(orderTime!=null){
            orderTimeStr= DateUtils.date2String(orderTime,"yyyy-MM-dd HH:mm");
        }
        return orderTimeStr;
    }

    public void setOrderTimeStr(String orderTimeStr) {
        this.orderTimeStr = orderTimeStr;
    }

    public int getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(int orderStatus) {
        this.orderStatus = orderStatus;
    }

    public int getPeopleCount() {
        return peopleCount;
    }

    public void setPeopleCount(int peopleCount) {
        this.peopleCount = peopleCount;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public List<Traveller> getTravellers() {
        return travellers;
    }

    public void setTravellers(List<Traveller> travellers) {
        this.travellers = travellers;
    }

    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public String getPayTypeStr() {
        //支付方式(0 支付宝 1 微信 2其它)
        if(payType==0){
            payTypeStr="支付宝";
        }else if(payType==1){
            payTypeStr="微信";
        }else if(payType==2){
            payTypeStr="其它";
        }
        return payTypeStr;
    }

    public void setPayTypeStr(String payTypeStr) {
        this.payTypeStr = payTypeStr;
    }

    public String getOrderDesc() {
        return orderDesc;
    }

    public void setOrderDesc(String orderDesc) {
        this.orderDesc = orderDesc;
    }
}


  1. Member
package com.hzxy.domain;


//会员
public class Member {
    private String id;
    private String name;
    private String nickname;
    private String phoneNum;
    private String email;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}


  1. Traveller
package com.hzxy.domain;

//旅客
public class Traveller {
    private String id;
    private String name;
    private String sex;
    private String phoneNum;
    private Integer credentialsType; //证件类型 0身份证 1护照 2军官证
    private String credentialsTypeStr;
    private String credentialsNum;
    private Integer travellerType; //旅客类型(人群) 0 成人 1 儿童
    private String travellerTypeStr;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public Integer getCredentialsType() {
        return credentialsType;
    }

    public void setCredentialsType(Integer credentialsType) {
        this.credentialsType = credentialsType;
    }

    public String getCredentialsTypeStr() {
        //证件类型 0身份证 1护照 2军官证
        if (credentialsType != null) {
            if (credentialsType == 0) {
                credentialsTypeStr = "身份证";
            } else if (credentialsType == 1) {
                credentialsTypeStr = "护照";
            } else if (credentialsType == 2) {
                credentialsTypeStr = "军官证";
            }
        }
        return credentialsTypeStr;
    }

    public void setCredentialsTypeStr(String credentialsTypeStr) {
        this.credentialsTypeStr = credentialsTypeStr;
    }

    public String getCredentialsNum() {
        return credentialsNum;
    }

    public void setCredentialsNum(String credentialsNum) {
        this.credentialsNum = credentialsNum;
    }

    public Integer getTravellerType() {
        return travellerType;
    }

    public void setTravellerType(Integer travellerType) {
        this.travellerType = travellerType;
    }

    public String getTravellerTypeStr() {
        旅客类型(人群) 0 成人 1 儿童
        if (travellerType != null) {
            if (travellerType == 0) {
                travellerTypeStr = "成人";
            } else if (travellerType == 1) {
                travellerTypeStr = "儿童";
            }
        }
        return travellerTypeStr;
    }

    public void setTravellerTypeStr(String travellerTypeStr) {
        this.travellerTypeStr = travellerTypeStr;
    }
}


  1. UserInfo
package com.hzxy.domain;


import java.util.List;

//与数据库中users对应
public class UserInfo {
    private String id;
    private String username;
    private String email;
    private String password;
    private String phoneNum;
    private int status;
    private String statusStr;
    private List<Role> roles;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }



    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public String getStatusStr() {
        //状态0 未开启 1 开启
        if (status == 0) {
            statusStr = "未开启";
        } else if (status == 1) {
            statusStr = "开启";
        }
        return statusStr;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }
}


  1. Role
package com.hzxy.domain;

import java.util.List;

public class Role {
    private String id;
    private String roleName;
    private String roleDesc;
    private List<Permission> permissions;
    private List<UserInfo> users;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getRoleDesc() {
        return roleDesc;
    }

    public void setRoleDesc(String roleDesc) {
        this.roleDesc = roleDesc;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    public List<UserInfo> getUsers() {
        return users;
    }

    public void setUsers(List<UserInfo> users) {
        this.users = users;
    }
}


  1. Permission
package com.hzxy.domain;

import java.util.List;

public class Permission {
    private String id;
    private String permissionName;
    private String url;
    private List<Role> roles;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPermissionName() {
        return permissionName;
    }

    public void setPermissionName(String permissionName) {
        this.permissionName = permissionName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }
}


  1. SysLog
package com.hzxy.domain;

import com.hzxy.utils.DateUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class SysLog {
    private String id;
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    private Date visitTime;
    private String visitTimeStr;
    private String username;
    private String ip;
    private String url;
    private Long executionTime;
    private String method;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getVisitTime() {
        return visitTime;
    }

    public void setVisitTime(Date visitTime) {
        this.visitTime = visitTime;
    }


    public String getVisitTimeStr() {
        if(visitTime!=null){
            visitTimeStr= DateUtils.date2String(visitTime,"yyyy-MM-dd HH:mm:ss");
        }
        return visitTimeStr;
    }

    public void setVisitTimeStr(String departureTimeStr) {
        this.visitTimeStr = visitTimeStr;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Long getExecutionTime() {
        return executionTime;
    }

    public void setExecutionTime(Long executionTime) {
        this.executionTime = executionTime;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }
}


3.dao模块

  1. IProductDao
package com.hzxy.dao;

import com.hzxy.domain.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IProductDao {

    //根据id查询产品
    @Select("select * from product where id=#{id}")
    public Product findById(String id) throws Exception;

    //查询所有的产品信息
    @Select("select * from product")
    public List<Product> findAll() throws Exception;

    @Insert("insert into product(productNum,productName,cityName,departureTime,productPrice,productDesc,productStatus) values(#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    void save(Product product);
}


  1. IOrdersDao
package com.hzxy.dao;

import com.hzxy.domain.Member;
import com.hzxy.domain.Orders;
import com.hzxy.domain.Product;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IOrdersDao {

    @Select("select * from orders")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "orderNum", column = "orderNum"),
            @Result(property = "orderTime", column = "orderTime"),
            @Result(property = "orderStatus", column = "orderStatus"),
            @Result(property = "peopleCount", column = "peopleCount"),
            @Result(property = "peopleCount", column = "peopleCount"),
            @Result(property = "payType", column = "payType"),
            @Result(property = "orderDesc", column = "orderDesc"),
            @Result(property = "product", column = "productId", javaType = Product.class, one = @One(select = "com.hzxy.dao.IProductDao.findById")),
    })
    public List<Orders> findAll() throws Exception;

    //多表操作
    @Select("select * from orders where id=#{ordersId}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "orderNum", column = "orderNum"),
            @Result(property = "orderTime", column = "orderTime"),
            @Result(property = "orderStatus", column = "orderStatus"),
            @Result(property = "peopleCount", column = "peopleCount"),
            @Result(property = "peopleCount", column = "peopleCount"),
            @Result(property = "payType", column = "payType"),
            @Result(property = "orderDesc", column = "orderDesc"),
            @Result(property = "product", column = "productId", javaType = Product.class, one = @One(select = "com.hzxy.dao.IProductDao.findById")),
            @Result(property = "member",column = "memberId",javaType = Member.class,one = @One(select = "com.hzxy.dao.IMemberDao.findById")),
            @Result(property = "travellers",column = "id",javaType =List.class,many = @Many(select = "com.hzxy.dao.ITravellerDao.findByOrdersId"))
    })
    public Orders findById(String ordersId) throws Exception;
}


  1. IMemberDao
package com.hzxy.dao;

import com.hzxy.domain.Member;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface IMemberDao {

    @Select("select * from member where id=#{id}")
    public Member findById(String id) throws Exception;
}


  1. ITravellerDao
package com.hzxy.dao;

import com.hzxy.domain.Traveller;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ITravellerDao {

    @Select("select * from traveller where id in (select travellerId from order_traveller where orderId=#{ordersId})")
    public List<Traveller> findByOrdersId(String ordersId) throws Exception;
}

  1. IUserDao
package com.hzxy.dao;

import com.hzxy.domain.Role;
import com.hzxy.domain.UserInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IUserDao {

    @Select("select * from users where username=#{username}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "username", column = "username"),
            @Result(property = "email", column = "email"),
            @Result(property = "password", column = "usersPASSWORD"),
            @Result(property = "phoneNum", column = "phoneNum"),
            @Result(property = "status", column = "usersSTATUS"),
            @Result(property = "roles",column = "id",javaType = java.util.List.class,
                    many = @Many(select = "com.hzxy.dao.IRoleDao.findRoleByUserId"))
    })
    public UserInfo findByUsername(String username) throws Exception;

    @Select("select * from users")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "username", column = "username"),
            @Result(property = "email", column = "email"),
            @Result(property = "password", column = "usersPASSWORD"),
            @Result(property = "phoneNum", column = "phoneNum"),
            @Result(property = "status", column = "usersSTATUS")
    })
    List<UserInfo> findAll() throws Exception;

    @Insert("insert into users(email,username,usersPASSWORD,phoneNum,usersSTATUS) " +
            "values(#{email},#{username},#{password},#{phoneNum},#{status})")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "username", column = "username"),
            @Result(property = "email", column = "email"),
            @Result(property = "password", column = "usersPASSWORD"),
            @Result(property = "phoneNum", column = "phoneNum"),
            @Result(property = "status", column = "usersSTATUS")
    })
    void save(UserInfo userInfo) throws Exception;


    @Select("select * from users where id=#{id}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "username", column = "username"),
            @Result(property = "email", column = "email"),
            @Result(property = "password", column = "usersPASSWORD"),
            @Result(property = "phoneNum", column = "phoneNum"),
            @Result(property = "status", column = "usersSTATUS"),
            @Result(property = "roles",column = "id",javaType = java.util.List.class,
                    many = @Many(select = "com.hzxy.dao.IRoleDao.findRoleByUserId"))
    })
    UserInfo findById(String id) throws Exception;

    @Select("select * from role where id not in (select roleId from users_role where userId=#{userId})")
    List<Role> findOtherRoles(String userId);

    @Insert("insert into users_role(userId,roleId) values(#{userId},#{roleId})")
    void addRoleToUser(@Param("userId") String userId, @Param("roleId") String roleId);

    @Delete("delete from users_role where userId=#{id}")
    void deleteFromUser_RoleByRoleId(String id);

    @Delete("delete from users where id=#{id}")
    void deleteUserById(String id);

}


  1. IRoleDao
package com.hzxy.dao;

import com.hzxy.domain.Permission;
import com.hzxy.domain.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IRoleDao {

    //根据用户id查询出所有对应的角色
    @Select("select * from role where id in (select roleId from users_role where userId=#{userId})")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "roleName", column = "roleName"),
            @Result(property = "roleDesc", column = "roleDesc"),
            @Result(property = "permissions",column = "id",javaType = java.util.List.class,
                    many = @Many(select = "com.hzxy.dao.IPermissionDao.findPermissionByRoleId"))
    })
    public List<Role> findRoleByUserId(String userId) throws Exception;

    @Select("select * from role")
    List<Role> findAll() throws Exception;

    @Insert("insert into role(roleName,roleDesc) values(#{roleName},#{roleDesc})")
    void save(Role role);

    @Select("select * from role where id=#{roleId}")
    @Results({
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "roleName",column = "roleName"),
            @Result(property = "roleDesc",column = "roleDesc"),
            @Result(property = "permissions",column = "id",javaType = java.util.List.class,many = @Many(select = "com.hzxy.dao.IPermissionDao.findPermissionByRoleId"))
    })
    Role findById(String roleId);

    @Select("select * from permission where id not in (select permissionId from role_permission where roleId=#{roleId})")
    List<Permission> findOtherPermissions(String roleId);

    @Insert("insert into role_permission(roleId,permissionId) values(#{roleId},#{permissionId})")
    void addPermissionToRole(@Param("roleId") String roleId, @Param("permissionId") String permissionId);

    @Delete("delete from users_role where roleId=#{roleId}")
    void deleteFromUser_RoleByRoleId(String roleId);

    @Delete("delete from role_permission where roleId=#{roleId}")
    void deleteFromRole_PermissionByRoleId(String roleId);

    @Delete("delete from role where id=#{roleId}")
    void deleteRoleById(String roleId);
}


  1. IPermissionDao
package com.hzxy.dao;

import com.hzxy.domain.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IPermissionDao {

    //查询与role关联的所有的权限
    @Select("select * from permission where id in (select permissionId from role_permission where roleId=#{id} )")
    public List<Permission> findPermissionByRoleId(String id) throws Exception;

    @Select("select * from permission")
    List<Permission> findAll() throws Exception;

    @Insert("insert into permission(permissionName,url) values(#{permissionName},#{url})")
    void save(Permission permission) throws Exception;

    @Select("select * from permission where id=#{id}")
    Permission findById(String id) throws Exception;

    @Delete("delete from role_permission where permissionId=#{id}")
    void deleteFromRole_Permission(String id) throws Exception;

    @Delete("delete from permission where id=#{id}")
    void deleteById(String id) throws Exception ;
}


  1. ISysLogDao
package com.hzxy.dao;

import com.hzxy.domain.SysLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ISysLogDao {

    @Insert("insert into syslog(visitTime,username,ip,url,executionTime,method) values(#{visitTime},#{username},#{ip},#{url},#{executionTime},#{method})")
    public void save(SysLog sysLog) throws Exception;

    @Select("select * from sysLog")
    List<SysLog> findAll() throws Exception;
}

4.service模块

  1. IProductService
package com.hzxy.service;

import com.hzxy.domain.Product;

import java.util.List;

public interface IProductService {

    List<Product> findAll() throws Exception;

    void save(Product product) throws Exception;
}


  1. IOrdersService
package com.hzxy.service;

import com.hzxy.domain.Orders;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IOrdersService {


    List<Orders> findAll(int page, int size) throws Exception;

    Orders findById(String ordersId) throws Exception;
}


  1. IUserService
package com.hzxy.service;

import com.hzxy.domain.Role;
import com.hzxy.domain.UserInfo;
import org.springframework.security.core.userdetails.UserDetailsService;

import java.util.List;

public interface IUserService extends UserDetailsService {

    List<UserInfo> findAll() throws Exception;

    void save(UserInfo userInfo) throws Exception;

    UserInfo findById(String id) throws Exception;

    List<Role> findOtherRoles(String userId) throws Exception;

    void addRoleToUser(String userId, String[] roleIds);

    void deleteUserById(String id) throws Exception;
}

  1. IRoleService
package com.hzxy.service;

import com.hzxy.domain.Permission;
import com.hzxy.domain.Role;

import java.util.List;

public interface IRoleService {

    public List<Role> findAll() throws Exception;

    void save(Role role) throws Exception;

    Role findById(String roleId) throws  Exception;

    List<Permission> findOtherPermissions(String roleId) throws Exception;

    void addPermissionToRole(String roleId, String[] permissionIds) throws Exception;

    void deleteRoleById(String roleId) throws Exception;
}

  1. IPermissionService
package com.hzxy.service;

import com.hzxy.domain.Permission;

import java.util.List;

public interface IPermissionService {

    public List<Permission> findAll() throws Exception;

    void save(Permission permission) throws Exception;

    Permission findById(String id) throws Exception;

    void deleteById(String id) throws Exception;
}

  1. ISysLogService
package com.hzxy.service;

import com.hzxy.domain.SysLog;

import java.util.List;

public interface ISysLogService {

    public void save(SysLog sysLog) throws Exception;

    List<SysLog> findAll() throws Exception;
}

  1. ProductServiceImpl
package com.hzxy.service.impl;

import com.hzxy.dao.IProductDao;
import com.hzxy.domain.Product;
import com.hzxy.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional  //添加事务

public class ProductServiceImpl implements IProductService{

    @Autowired
    private IProductDao productDao;


    public List<Product> findAll() throws Exception {
        return productDao.findAll();
    }

    public void save(Product product) throws Exception {
        productDao.save(product);
    }
}


  1. OrdersServiceImpl
package com.hzxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.hzxy.dao.IOrdersDao;
import com.hzxy.domain.Orders;
import com.hzxy.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class OrdersServiceImpl implements IOrdersService {

    @Autowired
    private IOrdersDao ordersDao;


    public List<Orders> findAll(int page, int size) throws Exception {
        //参数pageNum 是页码值   参数pageSize 代表是每页显示条数
        PageHelper.startPage(page, size);
        return ordersDao.findAll();
    }

    public Orders findById(String ordersId) throws Exception {
        return ordersDao.findById(ordersId);
    }
}


  1. UserServiceImpl
package com.hzxy.service.impl;

import com.hzxy.dao.IUserDao;
import com.hzxy.domain.Role;
import com.hzxy.domain.UserInfo;
import com.hzxy.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service("userService")
@Transactional
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserDao userDao;

    @Autowired
    private BCryptPasswordEncoder bCryptPasswordEncoder;

    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        UserInfo userInfo = null;
        try {
            userInfo = userDao.findByUsername(username);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //处理自己的用户对象封装成UserDetails
        User user = new User(userInfo.getUsername(), userInfo.getPassword(),
                userInfo.getStatus() == 0 ? false : true, true,
                true, true, getAuthority(userInfo.getRoles()));
        return user;
    }

    //作用就是返回一个List集合,集合中装入的是角色描述
    public List<SimpleGrantedAuthority> getAuthority(List<Role> roles) {

        List<SimpleGrantedAuthority> list = new ArrayList<SimpleGrantedAuthority>();
        for (Role role : roles) {
            list.add(new SimpleGrantedAuthority("ROLE_" + role.getRoleName()));
        }
        return list;
    }

    public List<UserInfo> findAll() throws Exception {

        return userDao.findAll();
    }

    public void save(UserInfo userInfo) throws Exception {
        //对密码进行加密处理
        userInfo.setPassword(bCryptPasswordEncoder.encode(userInfo.getPassword()));
        userDao.save(userInfo);
    }

    public UserInfo findById(String id) throws Exception {

        return  userDao.findById(id);
    }

    public List<Role> findOtherRoles(String userId) throws Exception {
        return userDao.findOtherRoles(userId);
    }

    public void addRoleToUser(String userId, String[] roleIds) {
        for(String roleId:roleIds){
            userDao.addRoleToUser(userId,roleId);
        }
    }

    public void deleteUserById(String id) throws Exception {
        userDao.deleteFromUser_RoleByRoleId(id);
        userDao.deleteUserById(id);
    }
}

  1. RoleServiceImpl
package com.hzxy.service.impl;

import com.hzxy.dao.IRoleDao;
import com.hzxy.domain.Permission;
import com.hzxy.domain.Role;
import com.hzxy.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RoleServiceImpl implements IRoleService {

    @Autowired
    private IRoleDao roleDao;


    public List<Role> findAll() throws Exception {
        return roleDao.findAll();
    }

    public void save(Role role) throws Exception {
        roleDao.save(role);
    }

    public Role findById(String roleId) throws Exception {
        return roleDao.findById(roleId);
    }

    public List<Permission> findOtherPermissions(String roleId) throws Exception {
        return roleDao.findOtherPermissions(roleId);
    }

    public void addPermissionToRole(String roleId, String[] permissionIds) throws Exception {

        for(String permissionId:permissionIds){
            roleDao.addPermissionToRole(roleId,permissionId);
        }
    }

    public void deleteRoleById(String roleId) throws Exception {

        //从user_role表中删除
        roleDao.deleteFromUser_RoleByRoleId(roleId);
        //从role_permission表中删除
        roleDao.deleteFromRole_PermissionByRoleId(roleId);
        //从role表中删除
        roleDao.deleteRoleById(roleId);
    }
}


  1. PermissionServiceImpl
package com.hzxy.service.impl;

import com.hzxy.dao.IPermissionDao;
import com.hzxy.domain.Permission;
import com.hzxy.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PermissionServiceImpl implements IPermissionService{

    @Autowired
    private IPermissionDao permissionDao;


    public List<Permission> findAll() throws Exception {
        return permissionDao.findAll();
    }

    public void save(Permission permission) throws Exception {
        permissionDao.save(permission);
    }

    public Permission findById(String id) throws Exception {
        return permissionDao.findById(id);
    }

    public void deleteById(String id) throws Exception {
        permissionDao.deleteFromRole_Permission(id);
        permissionDao.deleteById(id);
    }
}

  1. SysLogServiceImpl
package com.hzxy.service.impl;

import com.hzxy.dao.ISysLogDao;
import com.hzxy.domain.SysLog;
import com.hzxy.service.ISysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SysLogServiceImpl implements ISysLogService {

    @Autowired
    private ISysLogDao sysLogDao;


    public void save(SysLog sysLog) throws Exception {
        sysLogDao.save(sysLog);
    }

    public List<SysLog> findAll() throws Exception {
        return sysLogDao.findAll();
    }
}


5.controller模块

  1. ProductController
package com.hzxy.controller;

import com.hzxy.domain.Product;
import com.hzxy.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;


@Controller
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private IProductService productService;

    //产品添加
    @RequestMapping("/save.do")
    public String save(Product product) throws Exception {
        productService.save(product);
        return "redirect:findAll.do";
    }

    //查询全部产品
    @RequestMapping("/findAll.do")
    public ModelAndView findAll() throws Exception {
        ModelAndView mv = new ModelAndView();
        List<Product> ps = productService.findAll();
        mv.addObject("productList", ps);
        mv.setViewName("product-list1");
        return mv;
    }
}


  1. OrdersController
package com.hzxy.controller;

import com.github.pagehelper.PageInfo;
import com.hzxy.domain.Orders;
import com.hzxy.service.IOrdersService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/orders")
public class OrdersController {

    @Autowired
    private IOrdersService ordersService;

/*    //查询全部订单---未分页
     @RequestMapping("/findAll.do")
     public ModelAndView findAll() throws Exception {
         ModelAndView mv = new ModelAndView();
         List<Orders> ordersList = ordersService.findAll();
         mv.addObject("ordersList", ordersList);
         mv.setViewName("orders-list");
         return mv;
    }*/

    @RequestMapping("/findAll.do")
    public ModelAndView findAll(@RequestParam(name = "page", required = true, defaultValue = "1") Integer page,
                                @RequestParam(name = "size", required = true, defaultValue = "6") Integer size)
            throws Exception {
        ModelAndView mv = new ModelAndView();
        List<Orders> ordersList = ordersService.findAll(page, size);
        //PageInfo就是一个分页Bean
        PageInfo pageInfo = new PageInfo(ordersList);
        mv.addObject("pageInfo", pageInfo);
        mv.setViewName("orders-page-list");
        return mv;
    }

    @RequestMapping("/findById.do")
    public ModelAndView findById(@RequestParam(name = "id", required = true) String ordersId) throws Exception {
        ModelAndView mv = new ModelAndView();
        Orders orders = ordersService.findById(ordersId);
        mv.addObject("orders",orders);
        mv.setViewName("orders-show");
        return mv;
    }

}


  1. UserController
package com.hzxy.controller;

import com.hzxy.domain.Role;
import com.hzxy.domain.UserInfo;
import com.hzxy.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("/deleteUser.do")
    public String deleteRole(@RequestParam(name="id",required = true) String id) throws Exception {
        userService.deleteUserById(id);
        return "redirect:findAll.do";
    }

    //给用户添加角色
    @RequestMapping("/addRoleToUser.do")
    public String addRoleToUser(@RequestParam(name = "userId", required = true) String userId, @RequestParam(name = "ids", required = true) String[] roleIds) {
        userService.addRoleToUser(userId, roleIds);
        return "redirect:findAll.do";
    }

    //查询用户以及用户可以添加的角色
    @RequestMapping("/findUserByIdAndAllRole.do")
    public ModelAndView findUserByIdAndAllRole(@RequestParam(name = "id", required = true) String userid) throws Exception {
        ModelAndView mv = new ModelAndView();
        //1.根据用户id查询用户
        UserInfo userInfo = userService.findById(userid);
        //2.根据用户id查询可以添加的角色
        List<Role> otherRoles = userService.findOtherRoles(userid);
        mv.addObject("user", userInfo);
        mv.addObject("roleList", otherRoles);
        mv.setViewName("user-role-add");
        return mv;
    }

    //查询指定id的用户
    @RequestMapping("/findById.do")
    public ModelAndView findById(String id) throws Exception{
        ModelAndView mv = new ModelAndView();
        UserInfo userInfo = userService.findById(id);
        mv.addObject("user",userInfo);
        mv.setViewName("user-show1");
        return mv;
    }

    //用户添加
    @RequestMapping("/save.do")
    @PreAuthorize("authentication.principal.username == 'ygg667'")
    public String save(UserInfo userInfo) throws Exception {
        userService.save(userInfo);
        return "redirect:findAll.do";
    }

    @RequestMapping("/findAll.do")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public ModelAndView findAll() throws Exception {
        ModelAndView mv = new ModelAndView();
        List<UserInfo> userList = userService.findAll();
        mv.addObject("userList", userList);
        mv.setViewName("user-list");
        return mv;
    }
}


  1. RoleController
package com.hzxy.controller;

import com.hzxy.domain.Permission;
import com.hzxy.domain.Role;
import com.hzxy.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RequestMapping("/role")
@Controller
public class RoleController {

    @Autowired
    private IRoleService roleService;

    @RequestMapping("/deleteRole.do")
    public String deleteRole(@RequestParam(name="id",required = true) String roleId) throws Exception {
        roleService.deleteRoleById(roleId);
        return "redirect:findAll.do";
    }

    //角色详情查询
    @RequestMapping("/findById.do")
    public ModelAndView findById(@RequestParam(name = "id", required = true) String roleId) throws Exception {
        ModelAndView mv = new ModelAndView();
        Role role = roleService.findById(roleId);

        mv.addObject("role", role);
        mv.setViewName("role-show");
        return mv;
    }

    //给角色添加权限
    @RequestMapping("/addPermissionToRole.do")
    public String addPermissionToRole(@RequestParam(name = "roleId", required = true) String roleId, @RequestParam(name = "ids", required = true) String[] permissionIds) throws Exception {
        roleService.addPermissionToRole(roleId, permissionIds);
        return "redirect:findAll.do";
    }

    //根据roleId查询role,并查询出可以添加的权限
    @RequestMapping("/findRoleByIdAndAllPermission.do")
    public ModelAndView findRoleByIdAndAllPermission(@RequestParam(name = "id", required = true) String roleId) throws Exception {
        ModelAndView mv = new ModelAndView();
        //根据roleId查询role
        Role role = roleService.findById(roleId);
        //根据roleId查询可以添加的权限
        List<Permission> otherPermissions = roleService.findOtherPermissions(roleId);
        mv.addObject("role", role);
        mv.addObject("permissionList", otherPermissions);
        mv.setViewName("role-permission-add");
        return mv;

    }

    @RequestMapping("/save.do")
    public String save(Role role) throws Exception {
        roleService.save(role);
        return "redirect:findAll.do";
    }

    @RequestMapping("/findAll.do")
    public ModelAndView findAll() throws Exception {
        ModelAndView mv = new ModelAndView();
        List<Role> roleList = roleService.findAll();
        mv.addObject("roleList", roleList);
        mv.setViewName("role-list");
        return mv;
    }
}


  1. PermissionController
package com.hzxy.controller;

import com.hzxy.domain.Permission;
import com.hzxy.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    private IPermissionService permissionService;

    @RequestMapping("/deletePermission.do")
    public String deletePermission(String id) throws Exception {
        permissionService.deleteById(id);
        return "redirect:findAll.do";
    }

    @RequestMapping("/findById")
    public ModelAndView findById(String id) throws Exception {
        Permission permission=  permissionService.findById(id);
        ModelAndView mv=new ModelAndView();
        mv.setViewName("permission-show");
        mv.addObject("permission",permission);
        return mv;
    }

    @RequestMapping("/save.do")
    public String save(Permission permission) throws Exception {
        permissionService.save(permission);
        return "redirect:findAll.do";
    }
    @RequestMapping("/findAll.do")
    public ModelAndView findAll() throws Exception {
        ModelAndView mv=new ModelAndView();
        List<Permission> permissionList = permissionService.findAll();
        mv.addObject("permissionList",permissionList);
        mv.setViewName("permission-list");
        return mv;
    }
}


  1. SysLogController
package com.hzxy.controller;

import com.hzxy.domain.SysLog;
import com.hzxy.service.ISysLogService;
import org.apache.log4j.net.SyslogAppender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/sysLog")
public class SysLogController {

    @Autowired
    private ISysLogService sysLogService;

    @RequestMapping("/findAll.do")
    public ModelAndView findAll() throws Exception {

        ModelAndView mv=new ModelAndView();
       List<SysLog> sysLogList= sysLogService.findAll();
       mv.addObject("sysLogs",sysLogList);
       mv.setViewName("syslog-list");
        return mv;
    }
}


6.前端页面编写

  1. index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<html>
<body>
<jsp:forward page="/pages/main.jsp"></jsp:forward>
</body>
</html>

  1. login.jsp(登录页面)
<div class="login-box">
	<div class="login-logo">
		<a href="all-admin-index.html"><b>HZU</b>后台管理系统</a>
	</div>
	<!-- /.login-logo -->
	<div class="login-box-body">
		<p class="login-box-msg">登录系统</p>

		<form action="${pageContext.request.contextPath}/login.do" method="post">
			<div class="form-group has-feedback">
				<input type="text" name="username" class="form-control"
					placeholder="用户名"> <span
					class="glyphicon glyphicon-envelope form-control-feedback"></span>
			</div>
			<div class="form-group has-feedback">
				<input type="password" name="password" class="form-control"
					placeholder="密码"> <span
					class="glyphicon glyphicon-lock form-control-feedback"></span>
			</div>
			<div class="row">
				<div class="col-xs-8">
					<div class="checkbox icheck">
						<label><input type="checkbox"> 记住 下次自动登录</label>
					</div>
				</div>
				<!-- /.col -->
				<div class="col-xs-4">
					<button type="submit" class="btn btn-primary btn-block btn-flat">登录</button>
				</div>
				<!-- /.col -->
			</div>
		</form>

		<a href="#">忘记密码</a><br>


	</div>
	<!-- /.login-box-body -->
</div>

  1. main.jsp(主页)
<!-- 内容区域 -->
<div class="content-wrapper">

	<img src="${pageContext.request.contextPath}/img/996-center.jpeg"
		width="1300px" height="649px" />

</div>
<!-- 内容区域 /-->
  1. failer.jsp(登录失败页面)
<div class="error-content">
	
	<p>
		登录失败 , 你可以 <a href="${pageContext.request.contextPath}/login.jsp">返回到登录页面</a>
		重新登录
	</p>

</div>

  1. 403.jsp(权限不足页面)
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>权限</title>
</head>
<body>
    <h1>权限不足</h1>
</body>
</html>

  1. product-list.jsp(产品遍历页面)
<div class="box-body">

    <!-- 数据表格 -->
    <div class="table-box">

        <!--工具栏-->
        <div class="pull-left">
            <div class="form-group form-inline">
                <div class="btn-group">
                    <button type="button" class="btn btn-default" title="新建" onclick="location.href='${pageContext.request.contextPath}/pages/product-add.jsp'"><i
                            class="fa fa-file-o"></i> 新建
                    </button>
                    <button type="button" class="btn btn-default" title="删除"><i
                            class="fa fa-trash-o"></i> 删除
                    </button>
                    <button type="button" class="btn btn-default" title="开启"><i class="fa fa-check"></i>
                        开启
                    </button>
                    <button type="button" class="btn btn-default" title="屏蔽"><i class="fa fa-ban"></i>
                        屏蔽
                    </button>
                    <button type="button" class="btn btn-default" title="刷新"><i
                            class="fa fa-refresh"></i> 刷新
                    </button>
                </div>
            </div>
        </div>
        <div class="box-tools pull-right">
            <div class="has-feedback">
                <input type="text" class="form-control input-sm" placeholder="搜索">
                <span class="glyphicon glyphicon-search form-control-feedback"></span>
            </div>
        </div>
        <!--工具栏/-->

        <!--数据列表-->
        <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
            <thead>
            <tr>
                <th class="" style="padding-right:0px;">
                    <input id="selall" type="checkbox" class="icheckbox_square-blue">
                </th>
                <th class="sorting_asc">ID</th>
                <th class="sorting_desc">编号</th>
                <th class="sorting_asc sorting_asc_disabled">产品名称</th>
                <th class="sorting_desc sorting_desc_disabled">出发城市</th>
                <th class="sorting">出发时间</th>
                <th class="text-center sorting">产品价格</th>
                <th class="text-center sorting">产品描述</th>
                <th class="text-center sorting">状态</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="product" items="${productList}">
            <tr>
                <td><input name="ids" type="checkbox"></td>
                <td>${product.id}</td>
                <td>${product.productNum}
                </td>
                <td>${product.productName}</td>
                <td>${product.cityName}</td>
                <td>${product.departureTimeStr}</td>
                <td class="text-center">${product.productPrice}</td>
                <td class="text-center">${product.productDesc}</td>
                <td class="text-center">${product.productStatusStr}</td>
                <td class="text-center">
                    <button type="button" class="btn bg-olive btn-xs">订单</button>
                    <button type="button" class="btn bg-olive btn-xs">详情</button>
                    <button type="button" class="btn bg-olive btn-xs">编辑</button>
                </td>
            </tr>
            </c:forEach>

            </tbody>
            <!--
        <tfoot>
        <tr>
        <th>Rendering engine</th>
        <th>Browser</th>
        <th>Platform(s)</th>
        <th>Engine version</th>
        <th>CSS grade</th>
        </tr>
        </tfoot>-->
        </table>
        <!--数据列表/-->

        <!--工具栏-->
        <div class="pull-left">
            <div class="form-group form-inline">
                <div class="btn-group">
                    <button type="button" class="btn btn-default" title="新建"><i
                            class="fa fa-file-o"></i> 新建
                    </button>
                    <button type="button" class="btn btn-default" title="删除"><i
                            class="fa fa-trash-o"></i> 删除
                    </button>
                    <button type="button" class="btn btn-default" title="开启"><i class="fa fa-check"></i>
                        开启
                    </button>
                    <button type="button" class="btn btn-default" title="屏蔽"><i class="fa fa-ban"></i>
                        屏蔽
                    </button>
                    <button type="button" class="btn btn-default" title="刷新"><i
                            class="fa fa-refresh"></i> 刷新
                    </button>
                </div>
            </div>
        </div>
        <div class="box-tools pull-right">
            <div class="has-feedback">
                <input type="text" class="form-control input-sm" placeholder="搜索">
                <span class="glyphicon glyphicon-search form-control-feedback"></span>
            </div>
        </div>
        <!--工具栏/-->

    </div>
    <!-- 数据表格 /-->
</div>

  1. product-add.jsp(产品添加页面)
<form action="${pageContext.request.contextPath}/product/save.do"
	method="post">
	<!-- 正文区域 -->
	<section class="content"> <!--产品信息-->

	<div class="panel panel-default">
		<div class="panel-heading">产品信息</div>
		<div class="row data-type">

			<div class="col-md-2 title">产品编号</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="productNum"
					placeholder="产品编号" value="">
			</div>
			<div class="col-md-2 title">产品名称</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="productName"
					placeholder="产品名称" value="">
			</div>
			<div class="col-md-2 title">出发时间</div>
			<div class="col-md-4 data">
				<div class="input-group date">
					<div class="input-group-addon">
						<i class="fa fa-calendar"></i>
					</div>
					<input type="text" class="form-control pull-right"
						id="datepicker-a3" name="departureTime">
				</div>
			</div>


			<div class="col-md-2 title">出发城市</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="cityName"
					placeholder="出发城市" value="">
			</div>

			<div class="col-md-2 title">产品价格</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" placeholder="产品价格"
					name="productPrice" value="">
			</div>

			<div class="col-md-2 title">产品状态</div>
			<div class="col-md-4 data">
				<select class="form-control select2" style="width: 100%"
					name="productStatus">
					<option value="0" selected="selected">关闭</option>
					<option value="1">开启</option>
				</select>
			</div>

			<div class="col-md-2 title rowHeight2x">其他信息</div>
			<div class="col-md-10 data rowHeight2x">
				<textarea class="form-control" rows="3" placeholder="其他信息"
					name="productDesc"></textarea>
			</div>

		</div>
	</div>
	<!--订单信息/--> <!--工具栏-->
	<div class="box-tools text-center">
		<button type="submit" class="btn bg-maroon">保存</button>
		<button type="button" class="btn bg-default"
			onclick="history.back(-1);">返回</button>
	</div>
	<!--工具栏/--> </section>
	<!-- 正文区域 /-->
</form>

  1. order-list.jsp(订单遍历页面)
<!-- 正文区域 -->
<section class="content">

	<!-- .box-body -->
	<div class="box box-primary">
		<div class="box-header with-border">
			<h3 class="box-title">列表</h3>
		</div>

		<div class="box-body">

			<!-- 数据表格 -->
			<div class="table-box">

				<!--工具栏-->
				<div class="pull-left">
					<div class="form-group form-inline">
						<div class="btn-group">
							<button type="button" class="btn btn-default" title="新建"
								onclick="location.href='${pageContext.request.contextPath}/pages/product-add.jsp'">
								<i class="fa fa-file-o"></i> 新建
							</button>
							<button type="button" class="btn btn-default" title="删除">
								<i class="fa fa-trash-o"></i> 删除
							</button>

							<button type="button" class="btn btn-default" title="刷新">
								<i class="fa fa-refresh"></i> 刷新
							</button>
						</div>
					</div>
				</div>
				<div class="box-tools pull-right">
					<div class="has-feedback">
						<input type="text" class="form-control input-sm"
							placeholder="搜索"> <span
							class="glyphicon glyphicon-search form-control-feedback"></span>
					</div>
				</div>
				<!--工具栏/-->

				<!--数据列表-->
				<table id="dataList"
					class="table table-bordered table-striped table-hover dataTable">
					<thead>
						<tr>
							<th class="" style="padding-right: 0px;"><input
								id="selall" type="checkbox" class="icheckbox_square-blue">
							</th>
							<th class="sorting_asc">ID</th>
							<th class="sorting_desc">订单编号</th>
							<th class="sorting_asc sorting_asc_disabled">产品名称</th>
							<th class="sorting_desc sorting_desc_disabled">金额</th>
							<th class="sorting">下单时间</th>
							<th class="text-center sorting">订单状态</th>
							<th class="text-center">操作</th>
						</tr>
					</thead>
					<tbody>


						<c:forEach items="${pageInfo.list}" var="orders">

							<tr>
								<td><input name="ids" type="checkbox"></td>
								<td>${orders.id }</td>
								<td>${orders.orderNum }</td>
								<td>${orders.product.productName }</td>
								<td>${orders.product.productPrice }</td>
								<td>${orders.orderTimeStr }</td>
								<td class="text-center">${orders.orderStatusStr }</td>
								<td class="text-center">
									<button type="button" class="btn bg-olive btn-xs" onclick="location.href='${pageContext.request.contextPath}/orders/findById.do?id=${orders.id}'">详情</button>
									<button type="button" class="btn bg-olive btn-xs">编辑</button>
								</td>
							</tr>
						</c:forEach>
					</tbody>
					<!--
                         <tfoot>
                         <tr>
                         <th>Rendering engine</th>
                         <th>Browser</th>
                         <th>Platform(s)</th>
                         <th>Engine version</th>
                         <th>CSS grade</th>
                         </tr>
                         </tfoot>-->
				</table>
				<!--数据列表/-->

			</div>
			<!-- 数据表格 /-->


		</div>
		<!-- /.box-body -->

		<!-- .box-footer-->
             <div class="box-footer">

                 <div class="box-tools pull-right">
                     <ul class="pagination">
                         <li>
                             <a href="${pageContext.request.contextPath}/orders/findAll.do?page=1&size=${pageInfo.pageSize}" aria-label="Previous">首页</a>
                         </li>
                         <li><a href="${pageContext.request.contextPath}/orders/findAll.do?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}">上一页</a></li>
                        <c:forEach begin="1" end="${pageInfo.pages}" var="pageNum">
				   <li><a href="${pageContext.request.contextPath}/orders/findAll.do?page=${pageNum}&size=${pageInfo.pageSize}">${pageNum}</a></li>
			   </c:forEach>
                         <li><a href="${pageContext.request.contextPath}/orders/findAll.do?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}">下一页</a></li>
                         <li>
                             <a href="${pageContext.request.contextPath}/orders/findAll.do?page=${pageInfo.pages}&size=${pageInfo.pageSize}" aria-label="Next">尾页</a>
                         </li>
                     </ul>
                 </div>

             </div>
             <!-- /.box-footer-->
	</div>
</section>
<!-- 正文区域 /-->

  1. order.show.jsp(订单详情页面)
<!-- 正文区域 -->
<section class="content"> <!--订单信息-->
<div class="panel panel-default">
	<div class="panel-heading">订单信息</div>
	<div class="row data-type">

		<div class="col-md-2 title">订单编号</div>
		<div class="col-md-4 data">
			<input type="text" class="form-control" placeholder="订单编号"
				value="${orders.orderNum }" readonly="readonly">
		</div>

		<div class="col-md-2 title">下单时间</div>
		<div class="col-md-4 data">
			<div class="input-group date">
				<div class="input-group-addon">
					<i class="fa fa-calendar"></i>
				</div>
				<input type="text" class="form-control pull-right"
					id="datepicker-a3" readonly="readonly"
					value="${orders.orderTimeStr}">
			</div>
		</div>
		<div class="col-md-2 title">路线名称</div>
		<div class="col-md-4 data">
			<input type="text" class="form-control" placeholder="路线名称"
				value="${orders.product.productName }" readonly="readonly">
		</div>

		<div class="col-md-2 title">出发城市</div>
		<div class="col-md-4 data">
			<input type="text" class="form-control" placeholder="出发城市"
				value="${orders.product.cityName }" readonly="readonly">
		</div>

		<div class="col-md-2 title">出发时间</div>
		<div class="col-md-4 data">
			<div class="input-group date">
				<div class="input-group-addon">
					<i class="fa fa-calendar"></i>
				</div>
				<input type="text" class="form-control pull-right"
					id="datepicker-a6" value="${orders.product.departureTimeStr}"
					readonly="readonly">
			</div>
		</div>
		<div class="col-md-2 title">出游人数</div>
		<div class="col-md-4 data">
			<input type="text" class="form-control" placeholder="出游人数"
				value="${orders.peopleCount}" readonly="readonly">
		</div>

		<div class="col-md-2 title rowHeight2x">其他信息</div>
		<div class="col-md-10 data rowHeight2x">
			<textarea class="form-control" rows="3" placeholder="其他信息">
				${orders.orderDesc }
			</textarea>
		</div>

	</div>
</div>
<!--订单信息/--> <!--游客信息-->
<div class="panel panel-default">
	<div class="panel-heading">游客信息</div>
	<!--数据列表-->
	<table id="dataList"
		class="table table-bordered table-striped table-hover dataTable">
		<thead>
			<tr>
				<th class="">人群</th>
				<th class="">姓名</th>
				<th class="">性别</th>
				<th class="">手机号码</th>
				<th class="">证件类型</th>
				<th class="">证件号码</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="traveller" items="${orders.travellers}">

				<tr>
					<td>${traveller.travellerTypeStr}</td>
					<td><input type="text" size="10" value="${traveller.name }"
						readonly="readonly"></td>
					<td><input type="text" size="10" value="${traveller.sex }"
						readonly="readonly"></td>
					<td><input type="text" size="20"
						value="${traveller.phoneNum }" readonly="readonly"></td>
					<td><input type="text" size="15"
						value="${traveller.credentialsTypeStr}" readonly="readonly"></td>
					<td><input type="text" size="28"
						value="${traveller.credentialsNum }" readonly="readonly"></td>
				</tr>
			</c:forEach>


		</tbody>
	</table>
	<!--数据列表/-->
</div>
<!--游客信息/--> <!--联系人信息-->
<div class="panel panel-default">
	<div class="panel-heading">联系人信息</div>
	<div class="row data-type">

		<div class="col-md-2 title">会员</div>
		<div class="col-md-4 data text">${orders.member.nickname }</div>

		<div class="col-md-2 title">联系人</div>
		<div class="col-md-4 data text">${orders.member.name}</div>

		<div class="col-md-2 title">手机号</div>
		<div class="col-md-4 data text">${orders.member.phoneNum}</div>

		<div class="col-md-2 title">邮箱</div>
		<div class="col-md-4 data text">${orders.member.email}</div>

	</div>
</div>
<!--联系人信息/--> <!--费用信息--> <c:if test="${orders.orderStatus==1}">
	<div class="panel panel-default">
		<div class="panel-heading">费用信息</div>
		<div class="row data-type">

			<div class="col-md-2 title">支付方式</div>
			<div class="col-md-4 data text">在线支付-${orders.payTypeStr}</div>

			<div class="col-md-2 title">金额</div>
			<div class="col-md-4 data text">¥${orders.product.productPrice}</div>

		</div>
	</div>
</c:if> <!--费用信息/--> <!--工具栏-->
<div class="box-tools text-center">

	<button type="button" class="btn bg-default"
		onclick="history.back(-1);">返回</button>
</div>
<!--工具栏/--> </section>
<!-- 正文区域 /-->

  1. user-list.jsp(用户遍历页面)
<c:forEach items="${userList}" var="user">
	<tr>
		<td><input name="ids" type="checkbox"></td>
		<td>${user.id }</td>
		<td>${user.username }</td>
		<td>${user.email }</td>
		<td>${user.phoneNum }</td>
		<td>${user.statusStr }</td>											
		<td class="text-center">
			<a href="${pageContext.request.contextPath}/user/findById.do?id=${user.id}" class="btn bg-olive btn-xs">详情</a>
			<a href="${pageContext.request.contextPath}/user/findUserByIdAndAllRole.do?id=${user.id}" class="btn bg-olive btn-xs">添加角色</a>
		</td>
	</tr>
</c:forEach>

  1. user-add.jsp(用户添加页面)
<form action="${pageContext.request.contextPath}/user/save.do"
	method="post">
	<!-- 正文区域 -->
	<section class="content"> <!--产品信息-->

	<div class="panel panel-default">
		<div class="panel-heading">用户信息</div>
		<div class="row data-type">

			<div class="col-md-2 title">用户名称</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="username"
					placeholder="用户名称" value="">
			</div>
			<div class="col-md-2 title">密码</div>
			<div class="col-md-4 data">
				<input type="password" class="form-control" name="password"
					placeholder="密码" value="">
			</div>
			<div class="col-md-2 title">邮箱</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="email"
					placeholder="邮箱" value="">
			</div>
			<div class="col-md-2 title">联系电话</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="phoneNum"
					placeholder="联系电话" value="">
			</div>
			<div class="col-md-2 title">用户状态</div>
			<div class="col-md-4 data">
				<select class="form-control select2" style="width: 100%"
					name="status">
					<option value="0" selected="selected">关闭</option>
					<option value="1">开启</option>
				</select>
			</div>

		</div>
	</div>
	<!--订单信息/--> <!--工具栏-->
	<div class="box-tools text-center">
		<button type="submit" class="btn bg-maroon">保存</button>
		<button type="button" class="btn bg-default"
			onclick="history.back(-1);">返回</button>
	</div>
	<!--工具栏/--> </section>
	<!-- 正文区域 /-->
</form>

  1. user-show.jsp(用户详情展示页面)
<!--树表格-->
<div class="tab-pane" id="tab-treetable">
   <table id="collapse-table" class="table table-bordered table-hover dataTable">
       <thead>
       <tr>
           <th>用户</th>
           <th>描述</th>

       </tr>
       </thead>
       <tr data-tt-id="0">
           <td colspan="2">${user.username}</td>
       </tr>
       <tbody>
       <c:forEach items="${user.roles}" var="role" varStatus="vs"> <!--循环遍历所有角色和设置角色编号-->
           <tr data-tt-id="${vs.index+1}" data-tt-parent-id="0">
               <td>${role.roleName}</td>   <!--遍历所有角色名称-->
               <td>${role.roleDesc}</td>   <!--遍历所有角色属性-->
           </tr>
           <c:forEach items="${role.permissions}" var="p"> <!--根据角色编号循环遍历所有权限-->
               <tr data-tt-id="1-1" data-tt-parent-id="${vs.index+1}">
                   <td>${p.permissionName}</td>    <!--遍历所有权限名称-->
                   <td>${p.url}</td>               <!--遍历所有权限属性-->
               </tr>
           </c:forEach>
       </c:forEach>
     </tbody>
   </table>
</div>
<!--树表格/-->

  1. role-list.jsp(角色遍历页面)
<div class="box-body">

	<!-- 数据表格 -->
	<div class="table-box">

		<!--工具栏-->
		<div class="pull-left">
			<div class="form-group form-inline">
				<div class="btn-group">
					<button type="button" class="btn btn-default" title="新建" onclick="location.href='${pageContext.request.contextPath}/pages/role-add.jsp'">
						<i class="fa fa-file-o"></i> 新建
					</button>
					
					<button type="button" class="btn btn-default" title="刷新">
						<i class="fa fa-refresh"></i> 刷新
					</button>
				</div>
			</div>
		</div>
		<div class="box-tools pull-right">
			<div class="has-feedback">
				<input type="text" class="form-control input-sm"
					placeholder="搜索"> <span
					class="glyphicon glyphicon-search form-control-feedback"></span>
			</div>
		</div>
		<!--工具栏/-->

		<!--数据列表-->
		<table id="dataList"
			class="table table-bordered table-striped table-hover dataTable">
			<thead>
				<tr>
					<th class="" style="padding-right: 0px"><input
						id="selall" type="checkbox" class="icheckbox_square-blue">
					</th>
					<th class="sorting_asc">ID</th>
					<th class="sorting_desc">角色名称</th>
					<th class="sorting_asc sorting_asc_disabled">描述</th>										
					<th class="text-center">操作</th>
				</tr>
			</thead>
			<tbody>

				<c:forEach items="${roleList}" var="role">
					<tr>
						<td><input name="ids" type="checkbox"></td>
						<td>${role.id }</td>
						<td>${role.roleName }</td>
						<td>${role.roleDesc }</td>																				
						<td class="text-center">
							<a href="${pageContext.request.contextPath}/role/findById.do?id=${role.id}" class="btn bg-olive btn-xs">详情</a>
							<a href="${pageContext.request.contextPath}/user/findUserByIdAndAllRole.do?id=${user.id}" class="btn bg-olive btn-xs">添加角色</a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
			<!--
                       <tfoot>
                       <tr>
                       <th>Rendering engine</th>
                       <th>Browser</th>
                       <th>Platform(s)</th>
                       <th>Engine version</th>
                       <th>CSS grade</th>
                       </tr>
                       </tfoot>-->
		</table>
		<!--数据列表/-->

	</div>
	<!-- 数据表格 /-->

</div>

  1. role-add.jsp(用户添加页面)
<form action="${pageContext.request.contextPath}/role/save.do"
	method="post">
	<!-- 正文区域 -->
	<section class="content"> <!--产品信息-->

	<div class="panel panel-default">
		<div class="panel-heading">角色信息</div>
		<div class="row data-type">

			<div class="col-md-2 title">角色名称</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="roleName"
					placeholder="角色名称" value="">
			</div>
			<div class="col-md-2 title">角色描述</div>
			<div class="col-md-4 data">
				<input type="text" class="form-control" name="roleDesc"
					placeholder="角色描述" value="">
			</div>
							

		</div>
	</div>
	<!--订单信息/--> <!--工具栏-->
	<div class="box-tools text-center">
		<button type="submit" class="btn bg-maroon">保存</button>
		<button type="button" class="btn bg-default"
			onclick="history.back(-1);">返回</button>
	</div>
	<!--工具栏/--> </section>
	<!-- 正文区域 /-->
</form>

  1. permiss-list.jsp(权限资源遍历页面)
<!-- 正文区域 -->
<section class="content"> <!-- .box-body -->
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">列表</h3>
	</div>

	<div class="box-body">

		<!-- 数据表格 -->
		<div class="table-box">

			<!--工具栏-->
			<div class="pull-left">
				<div class="form-group form-inline">
					<div class="btn-group">
						<button type="button" class="btn btn-default" title="新建" onclick="location.href='${pageContext.request.contextPath}/pages/permission-add.jsp'">
							<i class="fa fa-file-o"></i> 新建
						</button>
						
						<button type="button" class="btn btn-default" title="刷新">
							<i class="fa fa-refresh"></i> 刷新
						</button>
					</div>
				</div>
			</div>
			<div class="box-tools pull-right">
				<div class="has-feedback">
					<input type="text" class="form-control input-sm"
						placeholder="搜索"> <span
						class="glyphicon glyphicon-search form-control-feedback"></span>
				</div>
			</div>
			<!--工具栏/-->

			<!--数据列表-->
			<table id="dataList"
				class="table table-bordered table-striped table-hover dataTable">
				<thead>
					<tr>
						<th class="" style="padding-right: 0px"><input
							id="selall" type="checkbox" class="icheckbox_square-blue">
						</th>
						<th class="sorting_asc">ID</th>
						<th class="sorting_desc">权限名称</th>
						<th class="sorting_asc sorting_asc_disabled">URL</th>
						<th class="text-center">操作</th>
					</tr>
				</thead>
				<tbody>

					<c:forEach items="${permissionList}" var="p">
						<tr>
							<td><input name="ids" type="checkbox"></td>
							<td>${p.id }</td>
							<td>${p.permissionName }</td>
							<td>${p.url }</td>
							<td class="text-center">
								<a href="${pageContext.request.contextPath}/role/findById.do?id=${p.id}" class="btn bg-olive btn-xs">详情</a>
								<a href="${pageContext.request.contextPath}/user/findUserByIdAndAllRole.do?id=${p.id}" class="btn bg-olive btn-xs">添加角色</a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
				<!--
                        <tfoot>
                        <tr>
                        <th>Rendering engine</th>
                        <th>Browser</th>
                        <th>Platform(s)</th>
                        <th>Engine version</th>
                        <th>CSS grade</th>
                        </tr>
                        </tfoot>-->
			</table>
			<!--数据列表/-->

		</div>
		<!-- 数据表格 /-->

	</div>
	<!-- /.box-body -->

	<!-- .box-footer-->
	<div class="box-footer">
		<div class="pull-left">
			<div class="form-group form-inline">
				总共2 页,共14 条数据。 每页 <select class="form-control">
					<option>1</option>
					<option>2</option>
					<option>3</option>
					<option>4</option>
					<option>5</option>
					<option>6</option>
				</select></div>
		</div>

		<div class="box-tools pull-right">
			<ul class="pagination">
				<li><a href="#" aria-label="Previous">首页</a></li>
				<li><a href="#">上一页</a></li>
				<li><a href="#">1</a></li>
				<li><a href="#">2</a></li>
				<li><a href="#">3</a></li>
				<li><a href="#">4</a></li>
				<li><a href="#">5</a></li>
				<li><a href="#">6</a></li>
				<li><a href="#">下一页</a></li>
				<li><a href="#" aria-label="Next">尾页</a></li>
			</ul>
		</div>

	</div>
	<!-- /.box-footer-->

</div>

</section>
<!-- 正文区域 /-->

  1. permiss-add.jsp(资源权限添加)
<div class="content-wrapper">

	<!-- 内容头部 -->
	<section class="content-header">
	<h1>
		资源权限管理 <small>资源权限表单</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="${pageContext.request.contextPath}/index.jsp"><i
				class="fa fa-dashboard"></i> 首页</a></li>
		<li><a href="${pageContext.request.contextPath}/permission/findAll.do">资源权限管理</a></li>
		<li class="active">资源权限表单</li>
	</ol>
	</section>
	<!-- 内容头部 /-->

	<form action="${pageContext.request.contextPath}/permission/save.do"
		method="post">
		<!-- 正文区域 -->
		<section class="content"> <!--产品信息-->

		<div class="panel panel-default">
			<div class="panel-heading">资源权限信息</div>
			<div class="row data-type">

				<div class="col-md-2 title">权限名称</div>
				<div class="col-md-4 data">
					<input type="text" class="form-control" name="permissionName"
						placeholder="权限名称" value="">
				</div>
				<div class="col-md-2 title">RUL</div>
				<div class="col-md-4 data">
					<input type="text" class="form-control" name="url"
						placeholder="URL" value="">
				</div>
								

			</div>
		</div>
		<!--订单信息/--> <!--工具栏-->
		<div class="box-tools text-center">
			<button type="submit" class="btn bg-maroon">保存</button>
			<button type="button" class="btn bg-default"
				onclick="history.back(-1);">返回</button>
		</div>
		<!--工具栏/--> </section>
		<!-- 正文区域 /-->
	</form>
</div>

  1. permiss-show.jsp(资源权限详情页面)
<!-- 正文区域 -->
<section class="content"> <!-- .box-body -->
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">列表</h3>
        </div>

        <div class="box-body">

            <!-- 数据表格 -->
            <div class="table-box">

                <!--工具栏-->
                <div class="pull-left">
                    <div class="form-group form-inline">
                        <div class="btn-group">
                            <button type="button" class="btn btn-default" title="新建">
                                <i class="fa fa-file-o"></i> 新建
                            </button>

                            <button type="button" class="btn btn-default" title="刷新">
                                <i class="fa fa-refresh"></i> 刷新
                            </button>
                        </div>
                    </div>
                </div>
                <div class="box-tools pull-right">
                    <div class="has-feedback">
                        <input type="text" class="form-control input-sm"
                               placeholder="搜索"> <span
                            class="glyphicon glyphicon-search form-control-feedback"></span>
                    </div>
                </div>
                <!--工具栏/-->

                <!--数据列表-->
                <div class="tab-pane" id="tab-treetable">
                    <table id="collapse-table"
                           class="table table-bordered table-hover dataTable">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>描述</th>
                        </tr>
                        </thead>
                        <tr data-tt-id="0">
                            <td>${permission.permissionName}</td>
                            <td>${permission.url}</td>
                        </tr>


                    </table>
                </div>
                <!--数据列表/-->

            </div>
            <!-- 数据表格 /-->

        </div>
        <!-- /.box-body -->

        <!-- .box-footer-->
       

            <div class="box-tools pull-right">
                <ul class="pagination">
                    <li><a href="#" aria-label="Previous">首页</a></li>
                    <li><a href="#">上一页</a></li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">下一页</a></li>
                    <li><a href="#" aria-label="Next">尾页</a></li>
                </ul>
            </div>

        </div>
        <!-- /.box-footer-->

    </div>

</section>
<!-- 正文区域 /-->

  1. user-role-add.jsp(用户关联角色添加页面)
<!-- 内容区域 -->
<div class="content-wrapper">

	<!-- 内容头部 -->
	<section class="content-header">
	<h1>
		用户管理 <small>添加角色表单</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="${pageContext.request.contextPath}/index.jsp"><i
				class="fa fa-dashboard"></i> 首页</a></li>
		<li><a
			href="${pageContext.request.contextPath}/user/findAll.do">用户管理</a></li>
		<li class="active">添加角色表单</li>
	</ol>
	</section>
	<!-- 内容头部 /-->

	<form
		action="${pageContext.request.contextPath}/user/addRoleToUser.do"
		method="post">
		<!-- 正文区域 -->
		<section class="content"> 
		
		<input type="hidden" name="userId" value="${user.id}">
		
			<table id="dataList"
					class="table table-bordered table-striped table-hover dataTable">
					<thead>
						<tr>
							<th class="" style="padding-right: 0px">
							<input id="selall" 
								type="checkbox" class="icheckbox_square-blue"></th>
							<th class="sorting_asc">ID</th>
							<th class="sorting">角色名称</th>
							<th class="sorting">角色描述</th>									
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${roleList}" var="role">
							<tr>
								<td>
								
								<input name="ids" type="checkbox" value="${role.id}">
								
								</td>
								<td>${role.id}</td>
								<td>${role.roleName }</td>
								<td>${role.roleDesc}</td>
								
							</tr>
						</c:forEach>
					</tbody>

				</table>
		<!--订单信息/--> <!--工具栏-->
		<div class="box-tools text-center">
			<button type="submit" class="btn bg-maroon">保存</button>
			<button type="button" class="btn bg-default"
				onclick="history.back(-1);">返回</button>
		</div>
		<!--工具栏/--> </section>
		<!-- 正文区域 /-->
	</form>
</div>
<!-- 内容区域 /-->

  1. role-permiss-add.jsp(角色关联资源权限添加页面)
<!-- 内容区域 -->
<div class="content-wrapper">

	<!-- 内容头部 -->
	<section class="content-header">
	<h1>
		角色管理 <small>添加权限表单</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="${pageContext.request.contextPath}/index.jsp"><i
				class="fa fa-dashboard"></i> 首页</a></li>
		<li><a
			href="${pageContext.request.contextPath}/role/findAll.do">角色管理</a></li>
		<li class="active">添加权限表单</li>
	</ol>
	</section>
	<!-- 内容头部 /-->

	<form
		action="${pageContext.request.contextPath}/role/addPermissionToRole.do"
		method="post">
		<!-- 正文区域 -->
		<section class="content"> 
		
		<input type="hidden" name="roleId" value="${role.id}">
		
			<table id="dataList"
					class="table table-bordered table-striped table-hover dataTable">
					<thead>
						<tr>
							<th class="" style="padding-right: 0px">
							<input id="selall" 
								type="checkbox" class="icheckbox_square-blue"></th>
							<th class="sorting_asc">ID</th>
							<th class="sorting">权限名称</th>
							<th class="sorting">权限URL</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${permissionList}" var="permission">
							<tr>
								<td>
								
								<input name="ids" type="checkbox" value="${permission.id}">
								
								</td>
								<td>${permission.id}</td>
								<td>${permission.permissionName }</td>
								<td>${permission.url}</td>
								
							</tr>
						</c:forEach>
					</tbody>

				</table>
		<!--订单信息/--> <!--工具栏-->
		<div class="box-tools text-center">
			<button type="submit" class="btn bg-maroon">保存</button>
			<button type="button" class="btn bg-default"
				onclick="history.back(-1);">返回</button>
		</div>
		<!--工具栏/--> </section>
		<!-- 正文区域 /-->
	</form>
</div>
<!-- 内容区域 /-->

  1. syslog.jsp(日志页面)
<!-- 正文区域 -->
<section class="content"> <!-- .box-body -->
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">列表</h3>
	</div>

	<div class="box-body">

		<!-- 数据表格 -->
		<div class="table-box">

			<!--工具栏-->
			<div class="pull-left">
				<div class="form-group form-inline">
					<div class="btn-group">
						<button type="button" class="btn btn-default" title="刷新"
							onclick="window.location.reload();">
							<i class="fa fa-refresh"></i> 刷新
						</button>
					</div>
				</div>
			</div>
			<div class="box-tools pull-right">
				<div class="has-feedback">
					<input type="text" class="form-control input-sm"
						placeholder="搜索"> <span
						class="glyphicon glyphicon-search form-control-feedback"></span>
				</div>
			</div>
			<!--工具栏/-->

			<!--数据列表-->
			<table id="dataList"
				class="table table-bordered table-striped table-hover dataTable">
				<thead>
					<tr>
						<th class="" style="padding-right: 0px"><input id="selall"
							type="checkbox" class="icheckbox_square-blue"></th>
						<th class="sorting_asc">ID</th>
						<th class="sorting">访问时间</th>
						<th class="sorting">访问用户</th>
						<th class="sorting">访问IP</th>
						<th class="sorting">资源URL</th>
						<th class="sorting">执行时间</th>
						<th class="sorting">访问方法</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${sysLogs}" var="syslog">
						<tr>
							<td><input name="ids" type="checkbox"></td>
							<td>${syslog.id}</td>
							<td>${syslog.visitTimeStr }</td>
							<td>${syslog.username }</td>
							<td>${syslog.ip }</td>
							<td>${syslog.url}</td>
							<td>${syslog.executionTime}毫秒</td>
							<td>${syslog.method}</td>										
						</tr>
					</c:forEach>
				</tbody>

			</table>
			<!--数据列表/-->



		</div>
		<!-- 数据表格 /-->

	</div>
	<!-- /.box-body -->

	<!-- .box-footer-->
	<div class="box-footer">

		<div class="box-tools pull-right">
			<ul class="pagination">
				<li><a href="#" aria-label="Previous">首页</a></li>
				<li><a href="#">上一页</a></li>
				<li><a href="#">1</a></li>
				<li><a href="#">2</a></li>
				<li><a href="#">3</a></li>
				<li><a href="#">下一页</a></li>
				<li><a href="#" aria-label="Next">尾页</a></li>
			</ul>
		</div>

	</div>
	<!-- /.box-footer-->

</div>

</section>
<!-- 正文区域 /-->

三、功能和页面展示

  1. 登录
    在这里插入图片描述

  2. 产品管理
    在这里插入图片描述

  3. 订单管理
    在这里插入图片描述

  4. 订单详情
    在这里插入图片描述

  5. 产品添加
    在这里插入图片描述

  6. 用户管理
    在这里插入图片描述

  7. 新建用户
    在这里插入图片描述

  8. 角色管理
    在这里插入图片描述

  9. 角色详情
    在这里插入图片描述

  10. 资源权限管理
    在这里插入图片描述

  11. 日志管理
    在这里插入图片描述

四、总结

  以上就是企业权限管理系统 和 SSM 各框架学习要点,如果觉得还不错的话,就送我一个赞吧!如果本文对你有用的话,也欢迎收藏哦!

  • 6
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值