commit 203e985340581e4d4e72cf3b4ec9a0a55d49487e
Author: saysky <847064370@qq.com>
Date: Sun Apr 12 10:47:26 2020 +0800
first commit
diff --git a/.gitattributes b/.gitattributes
new file mode 100755
index 0000000..3151060
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+*.js linguist-language=Java
+*.css linguist-language=Java
+*.html linguist-language=jsp
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..bdde5b4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,41 @@
+target/
+logs/
+out/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+log/
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
+
+### Mac
+.DS_Store
+*/.DS_Store
+
+### VS Code ###
+*.project
+*.factorypath
+
+### 屏蔽,需要完整代码联系博主:微信847064370
+*.html
+/templates
+webapp/
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2beb65c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,37 @@
+# SpringBoot酒店管理系统
+基于SpringBoot实现的酒店管理系统,包括三种角色:管理员、酒店工作人员、客户。
+1. 管理员功能:客房管理、客房类型管理、酒店工作人员管理、其他所有权限
+- 酒店工作人员功能:客户管理、客房浏览查询、预定客房、查看所有订单列表、财务管理
+- 客户功能:注册、登录、找回密码、客房浏览查询、预定客房、查看自己订单列表
+
+## 技术组成
+- SpringBoot
+- MyBatis
+- Shiro
+- Thymeleaf
+- Bootstrap + jQuery
+
+
+## 预览
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## 联系方式
+需要提供部署或讲解服务,可以联系我
+微信:847064370
diff --git a/hotux.sql b/hotux.sql
new file mode 100644
index 0000000..4d8fc1d
--- /dev/null
+++ b/hotux.sql
@@ -0,0 +1,597 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server : localhost_3306
+ Source Server Type : MySQL
+ Source Server Version : 50643
+ Source Host : localhost:3306
+ Source Schema : hotux
+
+ Target Server Type : MySQL
+ Target Server Version : 50643
+ File Encoding : 65001
+
+ Date: 09/04/2020 22:38:47
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for category
+-- ----------------------------
+DROP TABLE IF EXISTS `category`;
+CREATE TABLE `category` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `cate_name` varchar(100) NOT NULL,
+ `cate_sort` int(11) NOT NULL DEFAULT '1',
+ `cate_desc` varchar(100) DEFAULT NULL,
+ `del_flag` int(1) NOT NULL DEFAULT '0',
+ `create_by` varchar(20) DEFAULT NULL,
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` varchar(20) DEFAULT NULL,
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of category
+-- ----------------------------
+BEGIN;
+INSERT INTO `category` VALUES (1, '单间', 1, '', 0, NULL, '2020-04-05 12:42:23', NULL, '2020-04-06 22:12:56');
+INSERT INTO `category` VALUES (2, '大床房', 1, NULL, 0, NULL, '2020-04-05 12:42:39', NULL, '2020-04-05 12:42:39');
+INSERT INTO `category` VALUES (3, '双人间', 1, NULL, 0, NULL, '2020-04-05 12:42:55', NULL, '2020-04-05 12:42:55');
+INSERT INTO `category` VALUES (4, '三人间', 1, NULL, 0, NULL, '2020-04-05 12:43:01', NULL, '2020-04-05 12:43:01');
+INSERT INTO `category` VALUES (5, '套房', 1, NULL, 0, NULL, '2020-04-05 12:43:04', NULL, '2020-04-05 12:43:04');
+COMMIT;
+
+-- ----------------------------
+-- Table structure for permission
+-- ----------------------------
+DROP TABLE IF EXISTS `permission`;
+CREATE TABLE `permission` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL,
+ `url` varchar(200) NOT NULL,
+ `resource_type` varchar(255) NOT NULL,
+ `pid` bigint(20) NOT NULL,
+ `icon` varchar(255) DEFAULT NULL,
+ `del_flag` int(1) DEFAULT '0',
+ `create_by` varchar(20) NOT NULL DEFAULT 'admin',
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` varchar(20) DEFAULT 'admin',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ `sort` double(11,0) DEFAULT '1',
+ `target` varchar(20) DEFAULT '_self',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=170 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of permission
+-- ----------------------------
+BEGIN;
+INSERT INTO `permission` VALUES (1, '首页', '/admin', 'menu', 0, 'fa fa-dashboard', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-16 12:42:25', 1, '_self');
+INSERT INTO `permission` VALUES (6, '获得侧边栏菜单', '/admin/currentMenus', 'button', 1, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:45:28', 6, '_self');
+INSERT INTO `permission` VALUES (70, '客户管理', '/admin/user/customer', 'menu', 0, 'fa fa-users', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-04-08 01:14:49', 80, '_self');
+INSERT INTO `permission` VALUES (72, '添加用户', '/admin/user/new', 'menu', 70, 'fa fa-circle-o', 1, 'admin', '2019-10-15 20:22:36', 'admin', '2020-04-07 00:09:37', 72, '_self');
+INSERT INTO `permission` VALUES (73, '用户保存', '/admin/user/save', 'button', 70, NULL, 0, 'admin', '2019-10-15 20:22:36', 'admin', '2019-10-15 20:30:55', 73, '_self');
+INSERT INTO `permission` VALUES (74, '删除用户', '/admin/user/delete', 'button', 70, NULL, 0, 'admin', '2019-10-15 20:22:36', 'admin', '2019-10-15 20:30:55', 74, '_self');
+INSERT INTO `permission` VALUES (75, '批量删除用户', '/admin/user/batchDelete', 'button', 70, NULL, 0, 'admin', '2019-10-15 20:22:36', 'admin', '2019-10-15 20:30:55', 75, '_self');
+INSERT INTO `permission` VALUES (76, '编辑用户', '/admin/user/edit', 'button', 70, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-16 13:27:24', 76, '_self');
+INSERT INTO `permission` VALUES (82, '保存个人信息', '/admin/user/profile/save', 'button', 120, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:43:51', 82, '_self');
+INSERT INTO `permission` VALUES (83, '修改密码', '/admin/user/changePass', 'button', 120, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:43:41', 83, '_self');
+INSERT INTO `permission` VALUES (91, '角色管理', '/admin/role', 'menu', 0, 'fa fa-snowflake-o', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-16 12:52:05', 91, '_self');
+INSERT INTO `permission` VALUES (92, '保存角色', '/admin/role/save', 'button', 91, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:55:53', 92, '_self');
+INSERT INTO `permission` VALUES (93, '编辑角色', '/admin/role/edit', 'page', 91, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:58:40', 93, '_self');
+INSERT INTO `permission` VALUES (94, '删除角色', '/admin/role/delete', 'button', 91, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:55:47', 94, '_self');
+INSERT INTO `permission` VALUES (95, '权限管理', '/admin/permission', 'menu', 0, 'fa fa-podcast', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-03-12 15:08:17', 95, '_self');
+INSERT INTO `permission` VALUES (96, '保存权限', '/admin/permission/save', 'button', 95, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:55:45', 96, '_self');
+INSERT INTO `permission` VALUES (97, '编辑权限', '/admin/permission/edit', 'page', 95, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:57:13', 97, '_self');
+INSERT INTO `permission` VALUES (98, '删除权限', '/admin/permission/delete', 'button', 95, '', 0, 'admin', '2019-10-15 20:22:36', 'admin', '2020-02-07 23:55:43', 98, '_self');
+INSERT INTO `permission` VALUES (106, '获得当前登录用户信息接口', '/admin/currentUser', 'button', 1, '', 0, 'admin', '2020-02-04 10:26:13', 'admin', '2020-02-07 23:37:08', 1, '_self');
+INSERT INTO `permission` VALUES (110, '添加权限', '/admin/permission/new', 'menu', 95, 'fa fa-circle-o', 0, 'admin', '2020-02-07 23:14:11', 'admin', '2020-02-16 12:55:01', 1, '_self');
+INSERT INTO `permission` VALUES (111, '添加角色', '/admin/role/new', 'menu', 91, 'fa fa-circle-o', 0, 'admin', '2020-02-07 23:19:05', 'admin', '2020-02-16 12:54:51', 1, '_self');
+INSERT INTO `permission` VALUES (120, '个人信息', '/admin/user/profile', 'page', 0, '', 0, 'admin', '2020-02-07 23:38:51', 'admin', '2020-02-08 00:02:34', 99, '_self');
+INSERT INTO `permission` VALUES (126, '客户列表', '/admin/user/customer', 'menu', 70, 'fa fa-circle-o', 1, 'admin', '2020-02-08 19:20:23', 'admin', '2020-04-08 01:20:27', 0, '_self');
+INSERT INTO `permission` VALUES (127, '角色列表', '/admin/role', 'menu', 91, 'fa fa-circle-o', 0, 'admin', '2020-02-08 19:20:54', 'admin', '2020-02-16 12:54:47', 0, '_self');
+INSERT INTO `permission` VALUES (128, '权限列表', '/admin/permission', 'menu', 95, 'fa fa-circle-o', 0, 'admin', '2020-02-08 19:21:16', 'admin', '2020-02-16 12:54:57', 0, '_self');
+INSERT INTO `permission` VALUES (131, '客房管理', '/admin/post', 'menu', 0, 'fa fa-paint-brush', 0, 'admin', '2020-03-07 19:37:26', 'admin', '2020-04-06 16:32:16', 5, '_self');
+INSERT INTO `permission` VALUES (132, '新增客房', '/admin/post/new', 'menu', 131, 'fa fa-circle-o', 0, 'admin', '2020-03-07 19:39:34', 'admin', '2020-04-06 16:32:39', 9, '_self');
+INSERT INTO `permission` VALUES (133, '客房列表', '/admin/post', 'menu', 131, 'fa fa-circle-o', 0, 'admin', '2020-03-07 19:40:00', 'admin', '2020-04-06 16:32:28', 8, '_self');
+INSERT INTO `permission` VALUES (134, '评论管理', '/admin/comment', 'menu', 0, 'fa fa-comment', 1, 'admin', '2020-03-07 19:46:32', 'admin', '2020-04-06 22:17:51', 11, '_self');
+INSERT INTO `permission` VALUES (135, '回复我的', '/admin/comment/receive', 'menu', 134, 'fa fa-circle-o', 1, 'admin', '2020-03-07 19:57:53', 'admin', '2020-04-06 22:17:22', 20, '_self');
+INSERT INTO `permission` VALUES (136, '我的评论', '/admin/comment/send', 'menu', 134, 'fa fa-circle-o', 1, 'admin', '2020-03-07 19:58:54', 'admin', '2020-04-06 22:17:26', 2, '_self');
+INSERT INTO `permission` VALUES (137, '客房类型管理', '/admin/category', 'menu', 0, 'fa fa-book', 0, 'admin', '2020-03-07 20:00:57', 'admin', '2020-04-07 00:19:44', 6, '_self');
+INSERT INTO `permission` VALUES (138, '类型列表', '/admin/category', 'menu', 137, 'fa fa-circle-o', 0, 'admin', '2020-03-07 20:01:36', 'admin', '2020-04-06 22:23:23', 1, '_self');
+INSERT INTO `permission` VALUES (139, '新建类型', '/admin/category/new', 'menu', 137, 'fa fa-circle-o', 1, 'admin', '2020-03-07 20:02:14', 'admin', '2020-04-08 01:10:59', 1, '_self');
+INSERT INTO `permission` VALUES (140, '删除客房', '/admin/post/delete', 'button', 133, '', 0, 'admin', '2020-03-08 15:02:20', 'admin', '2020-04-06 16:32:49', 1, '_self');
+INSERT INTO `permission` VALUES (141, '批量删除客房', '/admin/post/batchDelete', 'button', 133, '', 0, 'admin', '2020-03-08 15:03:02', 'admin', '2020-04-06 16:32:58', 1, '_self');
+INSERT INTO `permission` VALUES (142, '编辑客房信息', '/admin/post/edit', 'page', 133, '', 0, 'admin', '2020-03-08 15:03:49', 'admin', '2020-04-06 16:33:09', 1, '_self');
+INSERT INTO `permission` VALUES (143, '保存客房', '/admin/post/save', 'button', 132, '', 0, 'admin', '2020-03-08 15:04:42', 'admin', '2020-04-07 00:21:39', 1, '_self');
+INSERT INTO `permission` VALUES (144, '还原客房', '/admin/post/revert', 'button', 133, '', 0, 'admin', '2020-03-08 15:05:23', 'admin', '2020-04-07 00:21:25', 1, '_self');
+INSERT INTO `permission` VALUES (145, '移到回收站', '/admin/post/throw', 'button', 133, '', 0, 'admin', '2020-03-08 15:07:01', 'admin', '2020-03-08 15:07:01', 1, '_self');
+INSERT INTO `permission` VALUES (146, '文件上传', '/admin/file/upload', 'button', 132, '', 0, 'admin', '2020-03-08 17:53:01', 'admin', '2020-03-08 17:53:01', 1, '_self');
+INSERT INTO `permission` VALUES (147, '保存类型', '/admin/category/save', 'button', 138, '', 0, 'admin', '2020-03-08 18:51:48', 'admin', '2020-04-08 01:10:35', 1, '_self');
+INSERT INTO `permission` VALUES (148, '编辑类型', '/admin/category/edit', 'button', 138, '', 0, 'admin', '2020-03-08 18:52:27', 'admin', '2020-04-08 01:11:21', 1, '_self');
+INSERT INTO `permission` VALUES (149, '删除类型', '/admin/category/delete', 'button', 138, '', 0, 'admin', '2020-03-08 18:54:13', 'admin', '2020-04-08 01:11:14', 1, '_self');
+INSERT INTO `permission` VALUES (150, '订单管理', '/admin/order', 'menu', 0, 'fa fa-tag', 0, 'admin', '2020-03-08 19:19:59', 'admin', '2020-04-06 22:18:14', 8, '_self');
+INSERT INTO `permission` VALUES (151, '订单列表', '/admin/order', 'menu', 150, '', 1, 'admin', '2020-03-08 19:30:16', 'admin', '2020-04-08 01:21:56', 1, '_self');
+INSERT INTO `permission` VALUES (152, '删除订单', '/admin/order/delete', 'button', 150, '', 0, 'admin', '2020-03-08 19:32:56', 'admin', '2020-04-08 01:21:33', 1, '_self');
+INSERT INTO `permission` VALUES (153, '所有评论', '/admin/comment', 'menu', 134, 'fa fa-circle-o', 1, 'admin', '2020-03-08 19:34:13', 'admin', '2020-04-06 22:17:48', 1, '_self');
+INSERT INTO `permission` VALUES (154, '添加标签', '/admin/tag/new', 'menu', 150, '', 1, 'admin', '2020-03-08 19:42:31', 'admin', '2020-04-06 22:20:23', 1, '_self');
+INSERT INTO `permission` VALUES (155, '完结订单', '/admin/order/finish', 'button', 150, '', 0, 'admin', '2020-03-08 19:43:06', 'admin', '2020-04-08 01:21:42', 1, '_self');
+INSERT INTO `permission` VALUES (156, '保存标签', '/admin/tag/save', 'button', 154, '', 1, 'admin', '2020-03-08 19:44:45', 'admin', '2020-04-06 22:20:19', 1, '_self');
+INSERT INTO `permission` VALUES (157, '删除评论', '/admin/comment/delete', 'button', 153, '', 1, 'admin', '2020-03-08 22:13:57', 'admin', '2020-04-06 22:17:43', 1, '_self');
+INSERT INTO `permission` VALUES (158, '批量删除评论', '/admin/comment/batchDelete', 'button', 153, '', 1, 'admin', '2020-03-08 22:15:57', 'admin', '2020-04-06 22:17:36', 1, '_self');
+INSERT INTO `permission` VALUES (159, '后台回复评论', '/admin/comment/reply', 'button', 153, '', 1, 'admin', '2020-03-08 22:27:39', 'admin', '2020-04-06 22:17:31', 1, '_self');
+INSERT INTO `permission` VALUES (160, '置顶文章', '/admin/post/stick', 'button', 133, '', 1, 'admin', '2020-04-03 22:54:45', 'admin', '2020-04-07 00:21:45', 1, '_self');
+INSERT INTO `permission` VALUES (161, '取消置顶文章', '/admin/post/unStick', 'button', 133, '', 1, 'admin', '2020-04-03 22:55:22', 'admin', '2020-04-07 00:19:59', 1, '_self');
+INSERT INTO `permission` VALUES (162, '推荐文章', '/admin/post/recommend', 'button', 133, '', 1, 'admin', '2020-04-03 22:55:49', 'admin', '2020-04-07 00:21:51', 1, '_self');
+INSERT INTO `permission` VALUES (163, '取消置顶文章', '/admin/post/unRecommend', 'button', 133, '', 1, 'admin', '2020-04-03 22:56:16', 'admin', '2020-04-07 00:19:54', 1, '_self');
+INSERT INTO `permission` VALUES (164, '工作人员管理', '/admin/user/worker', 'menu', 0, 'fa fa-user', 0, 'admin', '2020-04-07 00:01:50', 'admin', '2020-04-08 01:14:21', 85, '_self');
+INSERT INTO `permission` VALUES (165, '工作人员列表', '/admin/user/worker', 'menu', 164, 'fa fa-circle-o', 1, 'admin', '2020-04-07 00:09:20', 'admin', '2020-04-08 01:21:06', 1, '_self');
+INSERT INTO `permission` VALUES (166, '新增工作人员', '/admin/user/new', 'menu', 164, 'fa fa-circle-o', 1, 'admin', '2020-04-07 00:10:01', 'admin', '2020-04-08 01:20:45', 1, '_self');
+INSERT INTO `permission` VALUES (167, '财务管理', '/admin/order/finance', 'menu', 0, 'fa fa-money', 0, 'admin', '2020-04-07 00:12:17', 'admin', '2020-04-08 00:26:36', 88, '_self');
+INSERT INTO `permission` VALUES (168, '关闭订单', '/admin/order/close', 'button', 150, '', 0, 'admin', '2020-04-07 23:01:44', 'admin', '2020-04-08 01:21:27', 1, '_self');
+INSERT INTO `permission` VALUES (169, '获得当前登录用户角色接口', '/admin/currentRole', 'button', 1, '', 0, 'admin', '2020-04-07 23:02:23', 'admin', '2020-04-07 23:02:23', 1, '_self');
+COMMIT;
+
+-- ----------------------------
+-- Table structure for post
+-- ----------------------------
+DROP TABLE IF EXISTS `post`;
+CREATE TABLE `post` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `cate_id` bigint(20) NOT NULL,
+ `post_content` longtext NOT NULL,
+ `post_status` int(11) NOT NULL,
+ `post_summary` varchar(2000) NOT NULL,
+ `post_thumbnail` varchar(255) NOT NULL,
+ `post_title` varchar(255) NOT NULL,
+ `price` int(10) NOT NULL,
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `create_by` varchar(255) DEFAULT 'admin',
+ `update_by` varchar(255) DEFAULT 'admin',
+ `del_flag` int(1) NOT NULL DEFAULT '0',
+ `number` varchar(100) NOT NULL,
+ `img_url` varchar(1000) NOT NULL,
+ `post_editor` varchar(2000) NOT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of post
+-- ----------------------------
+BEGIN;
+INSERT INTO `post` VALUES (1, 3, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list1.jpg', '美式风格商务间', 400, '2020-03-12 18:10:56', '2020-04-06 23:41:41', 'admin', 'admin', 0, 'N201', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '









');
+INSERT INTO `post` VALUES (2, 3, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list2.jpg', '意大利风格标准间', 300, '2020-03-12 18:12:21', '2020-04-06 23:44:00', 'admin', 'admin', 0, 'N202', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (3, 5, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list3.jpg', '总统套房', 900, '2020-03-12 18:13:52', '2020-04-06 23:44:01', 'admin', 'admin', 0, 'N203', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (4, 1, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list4.jpg', '法国风格大床房', 399, '2020-03-12 18:15:41', '2020-04-06 23:44:01', 'admin', 'admin', 0, 'N204', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (5, 5, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list5.jpg', '豪华套房', 700, '2020-03-12 18:17:24', '2020-04-06 23:44:01', 'admin', 'admin', 0, 'N205', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (6, 4, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list6.jpg', '标准三人间', 300, '2020-03-12 18:20:02', '2020-04-06 23:44:07', 'admin', 'admin', 0, 'N206', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (7, 3, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list7.jpg', '商务标准间', 400, '2020-03-12 18:20:51', '2020-04-06 23:45:12', 'admin', 'admin', 0, 'S201', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '








');
+INSERT INTO `post` VALUES (8, 1, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list8.jpg', '贵族大床房', 300, '2020-03-12 18:21:57', '2020-04-06 23:44:08', 'admin', 'admin', 0, 'S202', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (9, 1, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list9.jpg', '情侣大床房', 200, '2020-03-12 18:23:16', '2020-04-06 23:44:08', 'admin', 'admin', 0, 'S203', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (10, 1, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list9.jpg', '经济单人间', 120, '2020-03-12 18:24:02', '2020-04-06 23:42:05', 'admin', 'admin', 0, 'S204', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '








');
+INSERT INTO `post` VALUES (11, 2, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibus a, interdum eu nibh.', 0, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum orci nulla, fermentum in faucibu', '/static/front/images/room-list/list2.jpg', '海天大床房', 200, '2020-03-30 18:25:04', '2020-04-06 23:44:09', 'admin', 'admin', 0, 'S205', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (12, 5, '前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒前所未有的舒适,适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适。', 0, '前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有的舒适,前所未有', '/upload/2020/4/news9.jpg', '枫丹白露套房', 788, '2020-04-06 17:44:00', '2020-04-06 23:41:54', 'admin', 'admin', 0, '301', '/static/front/images/detail-slider/slider1.jpg,/static/front/images/detail-slider/slider2.jpg,/static/front/images/detail-slider/slider3.jpg,/static/front/images/detail-slider/slider4.jpg,/static/front/images/detail-slider/slider5.jpg,/static/front/images/detail-slider/slider6.jpg,/static/front/images/detail-slider/slider7.jpg,/static/front/images/detail-slider/slider8.jpg,/static/front/images/detail-slider/slider9.jpg', '








');
+INSERT INTO `post` VALUES (13, 1, '贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房', 0, '贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房贵族大床房', '/upload/2020/4/news3.jpg', '贵族大床房', 300, '2020-04-06 21:38:56', '2020-04-06 22:10:32', 'admin', 'admin', 0, 'S209', '/upload/2020/4/room2.jpg,/upload/2020/4/room4.jpg', '
\n
\n
\n
\n
\n
\n
\n
\n
');
+INSERT INTO `post` VALUES (14, 2, '', 1, '', '/upload/2020/4/news5.jpg', '贵族大床房', 299, '2020-04-06 21:52:00', '2020-04-06 23:25:55', 'admin', 'admin', 0, 'S302', '/upload/2020/4/news10.jpg,/upload/2020/4/news8.jpg', '

');
+COMMIT;
+
+-- ----------------------------
+-- Table structure for record
+-- ----------------------------
+DROP TABLE IF EXISTS `record`;
+CREATE TABLE `record` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `user_id` bigint(20) NOT NULL,
+ `post_id` bigint(20) DEFAULT NULL,
+ `record_date` varchar(255) DEFAULT NULL,
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `create_by` varchar(255) DEFAULT 'admin',
+ `update_by` varchar(255) DEFAULT 'admin',
+ `del_flag` int(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of record
+-- ----------------------------
+BEGIN;
+INSERT INTO `record` VALUES (1, 18, 11, '2020-04-06', '2020-04-06 15:36:05', '2020-04-06 15:36:05', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (2, 18, 9, '2020-04-06', '2020-04-06 15:38:20', '2020-04-06 15:38:20', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (3, 18, 10, '2020-04-06', '2020-04-06 16:08:38', '2020-04-06 16:08:38', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (4, 18, 8, '2020-04-06', '2020-04-06 16:10:53', '2020-04-06 16:10:53', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (5, 18, 7, '2020-04-06', '2020-04-06 16:11:35', '2020-04-06 16:11:35', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (6, 18, 5, '2020-04-06', '2020-04-06 16:28:31', '2020-04-06 16:28:31', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (7, 19, 13, '2020-04-07', '2020-04-07 22:41:32', '2020-04-07 22:41:32', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (8, 18, 11, '2020-04-07', '2020-04-07 23:24:45', '2020-04-07 23:41:20', 'admin', 'admin', 1);
+INSERT INTO `record` VALUES (9, 18, 10, '2020-04-07', '2020-04-07 23:28:39', '2020-04-07 23:41:09', 'admin', 'admin', 1);
+INSERT INTO `record` VALUES (10, 18, 12, '2020-04-07', '2020-04-07 23:32:44', '2020-04-07 23:37:13', 'admin', 'admin', 1);
+INSERT INTO `record` VALUES (11, 18, 3, '2020-04-07', '2020-04-07 23:33:01', '2020-04-07 23:36:57', 'admin', 'admin', 1);
+INSERT INTO `record` VALUES (12, 18, 6, '2020-04-07', '2020-04-07 23:33:18', '2020-04-07 23:36:07', 'admin', 'admin', 1);
+INSERT INTO `record` VALUES (13, 18, 8, '2020-04-07', '2020-04-07 23:33:36', '2020-04-07 23:40:37', 'admin', 'admin', 1);
+INSERT INTO `record` VALUES (14, 20, 13, '2020-04-09', '2020-04-08 00:45:09', '2020-04-08 00:45:09', 'admin', 'admin', 0);
+INSERT INTO `record` VALUES (15, 19, 7, '2020-04-08', '2020-04-08 01:04:01', '2020-04-08 01:04:01', 'admin', 'admin', 0);
+COMMIT;
+
+-- ----------------------------
+-- Table structure for role
+-- ----------------------------
+DROP TABLE IF EXISTS `role`;
+CREATE TABLE `role` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `role` varchar(100) NOT NULL,
+ `description` varchar(255) DEFAULT NULL,
+ `level` int(1) NOT NULL,
+ `del_flag` int(1) DEFAULT '0',
+ `create_by` varchar(20) DEFAULT NULL,
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` varchar(20) DEFAULT NULL,
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `is_register_default` int(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of role
+-- ----------------------------
+BEGIN;
+INSERT INTO `role` VALUES (1, 'admin', '管理员', 10, 0, NULL, '2020-02-05 18:54:23', NULL, '2020-03-08 13:31:39', 0);
+INSERT INTO `role` VALUES (2, 'customer', '客户', 1, 0, NULL, '2020-02-05 18:54:29', NULL, '2020-04-06 23:54:28', 1);
+INSERT INTO `role` VALUES (3, 'worker', '工作人员', 5, 0, NULL, '2020-04-06 23:51:27', NULL, '2020-04-06 23:51:27', 0);
+COMMIT;
+
+-- ----------------------------
+-- Table structure for role_permission_ref
+-- ----------------------------
+DROP TABLE IF EXISTS `role_permission_ref`;
+CREATE TABLE `role_permission_ref` (
+ `role_id` bigint(20) NOT NULL,
+ `permission_id` bigint(20) NOT NULL,
+ `del_flag` int(1) DEFAULT '0',
+ `create_by` varchar(20) DEFAULT NULL,
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` varchar(20) DEFAULT NULL,
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=2071 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of role_permission_ref
+-- ----------------------------
+BEGIN;
+INSERT INTO `role_permission_ref` VALUES (4, 1, 0, NULL, '2019-10-15 21:15:32', NULL, '2019-10-15 21:15:32', 421);
+INSERT INTO `role_permission_ref` VALUES (4, 6, 0, NULL, '2019-10-15 21:15:32', NULL, '2019-10-15 21:15:32', 422);
+INSERT INTO `role_permission_ref` VALUES (4, 70, 0, NULL, '2019-10-15 21:15:32', NULL, '2019-10-15 21:15:32', 429);
+INSERT INTO `role_permission_ref` VALUES (4, 82, 0, NULL, '2019-10-15 21:15:32', NULL, '2019-10-15 21:15:32', 432);
+INSERT INTO `role_permission_ref` VALUES (4, 83, 0, NULL, '2019-10-15 21:15:32', NULL, '2019-10-15 21:15:32', 433);
+INSERT INTO `role_permission_ref` VALUES (5, 1, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 565);
+INSERT INTO `role_permission_ref` VALUES (5, 6, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 569);
+INSERT INTO `role_permission_ref` VALUES (5, 70, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 618);
+INSERT INTO `role_permission_ref` VALUES (5, 76, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 621);
+INSERT INTO `role_permission_ref` VALUES (5, 91, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 626);
+INSERT INTO `role_permission_ref` VALUES (5, 93, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 627);
+INSERT INTO `role_permission_ref` VALUES (5, 95, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 628);
+INSERT INTO `role_permission_ref` VALUES (5, 97, 0, NULL, '2019-10-15 22:53:09', NULL, '2019-10-15 22:53:09', 629);
+INSERT INTO `role_permission_ref` VALUES (14, 1, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 861);
+INSERT INTO `role_permission_ref` VALUES (14, 6, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 865);
+INSERT INTO `role_permission_ref` VALUES (14, 106, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 867);
+INSERT INTO `role_permission_ref` VALUES (14, 70, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 878);
+INSERT INTO `role_permission_ref` VALUES (14, 73, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 881);
+INSERT INTO `role_permission_ref` VALUES (14, 74, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 882);
+INSERT INTO `role_permission_ref` VALUES (14, 75, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 883);
+INSERT INTO `role_permission_ref` VALUES (14, 76, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 884);
+INSERT INTO `role_permission_ref` VALUES (14, 82, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 890);
+INSERT INTO `role_permission_ref` VALUES (14, 83, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 891);
+INSERT INTO `role_permission_ref` VALUES (14, 91, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 895);
+INSERT INTO `role_permission_ref` VALUES (14, 92, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 896);
+INSERT INTO `role_permission_ref` VALUES (14, 93, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 897);
+INSERT INTO `role_permission_ref` VALUES (14, 94, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 898);
+INSERT INTO `role_permission_ref` VALUES (14, 95, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 899);
+INSERT INTO `role_permission_ref` VALUES (14, 96, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 900);
+INSERT INTO `role_permission_ref` VALUES (14, 97, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 901);
+INSERT INTO `role_permission_ref` VALUES (14, 98, 0, NULL, '2020-02-06 11:38:27', NULL, '2020-02-06 11:38:27', 902);
+INSERT INTO `role_permission_ref` VALUES (15, 1, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 903);
+INSERT INTO `role_permission_ref` VALUES (15, 6, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 907);
+INSERT INTO `role_permission_ref` VALUES (15, 106, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 909);
+INSERT INTO `role_permission_ref` VALUES (15, 70, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 920);
+INSERT INTO `role_permission_ref` VALUES (15, 73, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 923);
+INSERT INTO `role_permission_ref` VALUES (15, 74, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 924);
+INSERT INTO `role_permission_ref` VALUES (15, 75, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 925);
+INSERT INTO `role_permission_ref` VALUES (15, 76, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 926);
+INSERT INTO `role_permission_ref` VALUES (15, 82, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 932);
+INSERT INTO `role_permission_ref` VALUES (15, 83, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 933);
+INSERT INTO `role_permission_ref` VALUES (15, 91, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 937);
+INSERT INTO `role_permission_ref` VALUES (15, 92, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 938);
+INSERT INTO `role_permission_ref` VALUES (15, 93, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 939);
+INSERT INTO `role_permission_ref` VALUES (15, 94, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 940);
+INSERT INTO `role_permission_ref` VALUES (15, 95, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 941);
+INSERT INTO `role_permission_ref` VALUES (15, 96, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 942);
+INSERT INTO `role_permission_ref` VALUES (15, 97, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 943);
+INSERT INTO `role_permission_ref` VALUES (15, 98, 0, NULL, '2020-02-06 11:40:38', NULL, '2020-02-06 11:40:38', 944);
+INSERT INTO `role_permission_ref` VALUES (16, 1, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 945);
+INSERT INTO `role_permission_ref` VALUES (16, 6, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 949);
+INSERT INTO `role_permission_ref` VALUES (16, 106, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 951);
+INSERT INTO `role_permission_ref` VALUES (16, 70, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 962);
+INSERT INTO `role_permission_ref` VALUES (16, 73, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 965);
+INSERT INTO `role_permission_ref` VALUES (16, 74, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 966);
+INSERT INTO `role_permission_ref` VALUES (16, 75, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 967);
+INSERT INTO `role_permission_ref` VALUES (16, 76, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 968);
+INSERT INTO `role_permission_ref` VALUES (16, 82, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 974);
+INSERT INTO `role_permission_ref` VALUES (16, 83, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 975);
+INSERT INTO `role_permission_ref` VALUES (16, 91, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 979);
+INSERT INTO `role_permission_ref` VALUES (16, 92, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 980);
+INSERT INTO `role_permission_ref` VALUES (16, 93, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 981);
+INSERT INTO `role_permission_ref` VALUES (16, 94, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 982);
+INSERT INTO `role_permission_ref` VALUES (16, 95, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 983);
+INSERT INTO `role_permission_ref` VALUES (16, 96, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 984);
+INSERT INTO `role_permission_ref` VALUES (16, 97, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 985);
+INSERT INTO `role_permission_ref` VALUES (16, 98, 0, NULL, '2020-02-06 11:42:26', NULL, '2020-02-06 11:42:26', 986);
+INSERT INTO `role_permission_ref` VALUES (13, 1, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1177);
+INSERT INTO `role_permission_ref` VALUES (13, 106, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1178);
+INSERT INTO `role_permission_ref` VALUES (13, 6, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1179);
+INSERT INTO `role_permission_ref` VALUES (13, 70, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1181);
+INSERT INTO `role_permission_ref` VALUES (13, 73, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1183);
+INSERT INTO `role_permission_ref` VALUES (13, 74, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1184);
+INSERT INTO `role_permission_ref` VALUES (13, 75, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1185);
+INSERT INTO `role_permission_ref` VALUES (13, 76, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1186);
+INSERT INTO `role_permission_ref` VALUES (13, 120, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1187);
+INSERT INTO `role_permission_ref` VALUES (13, 82, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1188);
+INSERT INTO `role_permission_ref` VALUES (13, 83, 0, NULL, '2020-02-08 14:21:23', NULL, '2020-02-08 14:21:23', 1189);
+INSERT INTO `role_permission_ref` VALUES (17, 1, 0, NULL, '2020-02-08 18:47:20', NULL, '2020-02-08 18:47:20', 1230);
+INSERT INTO `role_permission_ref` VALUES (18, 1, 0, NULL, '2020-02-08 18:47:41', NULL, '2020-02-08 18:47:41', 1231);
+INSERT INTO `role_permission_ref` VALUES (1, 1, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1958);
+INSERT INTO `role_permission_ref` VALUES (1, 106, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1959);
+INSERT INTO `role_permission_ref` VALUES (1, 169, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1960);
+INSERT INTO `role_permission_ref` VALUES (1, 6, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1961);
+INSERT INTO `role_permission_ref` VALUES (1, 131, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1962);
+INSERT INTO `role_permission_ref` VALUES (1, 133, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1963);
+INSERT INTO `role_permission_ref` VALUES (1, 140, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1964);
+INSERT INTO `role_permission_ref` VALUES (1, 141, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1965);
+INSERT INTO `role_permission_ref` VALUES (1, 142, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1966);
+INSERT INTO `role_permission_ref` VALUES (1, 144, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1967);
+INSERT INTO `role_permission_ref` VALUES (1, 145, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1968);
+INSERT INTO `role_permission_ref` VALUES (1, 132, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1969);
+INSERT INTO `role_permission_ref` VALUES (1, 143, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1970);
+INSERT INTO `role_permission_ref` VALUES (1, 146, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1971);
+INSERT INTO `role_permission_ref` VALUES (1, 137, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1972);
+INSERT INTO `role_permission_ref` VALUES (1, 138, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1973);
+INSERT INTO `role_permission_ref` VALUES (1, 148, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1974);
+INSERT INTO `role_permission_ref` VALUES (1, 149, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1975);
+INSERT INTO `role_permission_ref` VALUES (1, 147, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1977);
+INSERT INTO `role_permission_ref` VALUES (1, 150, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1978);
+INSERT INTO `role_permission_ref` VALUES (1, 152, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1980);
+INSERT INTO `role_permission_ref` VALUES (1, 155, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1981);
+INSERT INTO `role_permission_ref` VALUES (1, 168, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1982);
+INSERT INTO `role_permission_ref` VALUES (1, 70, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1983);
+INSERT INTO `role_permission_ref` VALUES (1, 73, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1985);
+INSERT INTO `role_permission_ref` VALUES (1, 74, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1986);
+INSERT INTO `role_permission_ref` VALUES (1, 75, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1987);
+INSERT INTO `role_permission_ref` VALUES (1, 76, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1988);
+INSERT INTO `role_permission_ref` VALUES (1, 164, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1989);
+INSERT INTO `role_permission_ref` VALUES (1, 167, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1992);
+INSERT INTO `role_permission_ref` VALUES (1, 91, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1993);
+INSERT INTO `role_permission_ref` VALUES (1, 127, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1994);
+INSERT INTO `role_permission_ref` VALUES (1, 111, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1995);
+INSERT INTO `role_permission_ref` VALUES (1, 92, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1996);
+INSERT INTO `role_permission_ref` VALUES (1, 93, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1997);
+INSERT INTO `role_permission_ref` VALUES (1, 94, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1998);
+INSERT INTO `role_permission_ref` VALUES (1, 95, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 1999);
+INSERT INTO `role_permission_ref` VALUES (1, 128, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2000);
+INSERT INTO `role_permission_ref` VALUES (1, 110, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2001);
+INSERT INTO `role_permission_ref` VALUES (1, 96, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2002);
+INSERT INTO `role_permission_ref` VALUES (1, 97, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2003);
+INSERT INTO `role_permission_ref` VALUES (1, 98, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2004);
+INSERT INTO `role_permission_ref` VALUES (1, 120, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2005);
+INSERT INTO `role_permission_ref` VALUES (1, 82, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2006);
+INSERT INTO `role_permission_ref` VALUES (1, 83, 0, NULL, '2020-04-07 23:02:36', NULL, '2020-04-07 23:02:36', 2007);
+INSERT INTO `role_permission_ref` VALUES (2, 1, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2043);
+INSERT INTO `role_permission_ref` VALUES (2, 106, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2044);
+INSERT INTO `role_permission_ref` VALUES (2, 169, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2045);
+INSERT INTO `role_permission_ref` VALUES (2, 6, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2046);
+INSERT INTO `role_permission_ref` VALUES (2, 150, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2047);
+INSERT INTO `role_permission_ref` VALUES (2, 120, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2049);
+INSERT INTO `role_permission_ref` VALUES (2, 82, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2050);
+INSERT INTO `role_permission_ref` VALUES (2, 83, 0, NULL, '2020-04-07 23:03:20', NULL, '2020-04-07 23:03:20', 2051);
+INSERT INTO `role_permission_ref` VALUES (3, 1, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2052);
+INSERT INTO `role_permission_ref` VALUES (3, 106, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2053);
+INSERT INTO `role_permission_ref` VALUES (3, 169, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2054);
+INSERT INTO `role_permission_ref` VALUES (3, 6, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2055);
+INSERT INTO `role_permission_ref` VALUES (3, 150, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2056);
+INSERT INTO `role_permission_ref` VALUES (3, 152, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2058);
+INSERT INTO `role_permission_ref` VALUES (3, 155, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2059);
+INSERT INTO `role_permission_ref` VALUES (3, 168, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2060);
+INSERT INTO `role_permission_ref` VALUES (3, 70, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2061);
+INSERT INTO `role_permission_ref` VALUES (3, 73, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2063);
+INSERT INTO `role_permission_ref` VALUES (3, 74, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2064);
+INSERT INTO `role_permission_ref` VALUES (3, 75, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2065);
+INSERT INTO `role_permission_ref` VALUES (3, 76, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2066);
+INSERT INTO `role_permission_ref` VALUES (3, 167, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2067);
+INSERT INTO `role_permission_ref` VALUES (3, 120, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2068);
+INSERT INTO `role_permission_ref` VALUES (3, 82, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2069);
+INSERT INTO `role_permission_ref` VALUES (3, 83, 0, NULL, '2020-04-08 01:08:01', NULL, '2020-04-08 01:08:01', 2070);
+COMMIT;
+
+-- ----------------------------
+-- Table structure for t_order
+-- ----------------------------
+DROP TABLE IF EXISTS `t_order`;
+CREATE TABLE `t_order` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `user_id` bigint(20) NOT NULL,
+ `post_id` bigint(20) NOT NULL,
+ `start_date` varchar(255) NOT NULL,
+ `quantity` int(11) NOT NULL,
+ `name` varchar(20) NOT NULL,
+ `status` int(1) NOT NULL,
+ `id_card` varchar(20) NOT NULL,
+ `phone` varchar(20) NOT NULL,
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `create_by` varchar(255) DEFAULT 'admin',
+ `update_by` varchar(255) DEFAULT 'admin',
+ `del_flag` int(1) NOT NULL DEFAULT '0',
+ `price` int(11) NOT NULL,
+ `total_price` int(11) DEFAULT NULL,
+ `post_number` varchar(20) NOT NULL,
+ `post_title` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of t_order
+-- ----------------------------
+BEGIN;
+INSERT INTO `t_order` VALUES (1, 18, 11, '2020-04-06', 1, '周瑜', 1, '123456789012345671', '12312312312', '2020-04-06 15:36:05', '2020-04-06 15:36:05', 'admin', 'admin', 0, 300, 300, 'S205', 'ROYAL SUITE');
+INSERT INTO `t_order` VALUES (2, 18, 9, '2020-04-06', 1, '周瑜', 1, '123456789012345671', '12312312312', '2020-04-06 15:38:20', '2020-04-06 15:38:20', 'admin', 'admin', 0, 200, 200, 'S203', 'ROYAL SUITE');
+INSERT INTO `t_order` VALUES (3, 18, 10, '2020-04-06', 1, '周瑜', 1, '123456789012345671', '12312312312', '2020-04-06 16:08:38', '2020-04-06 16:08:38', 'admin', 'admin', 0, 400, 400, 'S204', 'ROYAL SUITE');
+INSERT INTO `t_order` VALUES (4, 18, 8, '2020-04-06', 1, '周瑜', 1, '123456789012345671', '12312312312', '2020-04-06 16:10:53', '2020-04-06 16:10:53', 'admin', 'admin', 0, 500, 500, 'S202', 'ROYAL SUITE');
+INSERT INTO `t_order` VALUES (5, 18, 7, '2020-04-06', 1, '周瑜', 1, '123456789012345671', '12312312312', '2020-04-06 16:11:35', '2020-04-06 16:11:35', 'admin', 'admin', 0, 400, 400, 'S201', 'ROYAL SUITE');
+INSERT INTO `t_order` VALUES (6, 18, 5, '2020-04-06', 1, '周瑜', 1, '123456789012345671', '12312312312', '2020-04-06 16:28:31', '2020-04-06 16:28:31', 'admin', 'admin', 0, 200, 200, 'N205', 'ROYAL SUITE');
+INSERT INTO `t_order` VALUES (7, 19, 13, '2020-04-07', 1, '张三', 1, '123123123123123', '33333333333', '2020-04-07 22:41:33', '2020-04-07 22:41:33', 'admin', 'admin', 0, 300, 300, 'S209', '贵族大床房');
+INSERT INTO `t_order` VALUES (8, 18, 11, '2020-04-07', 1, '周瑜', 1, '123456789012345671', '22222222222', '2020-04-07 23:24:46', '2020-04-07 23:41:20', 'admin', 'admin', 1, 200, 200, 'S205', '海天大床房');
+INSERT INTO `t_order` VALUES (9, 18, 10, '2020-04-07', 1, '周瑜', 3, '123456789012345671', '22222222222', '2020-04-07 23:28:40', '2020-04-07 23:28:40', 'admin', 'admin', 0, 120, 120, 'S204', '经济单人间');
+INSERT INTO `t_order` VALUES (10, 18, 12, '2020-04-07', 1, '周瑜', 2, '123456789012345671', '22222222222', '2020-04-07 23:32:45', '2020-04-07 23:40:47', 'admin', 'admin', 1, 788, 788, '301', '枫丹白露套房');
+INSERT INTO `t_order` VALUES (11, 18, 3, '2020-04-07', 1, '周瑜', 2, '123456789012345671', '22222222222', '2020-04-07 23:33:02', '2020-04-07 23:40:54', 'admin', 'admin', 1, 900, 900, 'N203', '总统套房');
+INSERT INTO `t_order` VALUES (12, 18, 6, '2020-04-07', 1, '周瑜', 2, '123456789012345671', '22222222222', '2020-04-07 23:33:18', '2020-04-07 23:40:41', 'admin', 'admin', 1, 300, 300, 'N206', '标准三人间');
+INSERT INTO `t_order` VALUES (13, 18, 8, '2020-04-07', 1, '周瑜', 2, '123456789012345671', '22222222222', '2020-04-07 23:33:37', '2020-04-07 23:40:37', 'admin', 'admin', 1, 300, 300, 'S202', '贵族大床房');
+INSERT INTO `t_order` VALUES (14, 20, 13, '2020-04-09', 1, '马云222', 1, '111111111111111199', '12312311111', '2020-04-08 00:45:10', '2020-04-08 01:05:56', 'admin', 'admin', 0, 300, 300, 'S209', '贵族大床房');
+INSERT INTO `t_order` VALUES (15, 19, 7, '2020-04-08', 1, '张三', 2, '123123123123123', '33333333333', '2020-04-08 01:04:02', '2020-04-08 01:04:02', 'admin', 'admin', 0, 400, 400, 'S201', '商务标准间');
+COMMIT;
+
+-- ----------------------------
+-- Table structure for tag
+-- ----------------------------
+DROP TABLE IF EXISTS `tag`;
+CREATE TABLE `tag` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `tag_name` varchar(100) NOT NULL,
+ `del_flag` int(1) NOT NULL DEFAULT '0',
+ `create_by` varchar(20) DEFAULT NULL,
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` varchar(20) DEFAULT NULL,
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of tag
+-- ----------------------------
+BEGIN;
+INSERT INTO `tag` VALUES (36, '视频', 0, NULL, '2020-03-11 21:47:11', NULL, '2020-03-11 21:47:11');
+INSERT INTO `tag` VALUES (37, 'Java', 0, NULL, '2020-03-12 18:10:56', NULL, '2020-03-12 18:10:56');
+INSERT INTO `tag` VALUES (38, '安卓', 0, NULL, '2020-03-12 18:10:56', NULL, '2020-03-12 18:10:56');
+INSERT INTO `tag` VALUES (39, 'Kotlin', 0, NULL, '2020-03-12 18:10:56', NULL, '2020-03-12 18:10:56');
+INSERT INTO `tag` VALUES (40, '谷歌', 0, NULL, '2020-03-12 18:10:56', NULL, '2020-03-12 18:10:56');
+INSERT INTO `tag` VALUES (41, 'AI', 0, NULL, '2020-03-12 18:12:20', NULL, '2020-03-12 18:12:20');
+INSERT INTO `tag` VALUES (42, '人脸识别', 0, NULL, '2020-03-12 18:12:20', NULL, '2020-03-12 18:12:20');
+INSERT INTO `tag` VALUES (43, '人脸搜索', 0, NULL, '2020-03-12 18:12:21', NULL, '2020-03-12 18:12:21');
+INSERT INTO `tag` VALUES (44, 'Oracle', 0, NULL, '2020-03-12 18:13:52', NULL, '2020-03-12 18:13:52');
+INSERT INTO `tag` VALUES (45, '金融', 0, NULL, '2020-03-12 18:13:52', NULL, '2020-03-12 18:13:52');
+INSERT INTO `tag` VALUES (46, '陆金所', 0, NULL, '2020-03-12 18:13:52', NULL, '2020-03-12 18:13:52');
+INSERT INTO `tag` VALUES (47, '算法', 0, NULL, '2020-03-12 18:15:41', NULL, '2020-03-12 18:15:41');
+INSERT INTO `tag` VALUES (48, 'Python', 0, NULL, '2020-03-12 18:17:24', NULL, '2020-03-12 18:17:24');
+INSERT INTO `tag` VALUES (49, '工具', 0, NULL, '2020-03-12 18:17:24', NULL, '2020-03-12 18:17:24');
+INSERT INTO `tag` VALUES (50, '大数据', 0, NULL, '2020-03-12 18:20:02', NULL, '2020-03-12 18:20:02');
+INSERT INTO `tag` VALUES (51, '高并发', 0, NULL, '2020-03-12 18:20:02', NULL, '2020-03-12 18:20:02');
+INSERT INTO `tag` VALUES (52, '后端开发', 0, NULL, '2020-03-12 18:20:51', NULL, '2020-03-12 18:20:51');
+INSERT INTO `tag` VALUES (53, '序列化', 0, NULL, '2020-03-12 18:20:51', NULL, '2020-03-12 18:20:51');
+INSERT INTO `tag` VALUES (54, '机器学习', 0, NULL, '2020-03-12 18:21:57', NULL, '2020-03-12 18:21:57');
+INSERT INTO `tag` VALUES (55, 'TensorFlow', 0, NULL, '2020-03-12 18:21:57', NULL, '2020-03-12 18:21:57');
+INSERT INTO `tag` VALUES (56, '腾讯', 0, NULL, '2020-03-12 18:23:16', NULL, '2020-03-12 18:23:16');
+INSERT INTO `tag` VALUES (57, '开源', 0, NULL, '2020-03-12 18:23:16', NULL, '2020-03-12 18:23:16');
+INSERT INTO `tag` VALUES (58, 'Druid', 0, NULL, '2020-03-12 18:24:02', NULL, '2020-03-12 18:24:02');
+INSERT INTO `tag` VALUES (59, '推特', 0, NULL, '2020-03-12 18:24:02', NULL, '2020-03-12 18:24:02');
+INSERT INTO `tag` VALUES (60, 'CPU', 0, NULL, '2020-03-12 18:25:04', NULL, '2020-03-12 18:25:04');
+INSERT INTO `tag` VALUES (61, 'GPU', 0, NULL, '2020-03-12 18:25:04', NULL, '2020-03-12 18:25:04');
+INSERT INTO `tag` VALUES (62, 'Twitter', 0, NULL, '2020-04-03 23:01:00', NULL, '2020-04-03 23:01:00');
+COMMIT;
+
+-- ----------------------------
+-- Table structure for user
+-- ----------------------------
+DROP TABLE IF EXISTS `user`;
+CREATE TABLE `user` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `login_last` datetime DEFAULT NULL,
+ `user_avatar` varchar(255) DEFAULT NULL,
+ `user_desc` varchar(255) DEFAULT NULL,
+ `user_display_name` varchar(255) DEFAULT NULL,
+ `id_card` varchar(100) DEFAULT NULL,
+ `user_name` varchar(100) DEFAULT NULL,
+ `user_pass` varchar(255) DEFAULT NULL,
+ `status` int(1) DEFAULT NULL,
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `create_by` varchar(255) DEFAULT 'admin',
+ `update_by` varchar(255) DEFAULT 'admin',
+ `del_flag` int(1) DEFAULT '0',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of user
+-- ----------------------------
+BEGIN;
+INSERT INTO `user` VALUES (1, '2020-04-04 11:13:50', '/static/images/avatar/1.jpeg', '人生得意须尽欢', '管理员', '123456789012345679', '11111111111', 'a021a665f503979c06f50b8de66a4218', 0, '2019-01-24 00:07:33', '2020-03-11 17:44:15', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (2, NULL, '/static/images/avatar/2.jpeg', '11', '马云', '123@qq.com', 'mayun', 'a021a665f503979c06f50b8de66a4218', 0, '2020-02-05 17:37:43', '2020-02-08 20:33:24', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (3, '2020-04-03 21:42:44', '/static/images/avatar/3.jpeg', '', '张三', '121113@qq.com', 'zhangsan', 'a021a665f503979c06f50b8de66a4218', 0, '2020-02-08 13:22:22', '2020-02-08 20:33:26', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (4, '2020-02-16 12:57:48', '/static/images/avatar/6.jpeg', '', '李四', 'lisi@qq.com', 'lisi', 'a021a665f503979c06f50b8de66a4218', 0, '2020-02-08 13:57:51', '2020-03-07 18:00:42', 'admin', 'admin', 1);
+INSERT INTO `user` VALUES (5, NULL, '/static/images/avatar/4.jpeg', '1111', '11', '12111113@qq.com', '111111', 'a021a665f503979c06f50b8de66a4218', 0, '2020-02-08 18:48:20', '2020-03-07 18:00:44', 'admin', 'admin', 1);
+INSERT INTO `user` VALUES (6, '2020-02-08 18:54:29', '/static/images/avatar/5.jpeg', '', '黄忠', '1231111@qq.com', 'huang', 'a021a665f503979c06f50b8de66a4218', 0, '2020-02-08 18:54:21', '2020-02-08 20:33:33', 'admin', 'admin', 1);
+INSERT INTO `user` VALUES (7, '2020-03-08 14:21:48', '/static/images/avatar/1.jpeg', '', 'mayun2', '123456@mayun.com', 'mayun2', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-08 14:21:05', '2020-04-07 23:18:46', 'admin', 'admin', 1);
+INSERT INTO `user` VALUES (8, '2020-03-09 16:21:31', '/static/images/avatar/35.jpeg', NULL, 'mahuateng', '111@qq.com', 'mahuateng', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-09 13:24:42', '2020-04-07 23:16:21', 'admin', 'admin', 1);
+INSERT INTO `user` VALUES (9, '2020-03-14 15:20:43', '/static/images/avatar/17.jpeg', NULL, 'zhaoyun', '847064370@qq.com', 'zhaoyun', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-11 21:27:11', '2020-04-07 23:18:46', 'admin', 'admin', 1);
+INSERT INTO `user` VALUES (10, '2020-03-11 21:41:01', '/static/images/avatar/28.jpeg', NULL, 'wangwu', 'wangwu@qq.com', 'wangwu', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-11 21:38:51', '2020-03-11 21:38:51', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (11, NULL, '/static/images/avatar/25.jpeg', NULL, 'wangwu2', '1234562@mayun.com', 'wangwu2', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-11 21:40:54', '2020-03-11 21:40:54', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (12, '2020-03-11 21:42:04', '/static/images/avatar/13.jpeg', NULL, 'zhangfei', '123456@zhang.com', 'zhangfei', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-11 21:41:55', '2020-03-11 21:41:55', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (13, '2020-03-11 21:44:48', '/static/images/avatar/9.jpeg', NULL, 'liubei', '123@qqq.com', 'liubei', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-11 21:42:51', '2020-03-11 21:42:51', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (14, NULL, '/static/images/avatar/13.jpeg', NULL, 'liubei2', '123456@m22ayun.com', 'liubei2', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-11 21:44:44', '2020-03-11 21:44:44', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (16, '2020-03-12 18:19:01', '/static/images/avatar/34.jpeg', NULL, 'lisi', 'lisi@qq.com', 'lisi', 'a021a665f503979c06f50b8de66a4218', 0, '2020-03-12 18:18:57', '2020-03-12 18:18:57', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (17, NULL, '/static/images/avatar/32.jpeg', NULL, '马云', '123456789012345678', '15779216424', 'a021a665f503979c06f50b8de66a4218', 0, '2020-04-05 23:18:01', '2020-04-05 23:18:01', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (18, NULL, '/static/images/avatar/40.jpeg', '', '周瑜', '123456789012345671', '22222222222', 'a021a665f503979c06f50b8de66a4218', 0, '2020-04-05 23:18:41', '2020-04-07 00:26:59', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (19, NULL, '/static/images/avatar/26.jpeg', NULL, '张三', '123123123123123', '33333333333', 'a021a665f503979c06f50b8de66a4218', 0, '2020-04-07 00:28:15', '2020-04-07 00:28:15', 'admin', 'admin', 0);
+INSERT INTO `user` VALUES (20, NULL, '/static/images/avatar/29.jpeg', '', '马云222', '111111111111111199', '12312311111', 'a021a665f503979c06f50b8de66a4218', 0, '2020-04-08 00:44:44', '2020-04-08 00:47:49', 'admin', 'admin', 0);
+COMMIT;
+
+-- ----------------------------
+-- Table structure for user_role_ref
+-- ----------------------------
+DROP TABLE IF EXISTS `user_role_ref`;
+CREATE TABLE `user_role_ref` (
+ `user_id` bigint(20) NOT NULL,
+ `role_id` bigint(20) NOT NULL,
+ `del_flag` int(1) DEFAULT '0',
+ `create_by` varchar(20) DEFAULT NULL,
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_by` varchar(20) DEFAULT NULL,
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of user_role_ref
+-- ----------------------------
+BEGIN;
+INSERT INTO `user_role_ref` VALUES (2, 2, 0, NULL, '2020-02-05 17:37:43', NULL, '2020-02-05 17:37:43', 2);
+INSERT INTO `user_role_ref` VALUES (1, 1, 0, NULL, '2020-02-08 13:56:55', NULL, '2020-02-08 13:56:55', 4);
+INSERT INTO `user_role_ref` VALUES (3, 2, 0, NULL, '2020-02-08 18:53:44', NULL, '2020-02-08 18:53:44', 10);
+INSERT INTO `user_role_ref` VALUES (10, 2, 0, NULL, '2020-03-11 21:38:51', NULL, '2020-03-11 21:38:51', 14);
+INSERT INTO `user_role_ref` VALUES (11, 2, 0, NULL, '2020-03-11 21:40:54', NULL, '2020-03-11 21:40:54', 15);
+INSERT INTO `user_role_ref` VALUES (12, 2, 0, NULL, '2020-03-11 21:41:56', NULL, '2020-03-11 21:41:56', 16);
+INSERT INTO `user_role_ref` VALUES (13, 2, 0, NULL, '2020-03-11 21:42:51', NULL, '2020-03-11 21:42:51', 17);
+INSERT INTO `user_role_ref` VALUES (14, 2, 0, NULL, '2020-03-11 21:44:44', NULL, '2020-03-11 21:44:44', 18);
+INSERT INTO `user_role_ref` VALUES (16, 2, 0, NULL, '2020-03-12 18:18:57', NULL, '2020-03-12 18:18:57', 19);
+INSERT INTO `user_role_ref` VALUES (17, 2, 0, NULL, '2020-04-05 23:18:01', NULL, '2020-04-05 23:18:01', 20);
+INSERT INTO `user_role_ref` VALUES (18, 3, 0, NULL, '2020-04-07 00:26:59', NULL, '2020-04-07 00:26:59', 23);
+INSERT INTO `user_role_ref` VALUES (19, 2, 0, NULL, '2020-04-07 00:28:15', NULL, '2020-04-07 00:28:15', 24);
+INSERT INTO `user_role_ref` VALUES (20, 2, 0, NULL, '2020-04-08 00:44:44', NULL, '2020-04-08 00:44:44', 25);
+COMMIT;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/img/1.png b/img/1.png
new file mode 100755
index 0000000..5844ea6
Binary files /dev/null and b/img/1.png differ
diff --git a/img/2.png b/img/2.png
new file mode 100755
index 0000000..bbbae9f
Binary files /dev/null and b/img/2.png differ
diff --git a/img/3.png b/img/3.png
new file mode 100755
index 0000000..9729d6c
Binary files /dev/null and b/img/3.png differ
diff --git a/img/4.png b/img/4.png
new file mode 100755
index 0000000..be9c704
Binary files /dev/null and b/img/4.png differ
diff --git a/img/5.png b/img/5.png
new file mode 100755
index 0000000..c4b6379
Binary files /dev/null and b/img/5.png differ
diff --git a/img/6.png b/img/6.png
new file mode 100755
index 0000000..0749c42
Binary files /dev/null and b/img/6.png differ
diff --git a/img/7.png b/img/7.png
new file mode 100755
index 0000000..fdad0c8
Binary files /dev/null and b/img/7.png differ
diff --git a/img/8.png b/img/8.png
new file mode 100755
index 0000000..8f47733
Binary files /dev/null and b/img/8.png differ
diff --git a/img/9.png b/img/9.png
new file mode 100755
index 0000000..b075299
Binary files /dev/null and b/img/9.png differ
diff --git a/pom.xml b/pom.xml
new file mode 100755
index 0000000..a464208
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,206 @@
+
+
+ 4.0.0
+ com.example
+ Hotux
+ 1.0.0
+ Hotux
+
+
+
+ 基于SpringBoot的酒店管理系统
+
+
+
+
+ saysky
+ 言曌
+ admin@example.com
+ https://example.com
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.7.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ 1.1.10
+ 1.18.2
+ 3.8
+ 4.1.13
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.1.2
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ ${druid.version}
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+
+
+ cn.hutool
+ hutool-all
+ ${hutool-all.version}
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.47
+
+
+
+ com.google.guava
+ guava
+ 26.0-jre
+
+
+
+ redis.clients
+ jedis
+ 2.9.0
+
+
+
+
+
+ org.apache.shiro
+ shiro-spring
+ 1.4.0
+
+
+
+
+ com.github.theborakompanioni
+ thymeleaf-extras-shiro
+ 2.0.0
+
+
+ com.google.code.gson
+ gson
+ 2.8.5
+
+
+
+
+ io.github.biezhi
+ oh-my-email
+ 0.0.3
+
+
+
+
+
+ aliyun
+ http://maven.aliyun.com/nexus/content/groups/public
+
+
+
+
+
+ aliyun
+ http://maven.aliyun.com/nexus/content/groups/public
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
+
diff --git a/src/main/java/com/example/hotel/Application.java b/src/main/java/com/example/hotel/Application.java
new file mode 100755
index 0000000..8a42b0f
--- /dev/null
+++ b/src/main/java/com/example/hotel/Application.java
@@ -0,0 +1,29 @@
+package com.example.hotel;
+
+import lombok.extern.slf4j.Slf4j;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.ApplicationContext;
+
+/**
+ *
+ * SENS run!
+ *
+ *
+ * @author : saysky
+ * @date : 2017/11/14
+ */
+@Slf4j
+@SpringBootApplication
+@EnableCaching
+@MapperScan("com.example.hotel.mapper*")
+public class Application {
+ public static void main(String[] args) {
+ ApplicationContext context = SpringApplication.run(Application.class, args);
+ String serverPort = context.getEnvironment().getProperty("server.port");
+ log.info("SENS started at http://localhost:" + serverPort);
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/common/base/BaseEntity.java b/src/main/java/com/example/hotel/common/base/BaseEntity.java
new file mode 100644
index 0000000..3182512
--- /dev/null
+++ b/src/main/java/com/example/hotel/common/base/BaseEntity.java
@@ -0,0 +1,52 @@
+package com.example.hotel.common.base;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.example.hotel.common.constant.CommonConstant;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author 言曌
+ * @date 2019-08-07 00:28
+ */
+@Data
+public class BaseEntity implements Serializable {
+
+ /**
+ * ID,自动生成
+ */
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 删除状态:1删除,0未删除
+ */
+ @TableField(value = "del_flag")
+ @TableLogic
+ private Integer delFlag = CommonConstant.STATUS_NORMAL;
+
+ /**
+ * 创建人手机号
+ */
+ private String createBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+ /**
+ * 更新人
+ */
+ private String updateBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updateTime;
+}
diff --git a/src/main/java/com/example/hotel/common/base/BaseService.java b/src/main/java/com/example/hotel/common/base/BaseService.java
new file mode 100644
index 0000000..35e3cae
--- /dev/null
+++ b/src/main/java/com/example/hotel/common/base/BaseService.java
@@ -0,0 +1,233 @@
+package com.example.hotel.common.base;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.vo.SearchVo;
+import com.example.hotel.dto.QueryCondition;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author 言曌
+ * @date 2019-09-04 22:47
+ */
+// JDK8函数式接口注解 仅能包含一个抽象方法
+public interface BaseService {
+
+ /**
+ * @return
+ */
+ BaseMapper getRepository();
+
+ /**
+ * 根据ID获取
+ *
+ * @param id
+ * @return
+ */
+ default E get(ID id) {
+ return getRepository().selectById(id);
+ }
+
+ /**
+ * 获取所有列表
+ *
+ * @return
+ */
+ default List getAll() {
+ return getRepository().selectList(null);
+ }
+
+ /**
+ * 获取总数
+ *
+ * @return
+ */
+ default Integer getTotalCount() {
+ return getRepository().selectCount(null);
+ }
+
+ /**
+ * 添加
+ *
+ * @param entity
+ * @return
+ */
+ default E insert(E entity) {
+ getRepository().insert(entity);
+ return entity;
+ }
+
+ /**
+ * 修改
+ *
+ * @param entity
+ * @return
+ */
+ default E update(E entity) {
+ getRepository().updateById(entity);
+ return entity;
+ }
+
+ /**
+ * 保存或者更新
+ * @param entity
+ * @return
+ */
+ default E insertOrUpdate(E entity) {
+ try {
+ Object id = entity.getClass().getMethod("getId").invoke(entity);
+ if (id != null) {
+ update(entity);
+ } else {
+ insert(entity);
+ }
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ return entity;
+ }
+
+ /**
+ * 批量保存与修改
+ *
+ * @param list
+ * @return
+ */
+ default List batchInsert(List list) {
+ for (E e : list) {
+ getRepository().insert(e);
+ }
+ return list;
+ }
+
+
+ /**
+ * 根据Id删除
+ *
+ * @param id
+ */
+ default void delete(ID id) {
+ getRepository().deleteById(id);
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ */
+ default void batchDelete(List ids) {
+ getRepository().deleteBatchIds(ids);
+ }
+
+
+ /**
+ * 根据id批量查询
+ * @param ids
+ * @return
+ */
+ default List findByBatchIds(List ids) {
+ return getRepository().selectBatchIds(ids);
+ }
+
+ /**
+ * 获取所有
+ *
+ * @return
+ */
+ default List findAll() {
+ return getRepository().selectList(null);
+ }
+
+ /**
+ * 根据条件查询获取
+ *
+ * @param queryWrapper
+ * @return
+ */
+ default List findAll(QueryWrapper queryWrapper) {
+ return getRepository().selectList(queryWrapper);
+ }
+
+ /**
+ * 根据查询条件不分页获取
+ *
+ * @param condition
+ * @return
+ */
+ default List findAll(QueryCondition condition) {
+ E e = condition.getData();
+
+ //对指定字段查询
+ QueryWrapper queryWrapper = getQueryWrapper(e);
+
+ return getRepository().selectList(queryWrapper);
+ }
+
+ /**
+ * 分页获取
+ *
+ * @param page
+ * @return
+ */
+ default Page findAll(Page page) {
+ return (Page) getRepository().selectPage(page, null);
+ }
+
+ /**
+ * 获得查询器
+ *
+ * @param e
+ * @return
+ */
+ QueryWrapper getQueryWrapper(E e);
+
+ /**
+ * 根据查询条件分页获取
+ *
+ * @param page
+ * @param condition
+ * @return
+ */
+ default Page findAll(Page page, QueryCondition condition) {
+ E e = condition.getData();
+ SearchVo searchVo = condition.getSearchVo();
+
+ //对指定字段查询
+ QueryWrapper queryWrapper = getQueryWrapper(e);
+
+ //查询日期范围
+ if (searchVo != null) {
+ String startDate = searchVo.getStartDate();
+ String endDate = searchVo.getEndDate();
+ if (StrUtil.isNotBlank(startDate) && StrUtil.isNotBlank(endDate)) {
+ Date start = DateUtil.parse(startDate);
+ Date end = DateUtil.parse(endDate);
+ queryWrapper.between("create_time", start, end);
+ }
+ }
+ return (Page) getRepository().selectPage(page, queryWrapper);
+ }
+
+ /**
+ * 获取查询条件的结果数
+ *
+ * @param queryWrapper
+ * @return
+ */
+ default long count(QueryWrapper queryWrapper) {
+ return getRepository().selectCount(queryWrapper);
+ }
+
+}
+
diff --git a/src/main/java/com/example/hotel/common/constant/CommonConstant.java b/src/main/java/com/example/hotel/common/constant/CommonConstant.java
new file mode 100755
index 0000000..eec777d
--- /dev/null
+++ b/src/main/java/com/example/hotel/common/constant/CommonConstant.java
@@ -0,0 +1,23 @@
+package com.example.hotel.common.constant;
+
+/**
+ * 常量
+ * @author 言曌
+ */
+public interface CommonConstant {
+
+ /**
+ * 正常状态
+ */
+ Integer STATUS_NORMAL = 0;
+
+ /**
+ * 用户密码加盐的盐
+ */
+ String PASSWORD_SALT = "sens";
+
+ /**
+ * none
+ */
+ String NONE = "none";
+}
diff --git a/src/main/java/com/example/hotel/config/MvcConfig.java b/src/main/java/com/example/hotel/config/MvcConfig.java
new file mode 100755
index 0000000..efe9f8c
--- /dev/null
+++ b/src/main/java/com/example/hotel/config/MvcConfig.java
@@ -0,0 +1,58 @@
+package com.example.hotel.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.web.servlet.LocaleResolver;
+import org.springframework.web.servlet.config.annotation.*;
+import org.springframework.web.servlet.i18n.SessionLocaleResolver;
+
+import java.util.Locale;
+
+/**
+ * 拦截器,资源路径配置
+ */
+@Slf4j
+@Configuration
+@EnableWebMvc
+@ComponentScan(basePackages = "com.example.hotel.controller")
+@PropertySource(value = "classpath:application.yaml", ignoreResourceNotFound = true, encoding = "UTF-8")
+public class MvcConfig implements WebMvcConfigurer {
+
+
+ /**
+ * 配置静态资源路径
+ *
+ * @param registry registry
+ */
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/static/**")
+ .addResourceLocations("classpath:/static/");
+ registry.addResourceHandler("/**")
+ .addResourceLocations("classpath:/templates/themes/")
+ .addResourceLocations("classpath:/robots.txt");
+ registry.addResourceHandler("/upload/**")
+ .addResourceLocations("file:///" + System.getProperties().getProperty("user.home") + "/sens/upload/");
+ registry.addResourceHandler("/favicon.ico")
+ .addResourceLocations("classpath:/static/images/favicon.ico");
+ }
+
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowCredentials(true)
+ .allowedHeaders("*")
+ .allowedOrigins("*")
+ .allowedMethods("*");
+ }
+
+ @Bean
+ public LocaleResolver localeResolver() {
+ SessionLocaleResolver slr = new SessionLocaleResolver();
+ slr.setDefaultLocale(Locale.CHINA);
+ return slr;
+ }
+}
diff --git a/src/main/java/com/example/hotel/config/mybatisplus/MybatisPlusConfig.java b/src/main/java/com/example/hotel/config/mybatisplus/MybatisPlusConfig.java
new file mode 100644
index 0000000..11ecfd6
--- /dev/null
+++ b/src/main/java/com/example/hotel/config/mybatisplus/MybatisPlusConfig.java
@@ -0,0 +1,41 @@
+package com.example.hotel.config.mybatisplus;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+/**
+ * @author 言曌
+ * @date 2018/12/22 下午1:49
+ */
+
+@Configuration
+public class MybatisPlusConfig {
+
+ /***
+ * plus 的性能优化
+ * @return
+ */
+ @Bean
+ public PerformanceInterceptor performanceInterceptor() {
+ PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
+ /**/
+ performanceInterceptor.setMaxTime(1000);
+ /**/
+ performanceInterceptor.setFormat(true);
+ return performanceInterceptor;
+ }
+
+ /**
+ * mybatis-plus分页插件
+ */
+ @Bean
+ public PaginationInterceptor paginationInterceptor() {
+ return new PaginationInterceptor();
+ }
+
+
+
+}
diff --git a/src/main/java/com/example/hotel/config/properties/IgnoredUrlsProperties.java b/src/main/java/com/example/hotel/config/properties/IgnoredUrlsProperties.java
new file mode 100755
index 0000000..5d06a4f
--- /dev/null
+++ b/src/main/java/com/example/hotel/config/properties/IgnoredUrlsProperties.java
@@ -0,0 +1,19 @@
+package com.example.hotel.config.properties;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author example
+ */
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "ignored")
+public class IgnoredUrlsProperties {
+
+ private List urls = new ArrayList<>();
+}
diff --git a/src/main/java/com/example/hotel/config/shiro/MyRealm.java b/src/main/java/com/example/hotel/config/shiro/MyRealm.java
new file mode 100644
index 0000000..4c5ccc0
--- /dev/null
+++ b/src/main/java/com/example/hotel/config/shiro/MyRealm.java
@@ -0,0 +1,108 @@
+package com.example.hotel.config.shiro;
+
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Validator;
+import com.example.hotel.common.constant.CommonConstant;
+import com.example.hotel.entity.Permission;
+import com.example.hotel.entity.Role;
+import com.example.hotel.service.PermissionService;
+import com.example.hotel.service.RoleService;
+import com.example.hotel.service.UserService;
+import com.example.hotel.entity.User;
+import com.example.hotel.enums.CommonParamsEnum;
+import com.example.hotel.enums.TrueFalseEnum;
+import com.example.hotel.enums.UserStatusEnum;
+import com.example.hotel.util.RegexUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authc.*;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.util.ByteSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+@Slf4j
+public class MyRealm extends AuthorizingRealm {
+
+ @Autowired
+ @Lazy
+ private UserService userService;
+
+ @Autowired
+ @Lazy
+ private RoleService roleService;
+
+ @Autowired
+ @Lazy
+ private PermissionService permissionService;
+
+
+ /**
+ * 认证信息(身份验证) Authentication 是用来验证用户身份
+ */
+ @Override
+ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
+ log.info("认证-->MyShiroRealm.doGetAuthenticationInfo()");
+ //1.验证手机号
+ User user;
+ String account = (String) token.getPrincipal();
+ if (RegexUtil.isIdCard(account)) {
+ user = userService.findByIdCard(account);
+ } else {
+ user = userService.findByUserName(account);
+ }
+ if (user == null) {
+ //用户不存在
+ log.info("用户不存在! 登录名:{}, 密码:{}", account, token.getCredentials());
+ return null;
+ }
+ Role role = roleService.findByUserId(user.getId());
+ if (role != null) {
+ user.setRole(role.getRole());
+ }
+
+
+ //2.判断账号是否被封号
+ if (!Objects.equals(user.getStatus(), UserStatusEnum.NORMAL.getCode())) {
+ throw new LockedAccountException("账号被封禁");
+ }
+
+ //3.封装authenticationInfo,准备验证密码
+ SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
+ user, // 手机号
+ user.getUserPass(), // 密码
+ ByteSource.Util.bytes(CommonConstant.PASSWORD_SALT), // 盐
+ getName() // realm name
+ );
+ System.out.println("realName:" + getName());
+ return authenticationInfo;
+ }
+
+
+ @Override
+ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+
+ SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
+ User user = (User) principals.getPrimaryPrincipal();
+
+ Role role = roleService.findByRoleId(user.getId());
+
+ authorizationInfo.addRole(role.getRole());
+ List permissions = permissionService.listPermissionsByRoleId(role.getId());
+ //把权限的URL全部放到authorizationInfo中去
+ Set urls = permissions.stream().map(p -> p.getUrl()).collect(Collectors.toSet());
+ authorizationInfo.addStringPermissions(urls);
+
+ return authorizationInfo;
+ }
+}
diff --git a/src/main/java/com/example/hotel/config/shiro/ShiroConfig.java b/src/main/java/com/example/hotel/config/shiro/ShiroConfig.java
new file mode 100644
index 0000000..9716ccf
--- /dev/null
+++ b/src/main/java/com/example/hotel/config/shiro/ShiroConfig.java
@@ -0,0 +1,111 @@
+package com.example.hotel.config.shiro;
+
+import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
+import com.example.hotel.config.properties.IgnoredUrlsProperties;
+import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
+import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
+import org.apache.shiro.mgt.SecurityManager;
+import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.Filter;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@Configuration
+public class ShiroConfig {
+
+ @Bean
+ public ShiroDialect shiroDialect() {
+ return new ShiroDialect();
+ }
+
+ @Bean
+ IgnoredUrlsProperties getIgnoredUrlsProperties() {
+ return new IgnoredUrlsProperties();
+ }
+
+ @Bean
+ public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
+ ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
+ shiroFilterFactoryBean.setSecurityManager(securityManager);
+ //自定义拦截器
+ Map filtersMap = new LinkedHashMap();
+ //访问权限配置
+ filtersMap.put("requestURL", getURLPathMatchingFilter());
+ shiroFilterFactoryBean.setFilters(filtersMap);
+
+ //拦截器.
+ Map filterChainDefinitionMap = new LinkedHashMap();
+ // 配置不会被拦截的链接 顺序判断
+ List urls = getIgnoredUrlsProperties().getUrls();
+ for (String url : urls) {
+ filterChainDefinitionMap.put(url, "anon");
+ }
+ filterChainDefinitionMap.put("/admin", "authc");
+ filterChainDefinitionMap.put("/admin/**", "requestURL");
+ filterChainDefinitionMap.put("/**", "anon");
+
+ shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
+
+
+ // 如果不设置默认会自动寻找Web工程根目录下的"/login"页面
+ shiroFilterFactoryBean.setLoginUrl("/");
+ // 登录成功后要跳转的链接
+ shiroFilterFactoryBean.setSuccessUrl("/");
+ //未授权界面;
+ shiroFilterFactoryBean.setUnauthorizedUrl("/403");
+
+ return shiroFilterFactoryBean;
+
+ }
+
+ @Bean
+ public SecurityManager securityManager() {
+ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
+ securityManager.setRealm(myRealm());
+ return securityManager;
+ }
+
+
+ @Bean
+ public MyRealm myRealm() {
+ MyRealm normalRealm = new MyRealm();
+ normalRealm.setCredentialsMatcher(hashedCredentialsMatcher());
+ return normalRealm;
+ }
+
+ /**
+ * 访问 权限 拦截器
+ *
+ * @return
+ */
+ public URLPathMatchingFilter getURLPathMatchingFilter() {
+ return new URLPathMatchingFilter();
+ }
+
+ /**
+ * MD5加盐加密十次
+ *
+ * @return
+ */
+ @Bean
+ public HashedCredentialsMatcher hashedCredentialsMatcher() {
+ HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
+ //散列算法:这里使用MD5算法;
+ hashedCredentialsMatcher.setHashAlgorithmName("md5");
+ //散列的次数,md5("")
+ hashedCredentialsMatcher.setHashIterations(10);
+ return hashedCredentialsMatcher;
+ }
+
+ @Bean
+ public AllowAllCredentialsMatcher allowAllCredentialsMatcher() {
+ return new AllowAllCredentialsMatcher();
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/config/shiro/URLPathMatchingFilter.java b/src/main/java/com/example/hotel/config/shiro/URLPathMatchingFilter.java
new file mode 100644
index 0000000..f9d6930
--- /dev/null
+++ b/src/main/java/com/example/hotel/config/shiro/URLPathMatchingFilter.java
@@ -0,0 +1,74 @@
+package com.example.hotel.config.shiro;
+
+import com.alibaba.fastjson.JSONObject;
+import com.example.hotel.service.PermissionService;
+import com.example.hotel.util.SpringUtil;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.PathMatchingFilter;
+import org.apache.shiro.web.util.WebUtils;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * URL拦截器
+ */
+public class URLPathMatchingFilter extends PathMatchingFilter {
+
+
+ PermissionService permissionService = null;
+ private PermissionService permissionService() {
+ if (permissionService == null) {
+ permissionService = (PermissionService) SpringUtil.getBean("permissionServiceImpl");
+ }
+ return permissionService;
+ }
+
+ @Override
+ protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
+ //请求的url
+ String requestURL = getPathWithinApplication(request);
+ System.out.println("请求的url :" + requestURL);
+ Subject subject = SecurityUtils.getSubject();
+ if (!subject.isAuthenticated()) {
+ // 如果没有登录, 进入登录流程
+ WebUtils.issueRedirect(request, response, "/");
+ return false;
+ }
+
+ //从session里读取当前用户的权限URL列表
+ Set urls = (Set) subject.getSession().getAttribute("permissionUrls");
+ if (urls.contains(requestURL)) {
+ return true;
+ }
+
+ //没有权限
+ if (isAjax((HttpServletRequest) request)) {
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("application/json; charset=utf-8");
+ PrintWriter writer = response.getWriter();
+ Map map = new HashMap<>();
+ map.put("code", 0);
+ map.put("msg", "没有权限访问");
+ writer.write(JSONObject.toJSONString(map));
+ } else {
+ WebUtils.issueRedirect(request, response, "/403");
+ }
+
+ return false;
+ }
+
+
+ public static boolean isAjax(HttpServletRequest httpRequest) {
+ return (httpRequest.getHeader("X-Requested-With") != null
+ && "XMLHttpRequest"
+ .equals(httpRequest.getHeader("X-Requested-With").toString()));
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/controller/admin/AdminController.java b/src/main/java/com/example/hotel/controller/admin/AdminController.java
new file mode 100644
index 0000000..4c0621d
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/AdminController.java
@@ -0,0 +1,86 @@
+package com.example.hotel.controller.admin;
+
+import com.example.hotel.entity.Permission;
+import com.example.hotel.entity.Role;
+import com.example.hotel.entity.User;
+import com.example.hotel.service.PermissionService;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.service.RoleService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ *
+ * 后台首页控制器
+ *
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin")
+public class AdminController extends BaseController {
+
+ @Autowired
+ private PermissionService permissionService;
+
+ @Autowired
+ private RoleService roleService;
+
+ /**
+ * 请求后台页面
+ *
+ * @param model model
+ * @return 模板路径admin/admin_index
+ */
+ @GetMapping
+ public String index(Model model) {
+// return "admin/admin_index";
+ return "redirect:/admin/order";
+ }
+
+
+ /**
+ * 获得当前用户的菜单
+ *
+ * @return
+ */
+ @GetMapping(value = "/currentMenus")
+ @ResponseBody
+ public JsonResult getMenu() {
+ Long userId = getLoginUserId();
+ List permissions = permissionService.findPermissionTreeByUserIdAndResourceType(userId, "menu");
+ return JsonResult.success("", permissions);
+ }
+
+ /**
+ * 获得当前登录用户
+ */
+ @GetMapping(value = "/currentUser")
+ @ResponseBody
+ public JsonResult currentUser() {
+ User user = getLoginUser();
+ if (user != null) {
+ return JsonResult.success("", user);
+ }
+ return JsonResult.error("用户未登录");
+ }
+
+ /**
+ * 获得当前用户角色编码
+ */
+ @GetMapping(value = "/currentRole")
+ @ResponseBody
+ public JsonResult currentRole() {
+ Role role = roleService.findByUserId(getLoginUserId());
+ if (role == null) {
+ return JsonResult.error("用户未登录或无角色");
+ }
+ return JsonResult.success("", role.getRole());
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/AttachmentController.java b/src/main/java/com/example/hotel/controller/admin/AttachmentController.java
new file mode 100755
index 0000000..b3230fb
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/AttachmentController.java
@@ -0,0 +1,44 @@
+package com.example.hotel.controller.admin;
+
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.util.FileUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ *
+ * 后台附件控制器
+ *
+ *
+ * @author : saysky
+ * @date : 2017/12/19
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/file")
+public class AttachmentController extends BaseController {
+
+
+ /**
+ * 上传文件
+ *
+ * @param file file
+ * @return Map
+ */
+ @PostMapping(value = "/upload", produces = {"application/json;charset=UTF-8"})
+ @ResponseBody
+ public Map uploadFile(@RequestParam("file") MultipartFile file) {
+ Map map = new HashMap<>(1);
+ String path = FileUtil.upload(file);
+ map.put("link", path);
+ return map;
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/CategoryController.java b/src/main/java/com/example/hotel/controller/admin/CategoryController.java
new file mode 100755
index 0000000..4a767e2
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/CategoryController.java
@@ -0,0 +1,108 @@
+package com.example.hotel.controller.admin;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.entity.Category;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.service.CategoryService;
+import com.example.hotel.util.PageUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 后台分类管理控制器
+ *
+ *
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/category")
+public class CategoryController extends BaseController {
+
+ @Autowired
+ private CategoryService categoryService;
+
+
+ /**
+ * 查询所有分类并渲染category页面
+ *
+ * @return 模板路径admin/admin_category
+ */
+ @GetMapping
+ public String categories(@RequestParam(value = "page", defaultValue = "0") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "cateSort") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order, Model model) {
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ Page categoryPage = categoryService.findAll(page);
+ model.addAttribute("categories", categoryPage.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+ return "admin/admin_category";
+ }
+
+ /**
+ * 新增/修改分类目录
+ *
+ * @param category category对象
+ * @return 重定向到/admin/category
+ */
+ @PostMapping(value = "/save")
+ @ResponseBody
+ public JsonResult saveCategory(@ModelAttribute Category category) {
+ categoryService.insertOrUpdate(category);
+ return JsonResult.success("保存成功");
+ }
+
+ /**
+ * 删除分类
+ *
+ * @param cateId 分类Id
+ * @return JsonResult
+ */
+ @DeleteMapping(value = "/delete")
+ @ResponseBody
+ public JsonResult checkDelete(@RequestParam("id") Long cateId) {
+ //1.判断这个分类有客房
+ Integer count = categoryService.countPostByCateId(cateId);
+ if (count != 0) {
+ return JsonResult.error("该分类已经有了客房,无法删除");
+ }
+ categoryService.delete(cateId);
+ return JsonResult.success("删除成功");
+ }
+
+
+ /**
+ * 跳转到修改页面
+ *
+ * @param cateId cateId
+ * @param model model
+ * @return 模板路径admin/admin_category
+ */
+ @GetMapping(value = "/edit")
+ public String toEditCategory(Model model,
+ @RequestParam(value = "page", defaultValue = "0") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "cateSort") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order,
+ @RequestParam("id") Long cateId) {
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+
+ //更新的分类
+ Category category = categoryService.get(cateId);
+ if (category == null) {
+ return this.renderNotFound();
+ }
+ model.addAttribute("updateCategory", category);
+
+ // 所有分类
+ Page categoryPage = categoryService.findAll(page);
+ model.addAttribute("categories", categoryPage.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+ return "admin/admin_category";
+ }
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/OrderController.java b/src/main/java/com/example/hotel/controller/admin/OrderController.java
new file mode 100755
index 0000000..05ad0ff
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/OrderController.java
@@ -0,0 +1,170 @@
+package com.example.hotel.controller.admin;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.dto.QueryCondition;
+import com.example.hotel.entity.Order;
+import com.example.hotel.enums.OrderStatusEnum;
+import com.example.hotel.service.OrderService;
+import com.example.hotel.service.RecordService;
+import com.example.hotel.util.DateUtil;
+import com.example.hotel.util.PageUtil;
+import com.example.hotel.util.RegexUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.weaver.ast.Or;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *
+ * 订单管理控制器
+ *
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/order")
+public class OrderController extends BaseController {
+
+ @Autowired
+ private OrderService orderService;
+
+ @Autowired
+ private RecordService recordService;
+
+ /**
+ * 查询所有订单并渲染order页面
+ *
+ * @return 模板路径admin/admin_order
+ */
+ @GetMapping
+ public String orders(@RequestParam(value = "page", defaultValue = "0") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "id") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order, Model model) {
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ Page orderPage = null;
+ Boolean isCustomer = loginUserIsCustomer();
+ if (isCustomer) {
+ Order orderCondition = new Order();
+ orderCondition.setUserId(getLoginUserId());
+ QueryCondition queryCondition = new QueryCondition();
+ queryCondition.setData(orderCondition);
+ orderPage = orderService.findAll(page, queryCondition);
+ } else {
+ orderPage = orderService.findAll(page);
+ }
+ model.addAttribute("orders", orderPage.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+ return "admin/admin_order";
+ }
+
+
+ /**
+ * 删除订单
+ *
+ * @param id 订单Id
+ * @return JsonResult
+ */
+ @DeleteMapping(value = "/delete")
+ @ResponseBody
+ public JsonResult delete(@RequestParam("id") Long id) {
+ Order order = orderService.get(id);
+ if (order == null) {
+ return JsonResult.error("订单不存在");
+ }
+
+ orderService.delete(id);
+
+
+ Long postId = order.getPostId();
+ Long userId = order.getUserId();
+ List dateList = DateUtil.getBetweenDates(order.getStartDate(), order.getQuantity());
+
+ // 释放预定
+ recordService.delete(postId, userId, dateList);
+ return JsonResult.success("删除成功");
+ }
+
+ /**
+ * 完结订单
+ *
+ * @param id 订单Id
+ * @return JsonResult
+ */
+ @PostMapping(value = "/finish")
+ @ResponseBody
+ public JsonResult finish(@RequestParam("id") Long id) {
+ Order order = orderService.get(id);
+ if (order == null) {
+ return JsonResult.error("订单不存在");
+ }
+
+ order.setStatus(OrderStatusEnum.FINISHED.getCode());
+ orderService.update(order);
+ return JsonResult.success("完结成功");
+ }
+
+ /**
+ * 关闭订单
+ *
+ * @param id 订单Id
+ * @return JsonResult
+ */
+ @PostMapping(value = "/close")
+ @ResponseBody
+ @Transactional
+ public JsonResult close(@RequestParam("id") Long id) {
+ // 修改订单状态
+ Order order = orderService.get(id);
+ if (order == null) {
+ return JsonResult.error("订单不存在");
+ }
+
+ order.setStatus(OrderStatusEnum.CLOSED.getCode());
+ orderService.update(order);
+
+ Long postId = order.getPostId();
+ Long userId = order.getUserId();
+ List dateList = DateUtil.getBetweenDates(order.getStartDate(), order.getQuantity());
+
+ // 释放预定
+ recordService.delete(postId, userId, dateList);
+ return JsonResult.success("关闭成功");
+ }
+
+ /**
+ * 财务页面
+ *
+ * @param model
+ * @return
+ */
+ @GetMapping("/finance")
+ public String finance(@RequestParam(value = "startDate", required = false) String startDate,
+ @RequestParam(value = "endDate", required = false) String endDate,
+ @RequestParam(value = "page", defaultValue = "0") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "id") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order,
+ Model model) {
+
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ Page orderPage = orderService.findAll(startDate, endDate, page);
+ model.addAttribute("orders", orderPage.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+
+ model.addAttribute("startDate", startDate);
+ model.addAttribute("endDate", endDate);
+
+ Integer totalPrice = orderService.getTotalPriceSum(startDate, endDate);
+ model.addAttribute("totalPrice", totalPrice == null ? 0 : totalPrice);
+ return "admin/admin_finance";
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/PermissionController.java b/src/main/java/com/example/hotel/controller/admin/PermissionController.java
new file mode 100644
index 0000000..95a8521
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/PermissionController.java
@@ -0,0 +1,141 @@
+package com.example.hotel.controller.admin;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.entity.Permission;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.enums.ResourceTypeEnum;
+import com.example.hotel.service.PermissionService;
+import com.example.hotel.util.PageUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 后台权限管理控制器
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/permission")
+public class PermissionController {
+
+
+ @Autowired
+ private PermissionService permissionService;
+
+ /**
+ * 查询所有权限并渲染permission页面
+ *
+ * @return 模板路径admin/admin_permission
+ */
+ @GetMapping
+ public String permissions(@RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "id") String sort,
+ @RequestParam(value = "order", defaultValue = "asc") String order, Model model) {
+ //权限列表
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+
+ Page permissions = permissionService.findAll(page);
+ model.addAttribute("permissionList", permissions.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+
+ // 所有权限
+ model.addAttribute("permissions", getPermissionList());
+ return "admin/admin_permission";
+ }
+
+ /**
+ * 新增/修改权限
+ *
+ * @param permission permission对象
+ * @return 重定向到/admin/permission
+ */
+ @PostMapping(value = "/save")
+ public String savePermission(@ModelAttribute Permission permission) {
+ permissionService.insertOrUpdate(permission);
+ return "redirect:/admin/permission";
+ }
+
+ /**
+ * 删除权限
+ *
+ * @param permissionId 权限Id
+ * @return JsonResult
+ */
+ @DeleteMapping(value = "/delete")
+ @ResponseBody
+ public JsonResult checkDelete(@RequestParam("id") Long permissionId) {
+// // 请先删除子权限
+ Integer childCount = permissionService.countChildPermission(permissionId);
+ if (childCount > 0) {
+ return JsonResult.error("请先删除子节点");
+ }
+ permissionService.delete(permissionId);
+ return JsonResult.success();
+ }
+
+ /**
+ * 跳转到新增页面
+ *
+ * @param model model
+ * @return 模板路径admin/admin_permission
+ */
+ @GetMapping(value = "/new")
+ public String toAddPermission(Model model) {
+ // 带有等级的权限列表
+ model.addAttribute("permissionList", permissionService.findPermissionListWithLevel());
+ // 权限列表
+ model.addAttribute("permissions", getPermissionList());
+ return "admin/admin_permission_new";
+ }
+
+ /**
+ * 跳转到修改页面
+ *
+ * @param permissionId permissionId
+ * @param model model
+ * @return 模板路径admin/admin_permission
+ */
+ @GetMapping(value = "/edit")
+ public String toEditPermission(Model model, @RequestParam("id") Long permissionId) {
+ //更新的权限
+ Permission permission = permissionService.get(permissionId);
+ model.addAttribute("updatePermission", permission);
+
+ // 带有等级的权限列表
+ model.addAttribute("permissionList", permissionService.findPermissionListWithLevel());
+ // 权限列表
+ model.addAttribute("permissions", getPermissionList());
+ // 设置URL为编辑的URL
+ return "admin/admin_permission_edit";
+ }
+
+
+ /**
+ * 所有权限
+ * @return
+ */
+ public List getPermissionList() {
+ //权限列表
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.orderByAsc("sort");
+ List permissions = permissionService.findAll(queryWrapper);
+ // 设置URL为编辑的URL
+ for (Permission permission : permissions) {
+ permission.setUrl("/admin/permission/edit?id=" + permission.getId());
+ if (ResourceTypeEnum.MENU.getCode().equals(permission.getResourceType())) {
+ permission.setName(permission.getName() + "[" + ResourceTypeEnum.MENU.getDescription() + "]");
+ } else if (ResourceTypeEnum.BUTTON.getCode().equals(permission.getResourceType())) {
+ permission.setName(permission.getName() + "[" + ResourceTypeEnum.BUTTON.getDescription() + "]");
+ } else if (ResourceTypeEnum.PAGE.getCode().equals(permission.getResourceType())) {
+ permission.setName(permission.getName() + "[" + ResourceTypeEnum.PAGE.getDescription() + "]");
+ }
+ }
+ return permissions;
+ }
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/PostController.java b/src/main/java/com/example/hotel/controller/admin/PostController.java
new file mode 100755
index 0000000..5b6079a
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/PostController.java
@@ -0,0 +1,263 @@
+package com.example.hotel.controller.admin;
+
+import cn.hutool.http.HtmlUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.dto.QueryCondition;
+import com.example.hotel.exception.MyBusinessException;
+import com.example.hotel.entity.*;
+import com.example.hotel.enums.*;
+import com.example.hotel.service.*;
+import com.example.hotel.util.PageUtil;
+import com.example.hotel.util.RegexUtil;
+import com.example.hotel.util.SensUtils;
+import com.example.hotel.vo.SearchVo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ *
+ * 后台客房管理控制器
+ *
+ *
+ * @author : saysky
+ * @date : 2017/12/10
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/post")
+public class PostController extends BaseController {
+
+ @Autowired
+ private PostService postService;
+
+ @Autowired
+ private CategoryService categoryService;
+
+ public static final String TITLE = "title";
+
+ public static final String CONTENT = "content";
+
+
+ /**
+ * 处理后台获取客房列表的请求
+ *
+ * @param model model
+ * @return 模板路径admin/admin_post
+ */
+ @GetMapping
+ public String posts(Model model,
+ @RequestParam(value = "status", defaultValue = "0") Integer status,
+ @RequestParam(value = "keywords", defaultValue = "") String keywords,
+ @RequestParam(value = "searchType", defaultValue = "") String searchType,
+ @RequestParam(value = "postSource", defaultValue = "-1") Integer postSource,
+ @RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "createTime") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order,
+ @ModelAttribute SearchVo searchVo) {
+
+ Post condition = new Post();
+ if (!StringUtils.isBlank(keywords)) {
+ if (TITLE.equals(searchType)) {
+ condition.setPostTitle(keywords);
+ } else {
+ condition.setPostContent(keywords);
+ }
+ }
+ condition.setPostStatus(status);
+
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ Page posts = postService.findAll(
+ page,
+ new QueryCondition<>(condition, searchVo));
+
+ List postList = posts.getRecords();
+ for(Post post : postList) {
+ post.setCategory(categoryService.get(post.getCateId()));
+ }
+ //封装分类和标签
+ model.addAttribute("posts", postList);
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+ model.addAttribute("status", status);
+ model.addAttribute("keywords", keywords);
+ model.addAttribute("searchType", searchType);
+ model.addAttribute("postSource", postSource);
+ model.addAttribute("order", order);
+ model.addAttribute("sort", sort);
+ return "admin/admin_post";
+ }
+
+
+ /**
+ * 处理跳转到新建客房页面
+ *
+ * @return 模板路径admin/admin_editor
+ */
+ @GetMapping(value = "/new")
+ public String newPost(Model model) {
+ //所有分类
+ List allCategories = categoryService.findAll();
+ model.addAttribute("categories", allCategories);
+ return "admin/admin_post_new";
+ }
+
+
+
+ /**
+ * 添加/更新客房
+ *
+ * @param post Post实体
+ */
+ @PostMapping(value = "/save")
+ @ResponseBody
+ public JsonResult pushPost(@ModelAttribute Post post) {
+ // 1、提取摘要
+ int postSummary = 100;
+ //客房摘要
+ String summaryText = HtmlUtil.cleanHtmlTag(post.getPostContent());
+ if (summaryText.length() > postSummary) {
+ String summary = summaryText.substring(0, postSummary);
+ post.setPostSummary(summary);
+ } else {
+ post.setPostSummary(summaryText);
+ }
+
+ // 2.处理imgUrl
+ String postEditor = post.getPostEditor();
+ if(StringUtils.isNotEmpty(postEditor)) {
+ List urlList = RegexUtil.getImgSrc(postEditor);
+ String imgUrl = SensUtils.listToStr(urlList);
+ post.setImgUrl(imgUrl);
+ }
+
+ // 2.添加/更新入库
+ postService.insertOrUpdate(post);
+ return JsonResult.success("发布成功");
+ }
+
+
+ /**
+ * 处理移至回收站的请求
+ *
+ * @param postId 客房编号
+ * @return 重定向到/admin/post
+ */
+ @PostMapping(value = "/throw")
+ @ResponseBody
+ public JsonResult moveToTrash(@RequestParam("id") Long postId) {
+ Post post = postService.get(postId);
+ if (post == null) {
+ throw new MyBusinessException("客房不存在");
+ }
+ post.setPostStatus(PostStatusEnum.RECYCLE.getCode());
+ postService.update(post);
+ return JsonResult.success("操作成功");
+
+ }
+
+ /**
+ * 处理客房为发布的状态
+ *
+ * @param postId 客房编号
+ * @return 重定向到/admin/post
+ */
+ @PostMapping(value = "/revert")
+ @ResponseBody
+ public JsonResult moveToPublish(@RequestParam("id") Long postId) {
+ Post post = postService.get(postId);
+ if (post == null) {
+ throw new MyBusinessException("客房不存在");
+ }
+ post.setPostStatus(PostStatusEnum.PUBLISHED.getCode());
+ postService.update(post);
+ return JsonResult.success("操作成功");
+ }
+
+
+
+ /**
+ * 处理删除客房的请求
+ *
+ * @param postId 客房编号
+ * @return 重定向到/admin/post
+ */
+ @DeleteMapping(value = "/delete")
+ @ResponseBody
+ public JsonResult removePost(@RequestParam("id") Long postId) {
+ Post post = postService.get(postId);
+ if (post == null) {
+ throw new MyBusinessException("客房不存在");
+ }
+ postService.delete(postId);
+ return JsonResult.success("删除成功");
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param ids 客房ID列表
+ * @return 重定向到/admin/post
+ */
+ @DeleteMapping(value = "/batchDelete")
+ @ResponseBody
+ public JsonResult batchDelete(@RequestParam("ids") List ids) {
+ //批量操作
+ //1、防止恶意操作
+ if (ids == null || ids.size() == 0 || ids.size() >= 100) {
+ return new JsonResult(ResultCodeEnum.FAIL.getCode(), "参数不合法!");
+ }
+ //2、检查用户权限
+ //客房作者才可以删除
+ List postList = postService.findByBatchIds(ids);
+ //3、如果当前状态为回收站,则删除;否则,移到回收站
+ for (Post post : postList) {
+ if (Objects.equals(post.getPostStatus(), PostStatusEnum.RECYCLE.getCode())) {
+ postService.delete(post.getId());
+ } else {
+ post.setPostStatus(PostStatusEnum.RECYCLE.getCode());
+ postService.update(post);
+ }
+ }
+ return JsonResult.success("删除成功");
+ }
+
+
+ /**
+ * 跳转到编辑客房页面
+ *
+ * @param postId 客房编号
+ * @param model model
+ * @return 模板路径admin/admin_editor
+ */
+ @GetMapping(value = "/edit")
+ public String editPost(@RequestParam("id") Long postId, Model model) {
+ Post post = postService.get(postId);
+ if (post == null) {
+ throw new MyBusinessException("客房不存在");
+ }
+
+ //当前客房分类
+ Category category = categoryService.get(post.getCateId());
+ post.setCategory(category);
+ model.addAttribute("post", post);
+
+
+ //所有分类
+ List allCategories = categoryService.findAll();
+ model.addAttribute("categories", allCategories);
+ return "admin/admin_post_edit";
+ }
+
+
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/ProfileController.java b/src/main/java/com/example/hotel/controller/admin/ProfileController.java
new file mode 100644
index 0000000..3b6e3c4
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/ProfileController.java
@@ -0,0 +1,95 @@
+package com.example.hotel.controller.admin;
+
+import com.example.hotel.common.constant.CommonConstant;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.entity.User;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.service.UserService;
+import com.example.hotel.util.Md5Util;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Objects;
+
+/**
+ * 后台用户管理控制器
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/user")
+public class ProfileController extends BaseController {
+
+ @Autowired
+ private UserService userService;
+
+ /**
+ * 获取用户信息并跳转
+ *
+ * @return 模板路径admin/admin_profile
+ */
+ @GetMapping("/profile")
+ public String profile(Model model) {
+ //1.用户信息
+ User user = getLoginUser();
+ model.addAttribute("user", user);
+ return "admin/admin_profile";
+ }
+
+
+ /**
+ * 处理修改用户资料的请求
+ *
+ * @param user user
+ * @return JsonResult
+ */
+ @PostMapping(value = "/profile/save")
+ @ResponseBody
+ public JsonResult saveProfile(@ModelAttribute User user) {
+ User loginUser = getLoginUser();
+
+ User saveUser = userService.get(loginUser.getId());
+ saveUser.setUserPass(null);
+ saveUser.setId(loginUser.getId());
+ saveUser.setUserName(user.getUserName());
+ saveUser.setUserDisplayName(user.getUserDisplayName());
+ saveUser.setUserAvatar(user.getUserAvatar());
+ saveUser.setUserDesc(user.getUserDesc());
+ saveUser.setIdCard(user.getIdCard());
+ userService.insertOrUpdate(saveUser);
+ return JsonResult.success("资料修改成功,请重新登录");
+ }
+
+
+ /**
+ * 处理修改密码的请求
+ *
+ * @param beforePass 旧密码
+ * @param newPass 新密码
+ * @return JsonResult
+ */
+ @PostMapping(value = "/changePass")
+ @ResponseBody
+ public JsonResult changePass(@ModelAttribute("beforePass") String beforePass,
+ @ModelAttribute("newPass") String newPass) {
+
+ // 1.密码长度是否合法
+ if (newPass.length() > 20 || newPass.length() < 6) {
+ return JsonResult.error("用户密码长度为6-20位!");
+ }
+
+ // 2.比较密码
+ User loginUser = getLoginUser();
+ User user = userService.get(loginUser.getId());
+ if (user != null && Objects.equals(user.getUserPass(), Md5Util.toMd5(beforePass, CommonConstant.PASSWORD_SALT, 10))) {
+ userService.updatePassword(user.getId(), newPass);
+ } else {
+ return JsonResult.error("旧密码错误");
+ }
+ return JsonResult.success("密码重置成功");
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/RoleController.java b/src/main/java/com/example/hotel/controller/admin/RoleController.java
new file mode 100644
index 0000000..74a9476
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/RoleController.java
@@ -0,0 +1,159 @@
+package com.example.hotel.controller.admin;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.entity.Permission;
+import com.example.hotel.entity.Role;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.enums.ResourceTypeEnum;
+import com.example.hotel.service.PermissionService;
+import com.example.hotel.service.RoleService;
+import com.example.hotel.util.PageUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.Strings;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 后台角色管理控制器
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/role")
+public class RoleController {
+
+ @Autowired
+ private RoleService roleService;
+
+ @Autowired
+ private PermissionService permissionService;
+
+ /**
+ * 查询所有角色并渲染role页面
+ *
+ * @return 模板路径admin/admin_role
+ */
+ @GetMapping
+ public String roles(@RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "level") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order, Model model) {
+ //角色列表
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+
+ Page roles = roleService.findAll(page);
+ model.addAttribute("roles", roles.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+
+ return "admin/admin_role";
+ }
+
+ /**
+ * 新增/修改角色
+ *
+ * @param role role对象
+ * @return 重定向到/admin/role
+ */
+ @PostMapping(value = "/save")
+ @ResponseBody
+ public JsonResult saveRole(@ModelAttribute Role role,
+ @RequestParam(value = "permissionIds") String permissionIds) {
+
+ if (Strings.isNotEmpty(permissionIds)) {
+ String[] arr = permissionIds.split(",");
+ List permissions = new ArrayList<>();
+ for (String permissionId : arr) {
+ Permission permission = new Permission();
+ permission.setId(Long.valueOf(permissionId));
+ permissions.add(permission);
+ }
+ role.setPermissions(permissions);
+ }
+ roleService.insertOrUpdate(role);
+ return JsonResult.success();
+ }
+
+ /**
+ * 删除角色
+ *
+ * @param roleId 角色Id
+ * @return JsonResult
+ */
+ @DeleteMapping(value = "/delete")
+ @ResponseBody
+ public JsonResult checkDelete(@RequestParam("id") Long roleId) {
+ //判断这个角色有没有用户
+ Integer userCount = roleService.countUserByRoleId(roleId);
+ if (userCount != 0) {
+ return JsonResult.error("当前角色已关联用户,无法删除");
+ }
+ roleService.delete(roleId);
+ return JsonResult.success("删除角色成功");
+ }
+
+
+ /**
+ * 添加用户页面
+ *
+ * @return 模板路径admin/admin_edit
+ */
+ @GetMapping("/new")
+ public String addRole(Model model) {
+ // 所有权限
+ model.addAttribute("permissions", getPermissionList());
+ return "admin/admin_role_add";
+ }
+
+ /**
+ * 跳转到修改页面
+ *
+ * @param roleId roleId
+ * @param model model
+ * @return 模板路径admin/admin_role
+ */
+ @GetMapping(value = "/edit")
+ public String toEditRole(Model model, @RequestParam("id") Long roleId) {
+ //更新的角色
+ Role role = roleService.findByRoleId(roleId);
+ //当前角色的权限列表
+ role.setPermissions(permissionService.listPermissionsByRoleId(roleId));
+ model.addAttribute("updateRole", role);
+
+ // 所有权限
+ model.addAttribute("permissions", getPermissionList());
+
+ // 当前角色的权限列表
+ List currentPermissionIds = permissionService.findPermissionByRoleId(roleId).stream().map(p -> p.getId()).collect(Collectors.toList());
+ model.addAttribute("currentPermissionIds", currentPermissionIds);
+ return "admin/admin_role_edit";
+ }
+
+ /**
+ * 所有权限
+ * @return
+ */
+ public List getPermissionList() {
+ //权限列表
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.orderByAsc("sort");
+ List permissions = permissionService.findAll(queryWrapper);
+ // 设置URL为编辑的URL
+ for (Permission permission : permissions) {
+ permission.setUrl("/admin/permission/edit?id=" + permission.getId());
+ if (ResourceTypeEnum.MENU.getCode().equals(permission.getResourceType())) {
+ permission.setName(permission.getName() + "[" + ResourceTypeEnum.MENU.getDescription() + "]");
+ } else if (ResourceTypeEnum.BUTTON.getCode().equals(permission.getResourceType())) {
+ permission.setName(permission.getName() + "[" + ResourceTypeEnum.BUTTON.getDescription() + "]");
+ } else if (ResourceTypeEnum.PAGE.getCode().equals(permission.getResourceType())) {
+ permission.setName(permission.getName() + "[" + ResourceTypeEnum.PAGE.getDescription() + "]");
+ }
+ }
+ return permissions;
+ }
+}
diff --git a/src/main/java/com/example/hotel/controller/admin/UserController.java b/src/main/java/com/example/hotel/controller/admin/UserController.java
new file mode 100644
index 0000000..3e1fb41
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/admin/UserController.java
@@ -0,0 +1,228 @@
+package com.example.hotel.controller.admin;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.entity.*;
+import com.example.hotel.enums.RoleEnum;
+import com.example.hotel.service.*;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.util.PageUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 后台用户管理控制器
+ */
+@Slf4j
+@Controller
+@RequestMapping(value = "/admin/user")
+public class UserController extends BaseController {
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private RoleService roleService;
+
+
+ @Autowired
+ private UserRoleRefService userRoleRefService;
+
+
+ public static final String USER_NAME = "userName";
+ public static final String USER_DISPLAY_NAME = "userDisplayName";
+ public static final String EMAIL = "email";
+
+ /**
+ * 查询所有分类并渲染user页面
+ *
+ * @return 模板路径admin/admin_user
+ */
+ @GetMapping("/customer")
+ public String customers(
+ @RequestParam(value = "status", defaultValue = "0") Integer status,
+ @RequestParam(value = "keywords", defaultValue = "") String keywords,
+ @RequestParam(value = "searchType", defaultValue = "") String searchType,
+ @RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "createTime") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order, Model model) {
+ //用户列表
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ User condition = new User();
+ condition.setStatus(status);
+ if (!StringUtils.isBlank(keywords)) {
+ if (USER_NAME.equals(searchType)) {
+ condition.setUserName(keywords);
+ } else if (USER_DISPLAY_NAME.equals(searchType)) {
+ condition.setUserDisplayName(keywords);
+ } else if (EMAIL.equals(searchType)) {
+ condition.setIdCard(keywords);
+ }
+ }
+ String role = RoleEnum.CUSTOMER.getValue();
+ Page users = userService.findByRoleAndCondition(role, condition, page);
+
+ //角色列表
+ Integer maxLevel = roleService.findMaxLevelByUserId(getLoginUserId());
+ List roles = roleService.findByLessThanLevel(maxLevel);
+ model.addAttribute("roles", roles);
+ model.addAttribute("users", users.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+ model.addAttribute("status", status);
+ model.addAttribute("keywords", keywords);
+ model.addAttribute("searchType", searchType);
+ model.addAttribute("sort", sort);
+ model.addAttribute("order", order);
+ model.addAttribute("currentRole", role);
+ return "admin/admin_user";
+ }
+
+ /**
+ * 查询所有分类并渲染user页面
+ *
+ * @return 模板路径admin/admin_user
+ */
+ @GetMapping("/worker")
+ public String works(
+ @RequestParam(value = "status", defaultValue = "0") Integer status,
+ @RequestParam(value = "keywords", defaultValue = "") String keywords,
+ @RequestParam(value = "searchType", defaultValue = "") String searchType,
+ @RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "createTime") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order, Model model) {
+ //用户列表
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ User condition = new User();
+ condition.setStatus(status);
+ if (!StringUtils.isBlank(keywords)) {
+ if (USER_NAME.equals(searchType)) {
+ condition.setUserName(keywords);
+ } else if (USER_DISPLAY_NAME.equals(searchType)) {
+ condition.setUserDisplayName(keywords);
+ } else if (EMAIL.equals(searchType)) {
+ condition.setIdCard(keywords);
+ }
+ }
+ String role = RoleEnum.WORKER.getValue();
+ Page users = userService.findByRoleAndCondition(role, condition, page);
+
+ //角色列表
+ Integer maxLevel = roleService.findMaxLevelByUserId(getLoginUserId());
+ List roles = roleService.findByLessThanLevel(maxLevel);
+ model.addAttribute("roles", roles);
+ model.addAttribute("users", users.getRecords());
+ model.addAttribute("pageInfo", PageUtil.convertPageVo(page));
+ model.addAttribute("status", status);
+ model.addAttribute("keywords", keywords);
+ model.addAttribute("searchType", searchType);
+ model.addAttribute("sort", sort);
+ model.addAttribute("order", order);
+ model.addAttribute("currentRole", role);
+ return "admin/admin_user";
+ }
+
+
+ /**
+ * 删除用户
+ *
+ * @param userId 用户Id
+ * @return JsonResult
+ */
+ @DeleteMapping(value = "/delete")
+ @ResponseBody
+ public JsonResult removeUser(@RequestParam("id") Long userId) {
+ userService.delete(userId);
+ return JsonResult.success("删除成功");
+ }
+
+ /**
+ * 添加用户页面
+ *
+ * @return 模板路径admin/admin_edit
+ */
+ @GetMapping("/new")
+ public String addUser(Model model) {
+
+ //角色列表
+ List roles = roleService.findAll();
+ model.addAttribute("roles", roles);
+
+ return "admin/admin_user_add";
+ }
+
+ /**
+ * 编辑用户页面
+ *
+ * @return 模板路径admin/admin_edit
+ */
+ @GetMapping("/edit")
+ public String edit(@RequestParam("id") Long userId, Model model) {
+ User user = userService.get(userId);
+ if (user != null) {
+ model.addAttribute("user", user);
+ //该用户的角色
+ Role currentRole = roleService.findByUserId(userId);
+ model.addAttribute("currentRole", currentRole);
+
+ //角色列表
+ List roles = roleService.findAll();
+ model.addAttribute("roles", roles);
+
+
+ return "admin/admin_user_edit";
+ }
+ return this.renderNotFound();
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param ids 用户ID列表
+ * @return
+ */
+ @DeleteMapping(value = "/batchDelete")
+ @ResponseBody
+ public JsonResult batchDelete(@RequestParam("ids") List ids) {
+ //批量操作
+ if (ids == null || ids.size() == 0 || ids.size() >= 100) {
+ return JsonResult.error("参数不合法!");
+ }
+ List userList = userService.findByBatchIds(ids);
+ for (User user : userList) {
+ userService.delete(user.getId());
+ }
+ return JsonResult.success("删除成功");
+ }
+
+ /**
+ * 新增/修改用户
+ *
+ * @param user user
+ * @return 重定向到/admin/user
+ */
+ @PostMapping(value = "/save")
+ @ResponseBody
+ @Transactional(rollbackFor = Exception.class)
+ public JsonResult saveUser(@ModelAttribute User user,
+ @RequestParam(value = "roleId", required = false) Long roleId) {
+ // 1.添加用户
+ userService.insertOrUpdate(user);
+ if(roleId != null) {
+ // 2.先删除该用户的角色关联
+ userRoleRefService.deleteByUserId(user.getId());
+ // 3.添加角色关联
+ userRoleRefService.insert(new UserRoleRef(user.getId(), roleId));
+ }
+ return JsonResult.success("保存成功");
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/controller/common/BaseController.java b/src/main/java/com/example/hotel/controller/common/BaseController.java
new file mode 100755
index 0000000..db94f26
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/common/BaseController.java
@@ -0,0 +1,95 @@
+package com.example.hotel.controller.common;
+
+import com.example.hotel.entity.User;
+import com.example.hotel.enums.RoleEnum;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
+
+/**
+ * Controller抽象类
+ */
+public abstract class BaseController {
+
+ /**
+ * 渲染404页面
+ *
+ * @return redirect:/404
+ */
+ public String renderNotFound() {
+ return "forward:/404";
+ }
+
+
+ /**
+ * 渲染404页面
+ *
+ * @return redirect:/404
+ */
+ public String renderNotAllowAccess() {
+ return "redirect:/403";
+ }
+
+ /**
+ * 当前登录用户
+ *
+ * @return
+ */
+ public User getLoginUser() {
+ Subject subject = SecurityUtils.getSubject();
+ if (subject.isAuthenticated()) {
+ return (User) subject.getPrincipal();
+ }
+ return null;
+ }
+
+ /**
+ * 当前用户ID
+ *
+ * @return
+ */
+ public Long getLoginUserId() {
+ return getLoginUser().getId();
+ }
+
+ /**
+ * 当前用户是管理员
+ *
+ * @return
+ */
+ public Boolean loginUserIsAdmin() {
+ User loginUser = getLoginUser();
+ if (loginUser != null) {
+ return RoleEnum.ADMIN.getValue().equalsIgnoreCase(loginUser.getRole());
+ }
+ return false;
+ }
+
+ /**
+ * 当前用户是工作人员
+ *
+ * @return
+ */
+ public Boolean loginUserIsWorker() {
+ User loginUser = getLoginUser();
+ if (loginUser != null) {
+ return RoleEnum.WORKER.getValue().equalsIgnoreCase(loginUser.getRole());
+ }
+ return false;
+ }
+
+
+ /**
+ * 当前用户是消费者
+ *
+ * @return
+ */
+ public Boolean loginUserIsCustomer() {
+ User loginUser = getLoginUser();
+ if (loginUser != null) {
+ return RoleEnum.CUSTOMER.getValue().equalsIgnoreCase(loginUser.getRole());
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/common/CommonController.java b/src/main/java/com/example/hotel/controller/common/CommonController.java
new file mode 100755
index 0000000..dc1cf45
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/common/CommonController.java
@@ -0,0 +1,76 @@
+package com.example.hotel.controller.common;
+
+import com.example.hotel.enums.CommonParamsEnum;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.web.servlet.error.ErrorController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 错误页面控制器
+ */
+@Slf4j
+@Controller
+public class CommonController implements ErrorController {
+
+
+ /**
+ * 渲染404,500
+ *
+ * @param request request
+ * @return String
+ */
+ @GetMapping(value = "/error")
+ public String handleError(HttpServletRequest request) {
+ Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
+ if (statusCode.equals(CommonParamsEnum.NOT_FOUND.getValue())) {
+ return "redirect:/404";
+ } else {
+ return "redirect:/500";
+ }
+ }
+
+ /**
+ * 渲染403页面
+ *
+ * @return String
+ */
+ @GetMapping(value = "/403")
+ public String fourZeroThree() {
+ return "common/error/403";
+ }
+
+
+ /**
+ * 渲染404页面
+ *
+ * @return String
+ */
+ @GetMapping(value = "/404")
+ public String fourZeroFour() {
+ return "common/error/404";
+ }
+
+
+ /**
+ * 渲染500页面
+ *
+ * @return String
+ */
+ @GetMapping(value = "/500")
+ public String fiveZeroZero() {
+ return "common/error/500";
+ }
+
+ /**
+ * Returns the path of the error page.
+ *
+ * @return the error path
+ */
+ @Override
+ public String getErrorPath() {
+ return "/error";
+ }
+}
diff --git a/src/main/java/com/example/hotel/controller/home/FrontCategoryController.java b/src/main/java/com/example/hotel/controller/home/FrontCategoryController.java
new file mode 100644
index 0000000..581512d
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/home/FrontCategoryController.java
@@ -0,0 +1,84 @@
+package com.example.hotel.controller.home;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.PostQueryCondition;
+import com.example.hotel.entity.Category;
+import com.example.hotel.entity.Post;
+import com.example.hotel.service.CategoryService;
+import com.example.hotel.service.PostService;
+import com.example.hotel.util.PageUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+/**
+ * @author 言曌
+ * @date 2020/3/11 4:59 下午
+ */
+@Controller
+public class FrontCategoryController extends BaseController {
+
+ @Autowired
+ private PostService postService;
+
+ @Autowired
+ private CategoryService categoryService;
+
+ /**
+ * 分类列表
+ *
+ * @param model
+ * @return
+ */
+ @GetMapping("/category")
+ public String category(@RequestParam(value = "keywords", required = false) String keywords,
+ Model model) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.orderByDesc("cate_sort");
+ if (StringUtils.isNotEmpty(keywords)) {
+ queryWrapper.like("cate_name", keywords);
+ }
+ List categories = categoryService.findAll(queryWrapper);
+ model.addAttribute("categories", categories);
+ return "home/category";
+ }
+
+
+ /**
+ * 分类对应的帖子列表
+ *
+ * @param model
+ * @return
+ */
+ @GetMapping("/category/{id}")
+ public String index(@PathVariable("id") Long cateId,
+ @RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "10") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "createTime") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order,
+ Model model) {
+
+ Category category = categoryService.get(cateId);
+ if(category == null) {
+ return renderNotFound();
+ }
+
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ PostQueryCondition condition = new PostQueryCondition();
+ condition.setCateId(cateId);
+ Page postPage = postService.findPostByCondition(condition, page);
+ model.addAttribute("posts", postPage);
+ model.addAttribute("category", category);
+ return "home/category_post";
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/home/FrontPostController.java b/src/main/java/com/example/hotel/controller/home/FrontPostController.java
new file mode 100644
index 0000000..107bb9a
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/home/FrontPostController.java
@@ -0,0 +1,342 @@
+package com.example.hotel.controller.home;
+
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.entity.*;
+import com.example.hotel.enums.OrderStatusEnum;
+import com.example.hotel.service.*;
+import com.example.hotel.util.DateUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author 言曌
+ * @date 2020/3/11 4:59 下午
+ */
+@Controller
+public class FrontPostController extends BaseController {
+
+ @Autowired
+ private CategoryService categoryService;
+
+ @Autowired
+ private PostService postService;
+
+ @Autowired
+ private OrderService orderService;
+
+ @Autowired
+ private RecordService recordService;
+
+ @Autowired
+ private UserService userService;
+
+ /**
+ * 帖子详情
+ *
+ * @param id
+ * @param model
+ * @return
+ */
+ @GetMapping("/post/{id}")
+ public String postDetails(@PathVariable("id") Long id,
+ @RequestParam(value = "startDate", required = false) String start,
+ @RequestParam(value = "quantity", defaultValue = "1") Integer quantity,
+ Model model) {
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.FORMAT);
+
+ if (quantity == null || quantity < 1) {
+ quantity = 1;
+ }
+
+ Date today = new Date();
+
+ // 判断入住日期是否合法
+ if (StringUtils.isEmpty(start)) {
+ start = dateFormat.format(today);
+ } else {
+ try {
+ Date startDate = dateFormat.parse(start);
+ if (startDate.before(today)) {
+ start = dateFormat.format(today);
+ }
+ } catch (ParseException e) {
+ start = dateFormat.format(today);
+ e.printStackTrace();
+ }
+ }
+
+ // 客房
+ Post post = postService.get(id);
+ if (post == null) {
+ return renderNotFound();
+ }
+ // 分类
+ Category category = categoryService.get(post.getCateId());
+ post.setCategory(category);
+ model.addAttribute("post", post);
+
+ String[] imgUrlList = post.getImgUrl().split(",");
+ model.addAttribute("imgUrlList", imgUrlList);
+
+
+ // 该房间的预定记录
+ List recordList = recordService.findByPostId(id);
+ model.addAttribute("recordList", recordList);
+
+ // 分类列表
+ List categoryList = categoryService.findAll();
+ model.addAttribute("categoryList", categoryList);
+
+ model.addAttribute("startDate", start);
+ model.addAttribute("quantity", quantity);
+ return "home/post";
+ }
+
+
+ /**
+ * 结算页面
+ *
+ * @param postId
+ * @param start
+ * @param quantity
+ * @param model
+ * @return
+ */
+ @GetMapping("/checkout")
+ public String checkout(@RequestParam("postId") Long postId,
+ @RequestParam(value = "startDate", required = false) String start,
+ @RequestParam(value = "quantity", defaultValue = "1") Integer quantity,
+ Model model) {
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.FORMAT);
+
+ if (quantity == null || quantity < 1) {
+ quantity = 1;
+ }
+
+ Date today = new Date();
+
+ // 判断入住日期是否合法
+ if (StringUtils.isEmpty(start)) {
+ start = dateFormat.format(today);
+ } else {
+ try {
+ Date startDate = dateFormat.parse(start);
+ if (startDate.before(today)) {
+ start = dateFormat.format(today);
+ }
+ } catch (ParseException e) {
+ start = dateFormat.format(today);
+ e.printStackTrace();
+ }
+ }
+
+ Post post = postService.get(postId);
+ if (post == null) {
+ return this.renderNotFound();
+ }
+
+ User user = getLoginUser();
+ if (user == null) {
+ return "redirect:/";
+ }
+
+ // 分类列表
+ List categoryList = categoryService.findAll();
+ model.addAttribute("categoryList", categoryList);
+
+ model.addAttribute("post", post);
+ model.addAttribute("startDate", start);
+ model.addAttribute("quantity", quantity);
+ model.addAttribute("user", user);
+ return "home/checkout";
+ }
+
+ /**
+ * 创建订单
+ *
+ * @param postId
+ * @param start
+ * @param quantity
+ * @return
+ */
+ @GetMapping("/checkOrder")
+ @ResponseBody
+ public JsonResult checkOrder(@RequestParam(value = "postId") Long postId,
+ @RequestParam(value = "startDate") String start,
+ @RequestParam(value = "quantity") Integer quantity) {
+ User user = getLoginUser();
+ if (user == null) {
+ return JsonResult.error("请先登录");
+ }
+
+ Post post = postService.get(postId);
+ if (post == null) {
+ return JsonResult.error("客房不存在");
+ }
+
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.FORMAT);
+
+ if (quantity == null || quantity < 1 || quantity > 7) {
+ return JsonResult.error("天数不合法");
+ }
+
+ Date today = new Date();
+
+ // 判断入住日期是否合法
+ if (StringUtils.isEmpty(start)) {
+ start = dateFormat.format(today);
+ } else {
+ try {
+ Date startDate = dateFormat.parse(start);
+ if (startDate.before(today) && !Objects.equals(start, dateFormat.format(today))) {
+ return JsonResult.error("不能预定过去的日期");
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return JsonResult.error("预定日期格式不合法");
+ }
+ }
+
+ // 查询日期列表
+ List dateList = DateUtil.getBetweenDates(start, quantity);
+ // 判断客房是否可以预定
+ List recordList = recordService.findByPostIdAndRecordDate(postId, dateList);
+ if (recordList.size() > 0) {
+ return JsonResult.error("房间已被人预定,请重新选择房间和日期");
+ }
+ return JsonResult.success("可以预定");
+ }
+
+ /**
+ * 创建订单
+ *
+ * @param postId
+ * @param start
+ * @param quantity
+ * @param userName
+ * @param userDisplayName
+ * @param idCard
+ * @return
+ */
+ @PostMapping("/order")
+ @Transactional
+ @ResponseBody
+ public JsonResult addOrder(@RequestParam(value = "postId") Long postId,
+ @RequestParam(value = "startDate") String start,
+ @RequestParam(value = "quantity") Integer quantity,
+ @RequestParam(value = "userName") String userName,
+ @RequestParam(value = "userDisplayName") String userDisplayName,
+ @RequestParam(value = "idCard") String idCard) {
+ User user = getLoginUser();
+ if (user == null) {
+ return JsonResult.error("请先登录");
+ }
+
+ Post post = postService.get(postId);
+ if (post == null) {
+ return JsonResult.error("客房不存在");
+ }
+
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.FORMAT);
+
+ if (quantity == null || quantity < 1 || quantity > 7) {
+ return JsonResult.error("天数不合法");
+ }
+
+ Date today = new Date();
+
+ // 判断入住日期是否合法
+ if (StringUtils.isEmpty(start)) {
+ start = dateFormat.format(today);
+ } else {
+ try {
+ Date startDate = dateFormat.parse(start);
+ if (startDate.before(today) && !Objects.equals(start, dateFormat.format(today))) {
+ return JsonResult.error("不能预定过去的日期");
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return JsonResult.error("预定日期格式不合法");
+ }
+ }
+
+ // 查询日期列表
+ List dateList = DateUtil.getBetweenDates(start, quantity);
+ // 判断客房是否可以预定
+ List recordList = recordService.findByPostIdAndRecordDate(postId, dateList);
+ if (recordList.size() > 0) {
+ return JsonResult.error("房间已被人预定,请重新选择房间和日期");
+ }
+
+ // 支付省略
+ // 添加订单
+ Order order = new Order();
+ order.setPostId(postId);
+ order.setQuantity(quantity);
+ order.setStartDate(start);
+ order.setName(userDisplayName);
+ order.setPhone(userName);
+ order.setIdCard(idCard);
+ order.setUserId(user.getId());
+ order.setStatus(OrderStatusEnum.HAS_PAY.getCode());
+ order.setPostTitle(post.getPostTitle());
+ order.setPostNumber(post.getNumber());
+ order.setPrice(post.getPrice());
+ order.setTotalPrice(post.getPrice() * quantity);
+ order.setCreateTime(new Date());
+ order.setUpdateTime(new Date());
+ orderService.insert(order);
+
+ // 添加预定记录
+ for (String recordDate : dateList) {
+ Record record = new Record();
+ record.setPostId(postId);
+ record.setUserId(user.getId());
+ record.setRecordDate(recordDate);
+ recordService.insert(record);
+ }
+ return JsonResult.success("预定成功", order.getId());
+ }
+
+ @GetMapping("/order/{id}")
+ public String order(@PathVariable("id") Long id, Model model) {
+ Order order = orderService.get(id);
+ if (order == null) {
+ return this.renderNotFound();
+ }
+
+ User user = getLoginUser();
+ if (user == null) {
+ return "redirect:/";
+ }
+
+ Boolean isCustomer = loginUserIsCustomer();
+ if (!Objects.equals(order.getUserId(), user.getId()) && isCustomer) {
+ return this.renderNotAllowAccess();
+ }
+ model.addAttribute("order", order);
+
+
+ // 分类列表
+ List categoryList = categoryService.findAll();
+ model.addAttribute("categoryList", categoryList);
+
+ model.addAttribute("user", userService.get(order.getUserId()));
+ return "home/order";
+ }
+
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/home/IndexController.java b/src/main/java/com/example/hotel/controller/home/IndexController.java
new file mode 100644
index 0000000..66bd1fc
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/home/IndexController.java
@@ -0,0 +1,92 @@
+package com.example.hotel.controller.home;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.dto.PostQueryCondition;
+import com.example.hotel.entity.*;
+import com.example.hotel.exception.MyBusinessException;
+import com.example.hotel.service.*;
+import com.example.hotel.util.DateUtil;
+import com.example.hotel.util.PageUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author 言曌
+ * @date 2020/3/9 11:00 上午
+ */
+
+@Controller
+public class IndexController extends BaseController {
+
+ @Autowired
+ private PostService postService;
+
+ @Autowired
+ private CategoryService categoryService;
+
+
+ @GetMapping("/")
+ public String index(@RequestParam(value = "page", defaultValue = "1") Integer pageNumber,
+ @RequestParam(value = "size", defaultValue = "9") Integer pageSize,
+ @RequestParam(value = "sort", defaultValue = "createTime") String sort,
+ @RequestParam(value = "order", defaultValue = "desc") String order,
+ @RequestParam(value = "startDate", required = false) String start,
+ @RequestParam(value = "quantity", defaultValue = "1") Integer quantity,
+ @RequestParam(value = "cateId", defaultValue = "0") Long cateId,
+ Model model) {
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.FORMAT);
+
+ if (quantity == null || quantity < 1) {
+ quantity = 1;
+ }
+
+ Date today = new Date();
+
+ // 判断入住日期是否合法
+ if (StringUtils.isEmpty(start)) {
+ start = dateFormat.format(today);
+ } else {
+ try {
+ Date startDate = dateFormat.parse(start);
+ if (startDate.before(today)) {
+ start = dateFormat.format(today);
+ }
+ } catch (ParseException e) {
+ start = dateFormat.format(today);
+ e.printStackTrace();
+ }
+ }
+
+
+ PostQueryCondition condition = new PostQueryCondition();
+ // 查询日期列表
+ List dateList = DateUtil.getBetweenDates(start, quantity);
+ condition.setDateList(dateList);
+ condition.setCateId(cateId);
+ Page page = PageUtil.initMpPage(pageNumber, pageSize, sort, order);
+ Page postPage = postService.findPostByCondition(condition, page);
+ model.addAttribute("posts", postPage);
+
+ // 分类列表
+ List categoryList = categoryService.findAll();
+ model.addAttribute("categoryList", categoryList);
+ model.addAttribute("quantity", quantity);
+ model.addAttribute("startDate", start);
+ model.addAttribute("cateId", cateId);
+ return "home/index";
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/controller/home/LoginController.java b/src/main/java/com/example/hotel/controller/home/LoginController.java
new file mode 100644
index 0000000..038dd58
--- /dev/null
+++ b/src/main/java/com/example/hotel/controller/home/LoginController.java
@@ -0,0 +1,194 @@
+package com.example.hotel.controller.home;
+
+import cn.hutool.core.lang.Validator;
+import com.example.hotel.common.constant.CommonConstant;
+import com.example.hotel.controller.common.BaseController;
+import com.example.hotel.entity.Role;
+import com.example.hotel.entity.User;
+import com.example.hotel.entity.UserRoleRef;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.enums.CommonParamsEnum;
+import com.example.hotel.enums.TrueFalseEnum;
+import com.example.hotel.enums.UserStatusEnum;
+import com.example.hotel.service.*;
+import com.example.hotel.util.Md5Util;
+import com.example.hotel.util.RegexUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.IncorrectCredentialsException;
+import org.apache.shiro.authc.LockedAccountException;
+import org.apache.shiro.authc.UnknownAccountException;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.mail.MessagingException;
+import java.util.Set;
+
+@Controller
+@Slf4j
+public class LoginController extends BaseController {
+
+ @Autowired
+ private PermissionService permissionService;
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private RoleService roleService;
+
+ @Autowired
+ private UserRoleRefService userRoleRefService;
+
+ /**
+ * 验证登录信息
+ *
+ * @param userName 登录名:身份证号码/手机号
+ * @param userPass password 密码
+ * @return JsonResult JsonResult
+ */
+ @PostMapping(value = "/login")
+ @ResponseBody
+ public JsonResult getLogin(@RequestParam("userName") String userName,
+ @RequestParam("userPass") String userPass) {
+ Subject subject = SecurityUtils.getSubject();
+ UsernamePasswordToken token = new UsernamePasswordToken(userName, userPass);
+ try {
+ subject.login(token);
+ if (subject.isAuthenticated()) {
+ //登录成功,修改登录错误次数为0
+ User user = (User) subject.getPrincipal();
+ Set permissionUrls = permissionService.findPermissionUrlsByUserId(user.getId());
+ subject.getSession().setAttribute("permissionUrls", permissionUrls);
+ return JsonResult.success("登录成功");
+ }
+ } catch (UnknownAccountException e) {
+ return JsonResult.error("账号不存在");
+ } catch (IncorrectCredentialsException e) {
+ e.printStackTrace();
+ return JsonResult.error("账号或密码错误");
+ } catch (LockedAccountException e) {
+ return JsonResult.error(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.info(e.getMessage());
+ }
+ return JsonResult.error("服务器内部错误");
+ }
+
+
+ /**
+ * 退出登录
+ *
+ * @return 重定向到/login
+ */
+ @GetMapping(value = "/logout")
+ public String logOut() {
+ Subject subject = SecurityUtils.getSubject();
+ subject.logout();
+ return "redirect:/";
+ }
+
+ /**
+ * 退出登录
+ *
+ * @return 重定向到/login
+ */
+ @PostMapping(value = "/logout")
+ @ResponseBody
+ public JsonResult ajaxLogOut() {
+ Subject subject = SecurityUtils.getSubject();
+ subject.logout();
+ return JsonResult.success();
+ }
+
+ /**
+ * 验证注册信息
+ *
+ * @param userName 手机号
+ * @param idCard 身份证号码
+ * @return JsonResult JsonResult
+ */
+ @PostMapping(value = "/register")
+ @ResponseBody
+ @Transactional
+ public JsonResult getRegister(@RequestParam("userName") String userName,
+ @RequestParam("userPass") String userPass,
+ @RequestParam("idCard") String idCard,
+ @RequestParam("userDisplayName") String userDisplayName) {
+ // 1.校验是否输入完整
+ if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(userPass) || StringUtils.isEmpty(idCard)) {
+ return JsonResult.error("请填写完整信息");
+ }
+
+ // 2.密码长度是否合法
+ if (userPass.length() > 20 || userPass.length() < 6) {
+ return JsonResult.error("用户密码长度为6-20位!");
+ }
+
+ //3.创建用户
+ User user = new User();
+ user.setUserName(userName);
+ user.setUserDisplayName(userDisplayName);
+ user.setIdCard(idCard);
+ user.setUserPass(Md5Util.toMd5(userPass, CommonConstant.PASSWORD_SALT, 10));
+ user.setUserAvatar("/static/images/avatar/" + RandomUtils.nextInt(1, 41) + ".jpeg");
+ user.setStatus(UserStatusEnum.NORMAL.getCode());
+ userService.insert(user);
+
+ //4.关联角色
+ Role defaultRole = roleService.findDefaultRole();
+ if (defaultRole != null) {
+ userRoleRefService.insert(new UserRoleRef(user.getId(), defaultRole.getId()));
+ }
+ return JsonResult.success("注册成功");
+ }
+
+ /**
+ * 处理忘记密码
+ *
+ * @param userName 手机号
+ * @param idCard 身份证号码
+ * @return JsonResult
+ */
+ @PostMapping(value = "/forget")
+ @ResponseBody
+ public JsonResult getForget(@RequestParam("userName") String userName,
+ @RequestParam("userPass") String userPass,
+ @RequestParam("idCard") String idCard) {
+
+ User user = userService.findByUserName(userName);
+ if (user != null && idCard.equalsIgnoreCase(user.getIdCard())) {
+ //1.修改密码
+ userService.updatePassword(user.getId(), userPass);
+ return JsonResult.success("密码重置成功,新密码为" + userPass);
+ } else {
+ return JsonResult.error("手机号和电子身份证号码不一致");
+ }
+ }
+
+ /**
+ * 检查用户是否登录
+ *
+ * @return JsonResult
+ */
+ @GetMapping(value = "/checkLogin")
+ @ResponseBody
+ public JsonResult checkLogin() {
+ User user = getLoginUser();
+ if (user == null) {
+ return JsonResult.error("请先登录");
+ } else {
+ return JsonResult.success();
+ }
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/dto/JsonResult.java b/src/main/java/com/example/hotel/dto/JsonResult.java
new file mode 100644
index 0000000..a3d9e5d
--- /dev/null
+++ b/src/main/java/com/example/hotel/dto/JsonResult.java
@@ -0,0 +1,83 @@
+package com.example.hotel.dto;
+
+import lombok.Data;
+
+/**
+ *
+ * Json格式
+ *
+ *
+ * @author : saysky
+ * @date : 2018/5/24
+ */
+@Data
+public class JsonResult {
+
+ /**
+ * 返回的状态码,0:失败,1:成功
+ */
+ private Integer code;
+
+ /**
+ * 返回信息
+ */
+ private String msg;
+
+ /**
+ * 返回的数据
+ */
+ private Object result;
+
+ /**
+ * 不返回数据的构造方法
+ *
+ * @param code 状态码
+ * @param msg 信息
+ */
+ public JsonResult(Integer code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ /**
+ * 返回数据的构造方法
+ *
+ * @param code 状态码
+ * @param msg 信息
+ * @param result 数据
+ */
+ public JsonResult(Integer code, String msg, Object result) {
+ this.code = code;
+ this.msg = msg;
+ this.result = result;
+ }
+
+ /**
+ * 返回状态码和数据
+ *
+ * @param code 状态码
+ * @param result 数据
+ */
+ public JsonResult(Integer code, Object result) {
+ this.code = code;
+ this.result = result;
+ }
+
+ public static JsonResult error(String msg) {
+ return new JsonResult(0, msg);
+ }
+ public static JsonResult error(String msg, Object data) {
+ return new JsonResult(0, msg, data);
+ }
+ public static JsonResult success() {
+ return new JsonResult(1, "操作成功");
+ }
+
+ public static JsonResult success(String msg) {
+ return new JsonResult(1, msg);
+ }
+
+ public static JsonResult success(String msg, Object result) {
+ return new JsonResult(1, msg, result);
+ }
+}
diff --git a/src/main/java/com/example/hotel/dto/PostQueryCondition.java b/src/main/java/com/example/hotel/dto/PostQueryCondition.java
new file mode 100644
index 0000000..cacd0c2
--- /dev/null
+++ b/src/main/java/com/example/hotel/dto/PostQueryCondition.java
@@ -0,0 +1,29 @@
+package com.example.hotel.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author 言曌
+ * @date 2020/3/12 4:53 下午
+ */
+@Data
+public class PostQueryCondition {
+
+ /**
+ * 用户ID
+ */
+ private Long userId;
+
+
+ /**
+ * 分类ID
+ */
+ private Long cateId;
+
+ /**
+ * 预订的日期集合
+ */
+ private List dateList;
+}
diff --git a/src/main/java/com/example/hotel/dto/QueryCondition.java b/src/main/java/com/example/hotel/dto/QueryCondition.java
new file mode 100644
index 0000000..8f94e64
--- /dev/null
+++ b/src/main/java/com/example/hotel/dto/QueryCondition.java
@@ -0,0 +1,38 @@
+package com.example.hotel.dto;
+
+import com.example.hotel.vo.SearchVo;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 查询封装类
+ * @author 言曌
+ * @date 2019-08-16 13:45
+ */
+@Data
+public class QueryCondition implements Serializable {
+
+ /**
+ * 根据字段筛选
+ */
+ private T data;
+
+ /**
+ * 一般筛选
+ */
+ private SearchVo searchVo;
+
+
+ public QueryCondition() {
+ }
+
+ public QueryCondition(T data) {
+ this.data = data;
+ }
+
+ public QueryCondition(T data, SearchVo searchVo) {
+ this.data = data;
+ this.searchVo = searchVo;
+ }
+}
diff --git a/src/main/java/com/example/hotel/entity/Category.java b/src/main/java/com/example/hotel/entity/Category.java
new file mode 100755
index 0000000..b87d0ca
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Category.java
@@ -0,0 +1,33 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+/**
+ *
+ * 客房分类
+ *
+ *
+ * @author : saysky
+ * @date : 2017/11/30
+ */
+@Data
+@TableName("category")
+public class Category extends BaseEntity {
+
+ /**
+ * 分类名称
+ */
+ private String cateName;
+
+ /**
+ * 分类排序号
+ */
+ private Integer cateSort;
+
+ /**
+ * 分类描述
+ */
+ private String cateDesc;
+}
diff --git a/src/main/java/com/example/hotel/entity/Link.java b/src/main/java/com/example/hotel/entity/Link.java
new file mode 100755
index 0000000..b1b460a
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Link.java
@@ -0,0 +1,35 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+/**
+ *
+ * 友情链接
+ *
+ */
+@Data
+@TableName("link")
+public class Link extends BaseEntity {
+
+ /**
+ * 友情链接名称
+ */
+ private String linkName;
+
+ /**
+ * 友情链接地址
+ */
+ private String linkUrl;
+
+ /**
+ * 友情链接头像
+ */
+ private String linkPic;
+
+ /**
+ * 友情链接描述
+ */
+ private String linkDesc;
+}
diff --git a/src/main/java/com/example/hotel/entity/Order.java b/src/main/java/com/example/hotel/entity/Order.java
new file mode 100644
index 0000000..eff01d5
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Order.java
@@ -0,0 +1,63 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+/**
+ * 订单
+ * @author 言曌
+ * @date 2020/4/5 3:25 下午
+ */
+@Data
+@TableName("t_order")
+public class Order extends BaseEntity {
+
+ /**
+ * 用户ID
+ */
+ private Long userId;
+
+ /**
+ * 房间ID
+ */
+ private Long postId;
+
+ /**
+ * 数量
+ */
+ private Integer quantity;
+
+ /**
+ * 住客姓名
+ */
+ private String name;
+
+ /**
+ * 联系手机
+ */
+ private String phone;
+
+
+ /**
+ * 身份证
+ */
+ private String idCard;
+
+ /**
+ * 入店日期
+ */
+ private String startDate;
+
+
+ /**
+ * 订单状态:0待支付,1已支付,2已完结
+ */
+ private Integer status;
+
+ private Integer price;
+ private Integer totalPrice;
+ private String postTitle;
+ private String postNumber;
+
+}
diff --git a/src/main/java/com/example/hotel/entity/Permission.java b/src/main/java/com/example/hotel/entity/Permission.java
new file mode 100644
index 0000000..f4812be
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Permission.java
@@ -0,0 +1,62 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ *
+ * 权限,后台的菜单
+ * @author example
+ */
+@Data
+@TableName("permission")
+public class Permission extends BaseEntity {
+
+ /**
+ * 权限名称
+ */
+ private String name;
+
+ /**
+ * pid
+ */
+ private Long pid;
+
+ /**
+ * 资源类型
+ */
+ private String resourceType;
+
+ /**
+ * 请求URL
+ */
+ private String url;
+
+ /**
+ * 图标
+ */
+ private String icon;
+
+ /**
+ * 序号(越小越靠前)
+ */
+ private Double sort;
+
+ /**
+ * 级别
+ */
+ @TableField(exist = false)
+ private Integer level;
+
+ /**
+ * 子权限列表
+ */
+ @TableField(exist = false)
+ private List childPermissions;
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/entity/Post.java b/src/main/java/com/example/hotel/entity/Post.java
new file mode 100644
index 0000000..2d61024
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Post.java
@@ -0,0 +1,77 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import com.example.hotel.util.RelativeDateFormat;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author example
+ */
+@Data
+@TableName("post")
+public class Post extends BaseEntity {
+
+ /**
+ * 客房标题
+ */
+ private String postTitle;
+
+ /**
+ * 客房描述
+ */
+ private String postContent;
+
+ /**
+ * 客房摘要
+ */
+ private String postSummary;
+
+ /**
+ * 缩略图
+ */
+ private String postThumbnail;
+
+ /**
+ * 0 正常
+ * 1 已预订
+ * 2 下架
+ */
+ private Integer postStatus;
+
+ /**
+ * 价格
+ */
+ private Integer price;
+
+ /**
+ * 房间编号
+ */
+ private String number;
+
+ /**
+ * 分类ID
+ */
+ private Long cateId;
+
+ /**
+ * 图片URL
+ */
+ private String imgUrl;
+
+ /**
+ * 富文本
+ */
+ private String postEditor;
+
+ /**
+ * 客房所属分类
+ */
+ @TableField(exist = false)
+ private Category category;
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/entity/Record.java b/src/main/java/com/example/hotel/entity/Record.java
new file mode 100644
index 0000000..76ed3d7
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Record.java
@@ -0,0 +1,32 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+/**
+ * 预定记录
+ * @author 言曌
+ * @date 2020/4/5 3:25 下午
+ */
+@Data
+@TableName("record")
+public class Record extends BaseEntity {
+
+ /**
+ * 用户ID
+ */
+ private Long userId;
+
+ /**
+ * 房间ID
+ */
+ private Long postId;
+
+ /**
+ * 入店日期
+ */
+ private String recordDate;
+
+
+}
diff --git a/src/main/java/com/example/hotel/entity/Role.java b/src/main/java/com/example/hotel/entity/Role.java
new file mode 100644
index 0000000..f82b881
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/Role.java
@@ -0,0 +1,49 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author example
+ */
+@Data
+@TableName("role")
+public class Role extends BaseEntity {
+
+ /**
+ * 角色名称:admin,author,subscriber
+ */
+ private String role;
+
+ /**
+ * 描述:管理员,作者,订阅者
+ */
+ private String description;
+
+ /**
+ * 级别
+ */
+ private Integer level;
+
+ /**
+ * 用户注册默认角色
+ */
+ private Integer isRegisterDefault;
+
+ /**
+ * 该角色对应的用户数量,非数据库字段
+ */
+ @TableField(exist = false)
+ private Integer count;
+
+ /**
+ * 当前角色的权限列表
+ */
+ @TableField(exist = false)
+ private List permissions;
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/entity/RolePermissionRef.java b/src/main/java/com/example/hotel/entity/RolePermissionRef.java
new file mode 100644
index 0000000..edcb6d0
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/RolePermissionRef.java
@@ -0,0 +1,28 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+@Data
+@TableName("role_permission_ref")
+public class RolePermissionRef extends BaseEntity {
+
+ /**
+ * 角色Id
+ */
+ private Long roleId;
+
+ /**
+ * 权限Id
+ */
+ private Long permissionId;
+
+ public RolePermissionRef() {
+ }
+
+ public RolePermissionRef(Long roleId, Long permissionId) {
+ this.roleId = roleId;
+ this.permissionId = permissionId;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/entity/User.java b/src/main/java/com/example/hotel/entity/User.java
new file mode 100644
index 0000000..81aee6b
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/User.java
@@ -0,0 +1,74 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+import javax.validation.constraints.Email;
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+
+/**
+ * 用户信息
+ */
+@Data
+@TableName("user")
+public class User extends BaseEntity {
+
+ /**
+ * 手机号
+ */
+ private String userName;
+
+ /**
+ * 显示名称
+ */
+ private String userDisplayName;
+
+ /**
+ * 密码
+ */
+ @JsonIgnore
+ private String userPass;
+
+ /**
+ * 身份证号码
+ */
+ private String idCard;
+
+ /**
+ * 头像
+ */
+ private String userAvatar;
+
+ /**
+ * 说明
+ */
+ private String userDesc;
+
+ /**
+ * 最后一次登录时间
+ */
+ private Date loginLast;
+
+ /**
+ * 0 正常
+ * 1 禁用
+ * 2 已删除
+ */
+ private Integer status = 0;
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+ /**
+ * 角色名称
+ */
+ @TableField(exist = false)
+ private String role;
+
+}
diff --git a/src/main/java/com/example/hotel/entity/UserRoleRef.java b/src/main/java/com/example/hotel/entity/UserRoleRef.java
new file mode 100644
index 0000000..cdae279
--- /dev/null
+++ b/src/main/java/com/example/hotel/entity/UserRoleRef.java
@@ -0,0 +1,34 @@
+package com.example.hotel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.example.hotel.common.base.BaseEntity;
+import lombok.Data;
+
+
+/**
+ * 用户和角色关联
+ * @author example
+ */
+@Data
+@TableName("user_role_ref")
+public class UserRoleRef extends BaseEntity {
+
+
+ /**
+ * 用户Id
+ */
+ private Long userId;
+
+ /**
+ * 角色Id
+ */
+ private Long roleId;
+
+ public UserRoleRef(Long userId, Long roleId) {
+ this.userId = userId;
+ this.roleId = roleId;
+ }
+
+ public UserRoleRef() {
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/enums/CommonParamsEnum.java b/src/main/java/com/example/hotel/enums/CommonParamsEnum.java
new file mode 100644
index 0000000..924ca59
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/CommonParamsEnum.java
@@ -0,0 +1,37 @@
+package com.example.hotel.enums;
+
+/**
+ * 常用数字
+ */
+public enum CommonParamsEnum {
+
+ /**
+ * 数字10
+ */
+ TEN(10),
+
+ /**
+ * 数字5
+ */
+ FIVE(5),
+
+ /**
+ * 数字404
+ */
+ NOT_FOUND(404),
+
+ /**
+ * 数字1024
+ */
+ BYTE(1024);
+
+ private Integer value;
+
+ CommonParamsEnum(Integer value) {
+ this.value = value;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/OrderStatusEnum.java b/src/main/java/com/example/hotel/enums/OrderStatusEnum.java
new file mode 100644
index 0000000..3a9f7de
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/OrderStatusEnum.java
@@ -0,0 +1,40 @@
+package com.example.hotel.enums;
+
+/**
+ *
+ * 订单状态enum
+ *
+ */
+public enum OrderStatusEnum {
+
+ /**
+ * 待支付
+ */
+ NOT_PAY(0),
+
+ /**
+ * 已支付
+ */
+ HAS_PAY(1),
+
+ /**
+ * 已完结
+ */
+ FINISHED(2),
+
+ /**
+ * 已关闭
+ */
+ CLOSED(3);
+
+ private Integer code;
+
+ OrderStatusEnum(Integer code) {
+ this.code = code;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/enums/PostIsRecommendEnum.java b/src/main/java/com/example/hotel/enums/PostIsRecommendEnum.java
new file mode 100644
index 0000000..7242eaf
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/PostIsRecommendEnum.java
@@ -0,0 +1,27 @@
+package com.example.hotel.enums;
+
+/**
+ * 客房推荐枚举
+ */
+public enum PostIsRecommendEnum {
+
+ /**
+ * 真
+ */
+ TRUE(1),
+
+ /**
+ * 假
+ */
+ FALSE(0);
+
+ private Integer value;
+
+ PostIsRecommendEnum(Integer value) {
+ this.value = value;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/PostIsStickyEnum.java b/src/main/java/com/example/hotel/enums/PostIsStickyEnum.java
new file mode 100644
index 0000000..6cd1ec7
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/PostIsStickyEnum.java
@@ -0,0 +1,27 @@
+package com.example.hotel.enums;
+
+/**
+ * 客房置顶枚举
+ */
+public enum PostIsStickyEnum {
+
+ /**
+ * 真
+ */
+ TRUE(1),
+
+ /**
+ * 假
+ */
+ FALSE(0);
+
+ private Integer value;
+
+ PostIsStickyEnum(Integer value) {
+ this.value = value;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/PostStatusEnum.java b/src/main/java/com/example/hotel/enums/PostStatusEnum.java
new file mode 100644
index 0000000..245ebbb
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/PostStatusEnum.java
@@ -0,0 +1,38 @@
+package com.example.hotel.enums;
+
+/**
+ *
+ * 客房状态enum
+ *
+ *
+ * @author : saysky
+ * @date : 2018/7/1
+ */
+public enum PostStatusEnum {
+
+ /**
+ * 正常
+ */
+ PUBLISHED(0),
+
+ /**
+ * 下架
+ */
+ DRAFT(1),
+
+ /**
+ * 回收站
+ */
+ RECYCLE(2);
+
+ private Integer code;
+
+ PostStatusEnum(Integer code) {
+ this.code = code;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/enums/PostTypeEnum.java b/src/main/java/com/example/hotel/enums/PostTypeEnum.java
new file mode 100644
index 0000000..7f6721f
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/PostTypeEnum.java
@@ -0,0 +1,37 @@
+package com.example.hotel.enums;
+
+/**
+ *
+ * 客房类型enum
+ *
+ *
+ * @author : saysky
+ * @date : 2018/7/1
+ */
+public enum PostTypeEnum {
+
+ /**
+ * 客房
+ */
+ POST_TYPE_POST("post"),
+
+ /**
+ * 页面
+ */
+ POST_TYPE_PAGE("page"),
+
+ /**
+ * 公告
+ */
+ POST_TYPE_NOTICE("notice");
+
+ private String value;
+
+ PostTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/ResourceTypeEnum.java b/src/main/java/com/example/hotel/enums/ResourceTypeEnum.java
new file mode 100644
index 0000000..b55a12a
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/ResourceTypeEnum.java
@@ -0,0 +1,48 @@
+package com.example.hotel.enums;
+
+/**
+ * 资源类型
+ */
+public enum ResourceTypeEnum {
+
+ /**
+ * 菜单
+ */
+ MENU("menu", "菜单"),
+
+ /**
+ * 接口
+ */
+ BUTTON("button", "接口"),
+
+ /**
+ * 菜单
+ */
+ PAGE("page", "页面");
+
+
+ private String code;
+
+ private String description;
+
+ ResourceTypeEnum(String code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/ResultCodeEnum.java b/src/main/java/com/example/hotel/enums/ResultCodeEnum.java
new file mode 100644
index 0000000..18d2437
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/ResultCodeEnum.java
@@ -0,0 +1,27 @@
+package com.example.hotel.enums;
+
+/**
+ * 返回结果enum
+ */
+public enum ResultCodeEnum {
+
+ /**
+ * 成功
+ */
+ SUCCESS(1),
+
+ /**
+ * 失败
+ */
+ FAIL(0);
+
+ Integer code;
+
+ ResultCodeEnum(Integer code) {
+ this.code = code;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/RoleEnum.java b/src/main/java/com/example/hotel/enums/RoleEnum.java
new file mode 100644
index 0000000..0a79aca
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/RoleEnum.java
@@ -0,0 +1,35 @@
+package com.example.hotel.enums;
+
+/**
+ *
+ * 角色枚举
+ *
+ *
+ */
+public enum RoleEnum {
+
+ /**
+ * 管理员
+ */
+ ADMIN("admin"),
+
+ /**
+ * 客户
+ */
+ CUSTOMER("customer"),
+
+ /**
+ * 工作人员
+ */
+ WORKER("worker");
+
+ private String value;
+
+ RoleEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/TrueFalseEnum.java b/src/main/java/com/example/hotel/enums/TrueFalseEnum.java
new file mode 100644
index 0000000..6c9e852
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/TrueFalseEnum.java
@@ -0,0 +1,27 @@
+package com.example.hotel.enums;
+
+/**
+ * true or false enum
+ */
+public enum TrueFalseEnum {
+
+ /**
+ * 真
+ */
+ TRUE("true"),
+
+ /**
+ * 假
+ */
+ FALSE("false");
+
+ private String value;
+
+ TrueFalseEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/com/example/hotel/enums/UserStatusEnum.java b/src/main/java/com/example/hotel/enums/UserStatusEnum.java
new file mode 100644
index 0000000..40c2628
--- /dev/null
+++ b/src/main/java/com/example/hotel/enums/UserStatusEnum.java
@@ -0,0 +1,28 @@
+package com.example.hotel.enums;
+
+/**
+ * 用户状态enum
+ */
+public enum UserStatusEnum {
+
+ /**
+ * 正常
+ */
+ NORMAL(0),
+
+ /**
+ * 禁止登录
+ */
+ BAN(1);
+
+
+ private Integer code;
+
+ UserStatusEnum(Integer code) {
+ this.code = code;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/com/example/hotel/exception/GlobalExceptionHandler.java b/src/main/java/com/example/hotel/exception/GlobalExceptionHandler.java
new file mode 100644
index 0000000..af86e99
--- /dev/null
+++ b/src/main/java/com/example/hotel/exception/GlobalExceptionHandler.java
@@ -0,0 +1,242 @@
+package com.example.hotel.exception;
+
+import com.example.hotel.dto.JsonResult;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindException;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+import org.springframework.web.HttpMediaTypeNotSupportedException;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.NoHandlerFoundException;
+import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import javax.validation.ValidationException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 全局异常捕获
+ */
+
+@ControllerAdvice
+@Slf4j
+public class GlobalExceptionHandler {
+
+ //错误显示页面
+ public static final String viewName = "common/error/error";
+
+ /**
+ * 是否是ajax请求
+ */
+ public static boolean isAjax(HttpServletRequest httpRequest) {
+ return (httpRequest.getHeader("X-Requested-With") != null
+ && "XMLHttpRequest"
+ .equals(httpRequest.getHeader("X-Requested-With").toString()));
+ }
+
+
+ /**
+ * 400 - Bad Request
+ */
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(MissingServletRequestParameterException.class)
+ public String handleMissingServletRequestParameterException(MissingServletRequestParameterException e, Model model) {
+ log.error("缺少请求参数", e);
+ String message = "【缺少请求参数】" + e.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 400);
+ return viewName;
+ }
+
+ /**
+ * 400 - Bad Request
+ */
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(HttpMessageNotReadableException.class)
+ public String handleHttpMessageNotReadableException(HttpMessageNotReadableException e, Model model) {
+ log.error("参数解析失败", e);
+ String message = "【参数解析失败】" + e.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 400);
+ return viewName;
+ }
+
+ /**
+ * 400 - Bad Request
+ */
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(MethodArgumentNotValidException.class)
+ public String handleMethodArgumentNotValidException(MethodArgumentNotValidException e, Model model) {
+ log.error("参数验证失败", e);
+ BindingResult result = e.getBindingResult();
+ FieldError error = result.getFieldError();
+ String field = error.getField();
+ String code = error.getDefaultMessage();
+ String message = "【参数验证失败】" + String.format("%s:%s", field, code);
+ model.addAttribute("message", message);
+ model.addAttribute("code", 400);
+ return viewName;
+ }
+
+ /**
+ * 400 - Bad Request
+ */
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(BindException.class)
+ public String handleBindException(BindException e, Model model) {
+ log.error("参数绑定失败", e);
+ BindingResult result = e.getBindingResult();
+ FieldError error = result.getFieldError();
+ String field = error.getField();
+ String code = error.getDefaultMessage();
+ String message = "【参数绑定失败】" + String.format("%s:%s", field, code);
+
+ model.addAttribute("message", message);
+ model.addAttribute("code", 400);
+ return viewName;
+ }
+
+
+ /**
+ * 400 - Bad Request
+ */
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(ConstraintViolationException.class)
+ public String handleServiceException(ConstraintViolationException e, Model model) {
+ log.error("参数验证失败", e);
+ Set> violations = e.getConstraintViolations();
+ ConstraintViolation> violation = violations.iterator().next();
+ String message = "【参数验证失败】" + violation.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 400);
+ return viewName;
+ }
+
+ /**
+ * 400 - Bad Request
+ */
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(ValidationException.class)
+ public String handleValidationException(ValidationException e, Model model) {
+ log.error("参数验证失败", e);
+ String message = "【参数验证失败】" + e.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 400);
+ return viewName;
+ }
+
+ /**
+ * 404 - Not Found
+ */
+ @ResponseStatus(HttpStatus.NOT_FOUND)
+ @ExceptionHandler(NoHandlerFoundException.class)
+ public String noHandlerFoundException(NoHandlerFoundException e, Model model) {
+ log.error("Not Found", e);
+ String message = "【页面不存在】" + e.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 404);
+ return viewName;
+ }
+
+
+ /**
+ * 405 - Method Not Allowed
+ */
+ @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)
+ @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
+ public String handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e, Model model) {
+ log.error("不支持当前请求方法", e);
+ String message = "【不支持当前请求方法】" + e.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 405);
+ return viewName;
+ }
+
+ /**
+ * 415 - Unsupported Media Type
+ */
+ @ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
+ @ExceptionHandler(HttpMediaTypeNotSupportedException.class)
+ public String handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e, Model model) {
+ log.error("不支持当前媒体类型", e);
+ String message = "【不支持当前媒体类型】" + e.getMessage();
+ model.addAttribute("message", message);
+ model.addAttribute("code", 415);
+ return viewName;
+ }
+
+ /**
+ * 统一异常处理
+ *
+ * @param response
+ * @param e
+ * @return
+ */
+ @ExceptionHandler(MyBusinessException.class)
+ @ResponseBody
+ public JsonResult processApiException(HttpServletResponse response,
+ MyBusinessException e) {
+ JsonResult result = new JsonResult(0, e.getMessage());
+ response.setStatus(200);
+ response.setContentType("application/json;charset=UTF-8");
+ log.error("业务异常,提示前端操作不合法", e.getMessage(), e);
+ return result;
+ }
+
+ /**
+ * 获取其它异常。包括500
+ *
+ * @param e
+ * @return
+ * @throws Exception
+ */
+ @ExceptionHandler(value = Exception.class)
+ public ModelAndView defaultErrorHandler(HttpServletRequest request,
+ HttpServletResponse response,
+ Exception e, Model model) throws IOException {
+ e.printStackTrace();
+
+ if (isAjax(request)) {
+ ModelAndView mav = new ModelAndView();
+ MappingJackson2JsonView view = new MappingJackson2JsonView();
+ Map attributes = new HashMap();
+ if (e instanceof UnauthorizedException) {
+ attributes.put("msg", "没有权限");
+ } else {
+ attributes.put("msg", e.getMessage());
+ }
+ attributes.put("code", "0");
+ view.setAttributesMap(attributes);
+ mav.setView(view);
+ return mav;
+ }
+
+ if (e instanceof UnauthorizedException) {
+ //请登录
+ log.error("无权访问", e);
+ return new ModelAndView("common/error/403");
+ }
+ //其他异常
+ String message = e.getMessage();
+ model.addAttribute("code", 500);
+ model.addAttribute("message", message);
+ return new ModelAndView("common/error/500");
+ }
+}
diff --git a/src/main/java/com/example/hotel/exception/MyBusinessException.java b/src/main/java/com/example/hotel/exception/MyBusinessException.java
new file mode 100644
index 0000000..d137f36
--- /dev/null
+++ b/src/main/java/com/example/hotel/exception/MyBusinessException.java
@@ -0,0 +1,45 @@
+package com.example.hotel.exception;
+
+/**
+ * @author 言曌
+ * @date 2019-08-09 16:47
+ */
+
+public class MyBusinessException extends RuntimeException {
+
+ private Integer code;
+
+ private String message;
+
+
+ public MyBusinessException() {
+ super();
+ }
+
+ public MyBusinessException(String message) {
+ this.code = 500;
+ this.message = message;
+ }
+
+ public MyBusinessException(Integer code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public void setCode(Integer code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/src/main/java/com/example/hotel/mapper/CategoryMapper.java b/src/main/java/com/example/hotel/mapper/CategoryMapper.java
new file mode 100644
index 0000000..1a290de
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/CategoryMapper.java
@@ -0,0 +1,31 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Category;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author liuyanzhao
+ */
+@Mapper
+public interface CategoryMapper extends BaseMapper {
+
+ /**
+ * 获得子分类Id列表
+ *
+ * @param pathTrace /138/ 这种格式
+ * @return 子分类Id列表
+ */
+ List selectChildCateIds(@Param("pathTrace") String pathTrace);
+
+ /**
+ * 根据用户ID删除
+ * @param userId
+ * @return
+ */
+ Integer deleteByUserId(Long userId);
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/OrderMapper.java b/src/main/java/com/example/hotel/mapper/OrderMapper.java
new file mode 100644
index 0000000..0dfec57
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/OrderMapper.java
@@ -0,0 +1,40 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.dto.PostQueryCondition;
+import com.example.hotel.entity.Order;
+import com.example.hotel.entity.Post;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author liuyanzhao
+ */
+@Mapper
+public interface OrderMapper extends BaseMapper {
+
+ /**
+ * 根据时间范围查询订单
+ *
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ List findAll(@Param("startDate") String startDate,
+ @Param("endDate") String endDate,
+ Page page);
+
+ /**
+ * 根据时间范围查询总金额
+ *
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ Integer getTotalPriceSum(@Param("startDate") String startDate,
+ @Param("endDate") String endDate);
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/PermissionMapper.java b/src/main/java/com/example/hotel/mapper/PermissionMapper.java
new file mode 100644
index 0000000..9c2ff1c
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/PermissionMapper.java
@@ -0,0 +1,73 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Permission;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * @author example
+ */
+@Mapper
+public interface PermissionMapper extends BaseMapper {
+
+ /**
+ * 根据角色Id获得权限列表
+ *
+ * @param roleId 角色Id
+ * @return 权限列表
+ */
+ List findByRoleId(Long roleId);
+
+ /**
+ * 获得某个用户的权限列表
+ *
+ * @param userId
+ * @return
+ */
+ List findPermissionByUserId(Long userId);
+
+ /**
+ * 获得某个用户的权限列表
+ *
+ * @param userId
+ * @param resourceType
+ * @return
+ */
+ List findPermissionByUserIdAndResourceType(@Param("userId") Long userId,
+ @Param("resourceType") String resourceType);
+
+
+ /**
+ * 获得权限列表
+ *
+ * @param resourceType
+ * @return
+ */
+ List findPermissionByResourceType(Integer resourceType);
+
+ /**
+ * 根据角色ID获得权限列表
+ * @param roleId
+ * @return
+ */
+ List findPermissionByRoleId(Long roleId);
+
+ /**
+ * 统计子节点数量
+ * @param id
+ * @return
+ */
+ Integer countChildPermission(Long id);
+
+ /**
+ * 根据URL获得权限
+ * @param url
+ * @return
+ */
+ Permission findByUrl(String url);
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/PostMapper.java b/src/main/java/com/example/hotel/mapper/PostMapper.java
new file mode 100644
index 0000000..adccaf0
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/PostMapper.java
@@ -0,0 +1,36 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.dto.PostQueryCondition;
+import com.example.hotel.entity.Post;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author liuyanzhao
+ */
+@Mapper
+public interface PostMapper extends BaseMapper {
+
+ /**
+ * 根据标签ID查询客房
+ *
+ * @param condition
+ * @param page
+ * @return
+ */
+ List findPostByCondition(@Param("condition") PostQueryCondition condition, Page page);
+
+ /**
+ * 统计该分类的客房
+ * @param cateId
+ * @return
+ */
+ Integer countPostByCateId(Long cateId);
+
+
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/RecordMapper.java b/src/main/java/com/example/hotel/mapper/RecordMapper.java
new file mode 100644
index 0000000..64afc39
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/RecordMapper.java
@@ -0,0 +1,44 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Record;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author liuyanzhao
+ */
+@Mapper
+public interface RecordMapper extends BaseMapper {
+
+ /**
+ * 根据房间ID和日期列表查询预定
+ *
+ * @param postId
+ * @param dateList
+ * @return
+ */
+ List findByPostIdAndRecordDate(@Param("postId") Long postId,
+ @Param("list") List dateList);
+
+ /**
+ * 获得某个房间的预定记录
+ * @param postId
+ * @return
+ */
+ List findByPostId(Long postId);
+
+ /**
+ * 删除
+ * @param postId
+ * @param userId
+ * @param dateList
+ * @return
+ */
+ Integer delete(@Param("postId") Long postId,
+ @Param("userId") Long userId,
+ @Param("list") List dateList);
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/RoleMapper.java b/src/main/java/com/example/hotel/mapper/RoleMapper.java
new file mode 100644
index 0000000..6d9b43d
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/RoleMapper.java
@@ -0,0 +1,69 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Role;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+
+/**
+ * @author example
+ */
+@Mapper
+public interface RoleMapper extends BaseMapper {
+
+
+ /**
+ * 根据用户Id获得角色
+ *
+ * @param userId 用户Id
+ * @return 角色列表
+ */
+ Role findByUserId(Long userId);
+
+
+ /**
+ * 删除用户和角色管理
+ *
+ * @param userId 用户ID
+ * @return 影响行数
+ */
+ Integer deleteByUserId(Long userId);
+
+ /**
+ * 统计某个角色的用户数
+ *
+ * @param roleId 角色Id
+ * @return 用户数
+ */
+ Integer countUserByRoleId(Long roleId);
+
+
+ /**
+ * 获得所有角色和对应用户数量
+ * @return
+ */
+ List findAllWithCount();
+
+ /**
+ * 查询小于等于该等级的角色
+ * @param level
+ * @return
+ */
+ List findByLessThanLevel(Integer level);
+
+ /**
+ * 查询某个用户最大的角色等级
+ * @param userId
+ * @return
+ */
+ Integer findMaxLevelByUserId(Long userId);
+
+ /**
+ * 获得用户注册默认角色
+ * @return
+ */
+ Role findDefaultRole();
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/RolePermissionRefMapper.java b/src/main/java/com/example/hotel/mapper/RolePermissionRefMapper.java
new file mode 100644
index 0000000..8068f09
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/RolePermissionRefMapper.java
@@ -0,0 +1,40 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.RolePermissionRef;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+
+/**
+ * @author example
+ */
+@Mapper
+public interface RolePermissionRefMapper extends BaseMapper {
+
+
+ /**
+ * 根据角色Id删除
+ *
+ * @param roleId 角色Id
+ * @return 影响行数
+ */
+ Integer deleteByRoleId(Long roleId);
+
+ /**
+ * 根据权限Id删除
+ *
+ * @param permissionId 权限Id
+ * @return 影响行数
+ */
+ Integer deleteByPermissionId(Long permissionId);
+ /**
+ * 批量添加
+ *
+ * @param rolePermissionRefList 列表
+ * @return 影响喊你高数
+ */
+ Integer batchInsert(List rolePermissionRefList);
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/UserMapper.java b/src/main/java/com/example/hotel/mapper/UserMapper.java
new file mode 100644
index 0000000..4cbc8b7
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/UserMapper.java
@@ -0,0 +1,74 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.entity.User;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author example
+ */
+@Mapper
+public interface UserMapper extends BaseMapper {
+
+ /**
+ * 根据角色Id获得用户
+ *
+ * @param roleId 角色Id
+ * @param page 分页信息
+ * @return 用户列表
+ */
+ List findByRoleId(@Param("roleId") Long roleId, Page page);
+
+ /**
+ * 根据角色Id和条件获得用户
+ *
+ * @param roleId 角色Id
+ * @param user 条件
+ * @param page 分页信息
+ * @return 用户列表
+ */
+ List findByRoleIdAndCondition(@Param("roleId") Long roleId,
+ @Param("user") User user, Page page);
+
+ /**
+ * 根据条件查询
+ *
+ * @param user 用户
+ * @param page 分页
+ * @return 用户列表
+ */
+ List findByCondition( @Param("user") User user, Page page);
+
+ /**
+ * 获得今日新增数量
+ * @return
+ */
+ Integer getTodayCount();
+
+ /**
+ * 获得用户客房数排名
+ * @param limit 查询数量
+ * @return
+ */
+ List getUserPostRanking(Integer limit);
+
+ /**
+ * 获得最新注册用户
+ * @param limit
+ * @return
+ */
+ List getLatestUser(Integer limit);
+
+ /**
+ * 获得热门用户
+ * @param limit 用户数量
+ * @return
+ */
+ List getHotUsers(Integer limit);
+
+}
+
diff --git a/src/main/java/com/example/hotel/mapper/UserRoleRefMapper.java b/src/main/java/com/example/hotel/mapper/UserRoleRefMapper.java
new file mode 100644
index 0000000..a840a80
--- /dev/null
+++ b/src/main/java/com/example/hotel/mapper/UserRoleRefMapper.java
@@ -0,0 +1,21 @@
+package com.example.hotel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.UserRoleRef;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author example
+ */
+@Mapper
+public interface UserRoleRefMapper extends BaseMapper {
+
+ /**
+ * 根据用户Id删除
+ *
+ * @param userId 用户Id
+ * @return 影响行数
+ */
+ Integer deleteByUserId(Long userId);
+}
+
diff --git a/src/main/java/com/example/hotel/service/CategoryService.java b/src/main/java/com/example/hotel/service/CategoryService.java
new file mode 100755
index 0000000..710d394
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/CategoryService.java
@@ -0,0 +1,50 @@
+package com.example.hotel.service;
+
+
+import com.example.hotel.common.base.BaseService;
+import com.example.hotel.entity.Category;
+
+import java.util.List;
+
+/**
+ *
+ * 分类业务逻辑接口
+ *
+ *
+ * @author : saysky
+ * @date : 2017/11/30
+ */
+public interface CategoryService extends BaseService {
+
+ /**
+ * 查询所有分类目录,带count和根据level封装name
+ *
+ * @return 返回List集合
+ */
+ List findByUserId(Long userId);
+
+ /**
+ * 获得某个分类的所有客房数
+ *
+ * @param cateId 分类Id
+ * @return 客房数
+ */
+ Integer countPostByCateId(Long cateId);
+
+ /**
+ * 根据用户ID删除
+ *
+ * @param userId
+ * @return
+ */
+ Integer deleteByUserId(Long userId);
+
+ /**
+ * 将分类ID列表转成分类
+ *
+ * @param cateIds
+ * @param userId
+ * @return
+ */
+ List cateIdsToCateList(List cateIds, Long userId);
+}
diff --git a/src/main/java/com/example/hotel/service/MailService.java b/src/main/java/com/example/hotel/service/MailService.java
new file mode 100755
index 0000000..145475e
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/MailService.java
@@ -0,0 +1,22 @@
+package com.example.hotel.service;
+
+
+import javax.mail.MessagingException;
+
+/**
+ *
+ * 邮件发送业务逻辑接口
+ *
+ */
+public interface MailService {
+
+ /**
+ * 发送邮件
+ *
+ * @param to 接收者
+ * @param title 标题
+ * @param content 内容
+ */
+ void sendMail(String to, String title, String content) throws MessagingException;
+
+}
diff --git a/src/main/java/com/example/hotel/service/OrderService.java b/src/main/java/com/example/hotel/service/OrderService.java
new file mode 100644
index 0000000..9f8320a
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/OrderService.java
@@ -0,0 +1,35 @@
+package com.example.hotel.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.common.base.BaseService;
+import com.example.hotel.entity.Order;
+import com.example.hotel.entity.User;
+
+import java.util.List;
+
+/**
+ * 订单
+ *
+ * @author 言曌
+ * @date 2020/4/6 2:00 下午
+ */
+public interface OrderService extends BaseService {
+
+ /**
+ * 根据时间范围查询总金额
+ *
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ Integer getTotalPriceSum(String startDate, String endDate);
+
+ /**
+ * 根据时间范围查询
+ * @param startDate
+ * @param endDate
+ * @param page
+ * @return
+ */
+ Page findAll(String startDate, String endDate, Page page);
+}
diff --git a/src/main/java/com/example/hotel/service/PermissionService.java b/src/main/java/com/example/hotel/service/PermissionService.java
new file mode 100644
index 0000000..134e92d
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/PermissionService.java
@@ -0,0 +1,65 @@
+package com.example.hotel.service;
+
+import com.example.hotel.entity.Permission;
+import com.example.hotel.common.base.BaseService;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 权限逻辑接口
+ */
+public interface PermissionService extends BaseService {
+
+ /**
+ * 根据角色Id获得权限列表
+ *
+ * @param roleId 角色Id
+ * @return 权限列表
+ */
+ List listPermissionsByRoleId(Long roleId);
+
+ /**
+ * 获得某个用户的权限URL列表
+ *
+ * @param userId
+ * @return
+ */
+ Set findPermissionUrlsByUserId(Long userId);
+
+ /**
+ * 获得某个用户的用户ID和资源类型
+ *
+ * @param userId
+ * @param resourceType
+ * @return
+ */
+ List findPermissionTreeByUserIdAndResourceType(Long userId, String resourceType);
+
+ /**
+ * 根据角色ID获得权限列表
+ * @param roleId
+ * @return
+ */
+ List findPermissionByRoleId(Long roleId);
+
+ /**
+ * 获得所有权限,带有等级
+ * @return
+ */
+ List findPermissionListWithLevel();
+
+ /**
+ * 统计子节点数量
+ * @param id
+ * @return
+ */
+ Integer countChildPermission(Long id);
+
+ /**
+ * 根据URL获得权限
+ * @param url
+ * @return
+ */
+ Permission findByUrl(String url);
+}
diff --git a/src/main/java/com/example/hotel/service/PostService.java b/src/main/java/com/example/hotel/service/PostService.java
new file mode 100755
index 0000000..95e00d8
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/PostService.java
@@ -0,0 +1,24 @@
+package com.example.hotel.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.common.base.BaseService;
+import com.example.hotel.dto.PostQueryCondition;
+import com.example.hotel.entity.Post;
+
+/**
+ *
+ * 记录/页面业务逻辑接口
+ *
+ */
+public interface PostService extends BaseService {
+
+ /**
+ * 根据条件获得列表
+ * @param condition
+ * @return
+ */
+ Page findPostByCondition(PostQueryCondition condition, Page page);
+
+
+
+}
diff --git a/src/main/java/com/example/hotel/service/RecordService.java b/src/main/java/com/example/hotel/service/RecordService.java
new file mode 100644
index 0000000..4cbee1e
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/RecordService.java
@@ -0,0 +1,39 @@
+package com.example.hotel.service;
+
+import com.example.hotel.common.base.BaseService;
+import com.example.hotel.entity.Record;
+
+import java.util.List;
+
+/**
+ * 预定
+ * @author 言曌
+ * @date 2020/4/6 2:00 下午
+ */
+public interface RecordService extends BaseService {
+
+ /**
+ * 根据房间ID和日期列表查询预定
+ *
+ * @param postId
+ * @param dateList
+ * @return
+ */
+ List findByPostIdAndRecordDate( Long postId, List dateList);
+
+ /**
+ * 获得某个房间的预定记录
+ * @param postId
+ * @return
+ */
+ List findByPostId(Long postId);
+
+ /**
+ * 删除
+ * @param postId
+ * @param userId
+ * @param dateList
+ * @return
+ */
+ Integer delete(Long postId, Long userId, List dateList);
+}
diff --git a/src/main/java/com/example/hotel/service/RolePermissionRefService.java b/src/main/java/com/example/hotel/service/RolePermissionRefService.java
new file mode 100644
index 0000000..05713a7
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/RolePermissionRefService.java
@@ -0,0 +1,32 @@
+package com.example.hotel.service;
+
+import com.example.hotel.entity.RolePermissionRef;
+
+import java.util.List;
+
+
+public interface RolePermissionRefService {
+
+ /**
+ * 删除某个角色的所有关联
+ *
+ * @param roleId 角色Id
+ */
+ void deleteRefByRoleId(Long roleId);
+
+ /**
+ * 添加角色和权限关联
+ *
+ * @param rolePermissionRef RolePermissionRef
+ * @return UserRoleRef
+ */
+ void saveByRolePermissionRef(RolePermissionRef rolePermissionRef);
+
+ /**
+ * 批量添加
+ *
+ * @param rolePermissionRefs 列表
+ */
+ void batchSaveByRolePermissionRef(List rolePermissionRefs);
+
+}
diff --git a/src/main/java/com/example/hotel/service/RoleService.java b/src/main/java/com/example/hotel/service/RoleService.java
new file mode 100755
index 0000000..2731807
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/RoleService.java
@@ -0,0 +1,77 @@
+package com.example.hotel.service;
+
+import com.example.hotel.entity.Role;
+import com.example.hotel.common.base.BaseService;
+
+import java.util.List;
+
+/**
+ * 角色逻辑接口
+ */
+public interface RoleService extends BaseService {
+
+ /**
+ * 删除某个用户的所有关联
+ *
+ * @param userId 用户Id
+ */
+ void deleteByUserId(Long userId);
+
+ /**
+ * 根据编号查询单个权限
+ *
+ * @param roleId roleId
+ * @return Role
+ */
+ Role findByRoleId(Long roleId);
+
+ /**
+ * 根据编号查询单个权限
+ *
+ * @param roleName roleName
+ * @return Role
+ */
+ Role findByRoleName(String roleName);
+
+ /**
+ * 根据用户Id获得角色
+ *
+ * @param userId 用户Id
+ * @return 角色列表
+ */
+ Role findByUserId(Long userId);
+
+ /**
+ * 统计这个角色的用户数
+ *
+ * @param roleId 角色Id
+ */
+ Integer countUserByRoleId(Long roleId);
+
+ /**
+ * 查询某个用户最大的角色等级
+ * @param userId
+ * @return
+ */
+ Integer findMaxLevelByUserId(Long userId);
+
+ /**
+ * 查询小于等于该等级的角色
+ * @param level
+ * @return
+ */
+ List findByLessThanLevel(Integer level);
+
+ /**
+ * 获得用户注册默认角色
+ * @return
+ */
+ Role findDefaultRole();
+
+ /**
+ * 获得用户注册默认角色
+ * @return
+ */
+ Role getMaxRoleByUserId(Long userId);
+
+}
diff --git a/src/main/java/com/example/hotel/service/UserRoleRefService.java b/src/main/java/com/example/hotel/service/UserRoleRefService.java
new file mode 100644
index 0000000..6a4a760
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/UserRoleRefService.java
@@ -0,0 +1,17 @@
+package com.example.hotel.service;
+
+import com.example.hotel.entity.UserRoleRef;
+import com.example.hotel.common.base.BaseService;
+
+
+public interface UserRoleRefService extends BaseService {
+
+ /**
+ * 根据用户Id删除
+ *
+ * @param userId 用户Id
+ */
+ void deleteByUserId(Long userId);
+
+
+}
diff --git a/src/main/java/com/example/hotel/service/UserService.java b/src/main/java/com/example/hotel/service/UserService.java
new file mode 100755
index 0000000..6712f59
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/UserService.java
@@ -0,0 +1,49 @@
+package com.example.hotel.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.common.base.BaseService;
+import com.example.hotel.entity.User;
+
+import java.util.List;
+
+/**
+ * 用户业务逻辑接口
+ */
+public interface UserService extends BaseService {
+
+ /**
+ * 根据手机号获得用户
+ *
+ * @param userName 手机号
+ * @return 用户
+ */
+ User findByUserName(String userName);
+
+
+ /**
+ * 根据身份证号码查找用户
+ *
+ * @param idCard 身份证号码
+ * @return User
+ */
+ User findByIdCard(String idCard);
+
+ /**
+ * 更新密码
+ *
+ * @param userId 用户Id
+ * @param password 密码
+ */
+ void updatePassword(Long userId, String password);
+
+ /**
+ * 分页获取所有用户
+ *
+ * @param roleName 角色名称
+ * @param condition 查询条件
+ * @param page 分页信息
+ * @return 用户列表
+ */
+ Page findByRoleAndCondition(String roleName, User condition, Page page);
+
+}
diff --git a/src/main/java/com/example/hotel/service/impl/CategoryServiceImpl.java b/src/main/java/com/example/hotel/service/impl/CategoryServiceImpl.java
new file mode 100755
index 0000000..29d0157
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/CategoryServiceImpl.java
@@ -0,0 +1,112 @@
+package com.example.hotel.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Category;
+import com.example.hotel.mapper.CategoryMapper;
+import com.example.hotel.mapper.PostMapper;
+import com.example.hotel.service.CategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * 分类业务逻辑实现类
+ *
+ *
+ */
+@Service
+public class CategoryServiceImpl implements CategoryService {
+
+ @Autowired
+ private CategoryMapper categoryMapper;
+
+ @Autowired
+ private PostMapper postMapper;
+
+ @Override
+ public BaseMapper getRepository() {
+ return categoryMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(Category category) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (category != null) {
+ if (StrUtil.isNotBlank(category.getCateName())) {
+ queryWrapper.like("cate_name", category.getCateName());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public Category insert(Category category) {
+ categoryMapper.insert(category);
+ return category;
+ }
+
+ @Override
+ public Category update(Category category) {
+ categoryMapper.updateById(category);
+ return category;
+ }
+
+ @Override
+ public void delete(Long id) {
+ //2.删除分类
+ categoryMapper.deleteById(id);
+ }
+
+
+ @Override
+ public List findByUserId(Long userId) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("user_id", userId);
+ return categoryMapper.selectList(queryWrapper);
+ }
+
+
+ @Override
+ public Integer countPostByCateId(Long cateId) {
+ return postMapper.countPostByCateId(cateId);
+ }
+
+ @Override
+ public Category insertOrUpdate(Category entity) {
+ if (entity.getId() == null) {
+ insert(entity);
+ } else {
+ update(entity);
+ }
+ return entity;
+ }
+
+ @Override
+ public Integer deleteByUserId(Long userId) {
+ return categoryMapper.deleteByUserId(userId);
+ }
+
+ @Override
+ public List cateIdsToCateList(List cateIds, Long userId) {
+ List categoryList = this.findByUserId(userId);
+ List allCateIds = categoryList.stream().map(Category::getId).collect(Collectors.toList());
+ List result = new ArrayList<>();
+ for(Long id : cateIds) {
+ if(allCateIds.contains(id)) {
+ Category category = new Category();
+ category.setId(id);
+ result.add(category);
+ }
+ }
+ return result;
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/service/impl/MailServiceImpl.java b/src/main/java/com/example/hotel/service/impl/MailServiceImpl.java
new file mode 100755
index 0000000..4ee510c
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/MailServiceImpl.java
@@ -0,0 +1,51 @@
+package com.example.hotel.service.impl;
+
+import com.example.hotel.service.MailService;
+import com.example.hotel.util.SensUtils;
+import io.github.biezhi.ome.OhMyEmail;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.mail.MessagingException;
+
+/**
+ *
+ * 邮件发送业务逻辑实现类
+ *
+ *
+ * @author : saysky
+ * @date : 2018/1/23
+ */
+@Service
+public class MailServiceImpl implements MailService {
+
+ @Value("${mail.smtp.host}")
+ private String host;
+
+ @Value("${mail.smtp.username}")
+ private String username;
+
+ @Value("${mail.smtp.password}")
+ private String password;
+
+ @Value("${mail.from.name}")
+ private String fromName;
+
+ /**
+ * 发送邮件
+ *
+ * @param to to 接收者
+ * @param title subject 标题
+ * @param content content 内容
+ */
+ @Override
+ public void sendMail(String to, String title, String content) throws MessagingException {
+ //配置邮件服务器
+ SensUtils.configMail(host, username, password);
+ OhMyEmail.subject(title)
+ .from(fromName)
+ .to(to)
+ .text(content)
+ .send();
+ }
+}
diff --git a/src/main/java/com/example/hotel/service/impl/OrderServiceImpl.java b/src/main/java/com/example/hotel/service/impl/OrderServiceImpl.java
new file mode 100644
index 0000000..4ae7794
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/OrderServiceImpl.java
@@ -0,0 +1,62 @@
+package com.example.hotel.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.entity.Order;
+import com.example.hotel.entity.User;
+import com.example.hotel.mapper.OrderMapper;
+import com.example.hotel.service.OrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author 言曌
+ * @date 2020/4/6 2:01 下午
+ */
+@Service
+public class OrderServiceImpl implements OrderService {
+
+ @Autowired
+ private OrderMapper orderMapper;
+
+ @Override
+ public BaseMapper getRepository() {
+ return orderMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(Order order) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (order != null) {
+ if (order.getUserId() != null) {
+ queryWrapper.eq("user_id", order.getUserId());
+ }
+ if (order.getPostId() != null) {
+ queryWrapper.eq("post_id", order.getPostId());
+ }
+ if (StrUtil.isNotBlank(order.getPhone())) {
+ queryWrapper.eq("phone", order.getPhone());
+ }
+ if (order.getStatus() != null) {
+ queryWrapper.eq("status", order.getStatus());
+ }
+ if (order.getStartDate() != null) {
+ queryWrapper.eq("start_date", order.getStartDate());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public Integer getTotalPriceSum(String startDate, String endDate) {
+ return orderMapper.getTotalPriceSum(startDate, endDate);
+ }
+
+ @Override
+ public Page findAll(String startDate, String endDate, Page page) {
+ return page.setRecords(orderMapper.findAll(startDate, endDate, page));
+ }
+}
diff --git a/src/main/java/com/example/hotel/service/impl/PermissionServiceImpl.java b/src/main/java/com/example/hotel/service/impl/PermissionServiceImpl.java
new file mode 100644
index 0000000..ac4aba4
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/PermissionServiceImpl.java
@@ -0,0 +1,124 @@
+package com.example.hotel.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Permission;
+import com.example.hotel.mapper.PermissionMapper;
+import com.example.hotel.mapper.RolePermissionRefMapper;
+import com.example.hotel.service.PermissionService;
+import com.example.hotel.util.PermissionUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * 角色业务逻辑实现类
+ */
+@Service
+public class PermissionServiceImpl implements PermissionService {
+
+ @Autowired
+ private PermissionMapper permissionMapper;
+
+ @Autowired
+ private RolePermissionRefMapper rolePermissionRefMapper;
+
+
+ @Override
+ public List listPermissionsByRoleId(Long roleId) {
+ return permissionMapper.findByRoleId(roleId);
+ }
+
+ @Override
+ public Set findPermissionUrlsByUserId(Long userId) {
+ List permissions = permissionMapper.findPermissionByUserId(userId);
+ Set urls = permissions.stream().map(p -> p.getUrl()).collect(Collectors.toSet());
+ return urls;
+ }
+
+ @Override
+ public List findPermissionTreeByUserIdAndResourceType(Long userId, String resourceType) {
+ List permissions = permissionMapper.findPermissionByUserIdAndResourceType(userId, resourceType);
+ return PermissionUtil.getPermissionTree(permissions);
+ }
+
+ @Override
+ public List findPermissionByRoleId(Long roleId) {
+ return permissionMapper.findPermissionByRoleId(roleId);
+ }
+
+
+ @Override
+ public BaseMapper getRepository() {
+ return permissionMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(Permission permission) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (permission != null) {
+ if (StrUtil.isNotBlank(permission.getResourceType())) {
+ queryWrapper.eq("resource_type", permission.getResourceType());
+ }
+ if (StrUtil.isNotBlank(permission.getResourceType())) {
+ queryWrapper.eq("resource_type", permission.getResourceType());
+ }
+ if (StrUtil.isNotBlank(permission.getUrl())) {
+ queryWrapper.eq("url", permission.getUrl());
+ }
+ if (StrUtil.isNotBlank(permission.getName())) {
+ queryWrapper.eq("name", permission.getName());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public Permission insertOrUpdate(Permission entity) {
+ if (entity.getId() == null) {
+ insert(entity);
+ } else {
+ update(entity);
+ }
+ return entity;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long id) {
+ permissionMapper.deleteById(id);
+ rolePermissionRefMapper.deleteByPermissionId(id);
+ }
+
+ @Override
+ public List findPermissionListWithLevel() {
+ List permissionList = permissionMapper.selectList(null);
+ permissionList = PermissionUtil.getPermissionList(permissionList);
+
+ // 加空格以展示等级
+ for (Permission permission : permissionList) {
+ for (int i = 1; i < permission.getLevel(); i++) {
+ permission.setName(" "+permission.getName());
+ }
+ }
+ return permissionList;
+
+ }
+
+ @Override
+ public Integer countChildPermission(Long id) {
+ return permissionMapper.countChildPermission(id);
+ }
+
+ @Override
+ public Permission findByUrl(String url) {
+ return permissionMapper.findByUrl(url);
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/service/impl/PostServiceImpl.java b/src/main/java/com/example/hotel/service/impl/PostServiceImpl.java
new file mode 100755
index 0000000..e4a79b2
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/PostServiceImpl.java
@@ -0,0 +1,93 @@
+package com.example.hotel.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.dto.PostQueryCondition;
+import com.example.hotel.entity.*;
+import com.example.hotel.mapper.*;
+import com.example.hotel.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+
+/**
+ *
+ * 客房业务逻辑实现类
+ *
+ */
+@Service
+@Slf4j
+public class PostServiceImpl implements PostService {
+
+
+ @Autowired
+ private PostMapper postMapper;
+
+ @Override
+ public Page findPostByCondition(PostQueryCondition condition, Page page) {
+ List postList = postMapper.findPostByCondition(condition, page);
+ return page.setRecords(postList);
+ }
+
+ @Override
+ public BaseMapper getRepository() {
+ return postMapper;
+ }
+
+ @Override
+ public Post insert(Post post) {
+ postMapper.insert(post);
+ return post;
+ }
+
+ @Override
+ public Post update(Post post) {
+ postMapper.updateById(post);
+ return post;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long postId) {
+ Post post = this.get(postId);
+ if (post != null) {
+ postMapper.deleteById(post.getId());
+ }
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(Post post) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (post != null) {
+ if (StrUtil.isNotBlank(post.getPostTitle())) {
+ queryWrapper.like("post_title", post.getPostTitle());
+ }
+ if (StrUtil.isNotBlank(post.getPostContent())) {
+ queryWrapper.like("post_content", post.getPostContent());
+ }
+ if (post.getPostStatus() != null && post.getPostStatus() != -1) {
+ queryWrapper.eq("post_status", post.getPostStatus());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public Post insertOrUpdate(Post post) {
+ if (post.getId() == null) {
+ insert(post);
+ } else {
+ update(post);
+ }
+ return post;
+ }
+
+}
+
diff --git a/src/main/java/com/example/hotel/service/impl/RecordServiceImpl.java b/src/main/java/com/example/hotel/service/impl/RecordServiceImpl.java
new file mode 100644
index 0000000..c6a9f9a
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/RecordServiceImpl.java
@@ -0,0 +1,64 @@
+package com.example.hotel.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Record;
+import com.example.hotel.mapper.RecordMapper;
+import com.example.hotel.service.RecordService;
+import org.apache.commons.collections.ListUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author 言曌
+ * @date 2020/4/6 2:01 下午
+ */
+@Service
+public class RecordServiceImpl implements RecordService {
+
+ @Autowired
+ private RecordMapper recordMapper;
+
+ @Override
+ public BaseMapper getRepository() {
+ return recordMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(Record record) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (record != null) {
+ if (record.getUserId() != null) {
+ queryWrapper.eq("user_id", record.getUserId());
+ }
+ if (record.getPostId() != null) {
+ queryWrapper.eq("post_id", record.getPostId());
+ }
+ if (record.getRecordDate() != null) {
+ queryWrapper.eq("record_date", record.getRecordDate());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public List findByPostIdAndRecordDate(Long postId, List dateList) {
+ return recordMapper.findByPostIdAndRecordDate(postId, dateList);
+ }
+
+ @Override
+ public List findByPostId(Long postId) {
+ return recordMapper.findByPostId(postId);
+ }
+
+ @Override
+ public Integer delete(Long postId, Long userId, List dateList) {
+ if (dateList != null && dateList.size() > 0) {
+ return recordMapper.delete(postId, userId, dateList);
+ }
+ return 0;
+ }
+}
diff --git a/src/main/java/com/example/hotel/service/impl/RolePermissionRefServiceImpl.java b/src/main/java/com/example/hotel/service/impl/RolePermissionRefServiceImpl.java
new file mode 100644
index 0000000..ebb95e7
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/RolePermissionRefServiceImpl.java
@@ -0,0 +1,31 @@
+package com.example.hotel.service.impl;
+
+import com.example.hotel.entity.RolePermissionRef;
+import com.example.hotel.mapper.RolePermissionRefMapper;
+import com.example.hotel.service.RolePermissionRefService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class RolePermissionRefServiceImpl implements RolePermissionRefService {
+
+ @Autowired
+ private RolePermissionRefMapper rolePermissionRefMapper;
+
+ @Override
+ public void deleteRefByRoleId(Long roleId) {
+ rolePermissionRefMapper.deleteByRoleId(roleId);
+ }
+
+ @Override
+ public void saveByRolePermissionRef(RolePermissionRef rolePermissionRef) {
+ rolePermissionRefMapper.insert(rolePermissionRef);
+ }
+
+ @Override
+ public void batchSaveByRolePermissionRef(List rolePermissionRefs) {
+ rolePermissionRefMapper.batchInsert(rolePermissionRefs);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/service/impl/RoleServiceImpl.java b/src/main/java/com/example/hotel/service/impl/RoleServiceImpl.java
new file mode 100644
index 0000000..07881a9
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/RoleServiceImpl.java
@@ -0,0 +1,139 @@
+package com.example.hotel.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.Permission;
+import com.example.hotel.entity.Role;
+import com.example.hotel.entity.RolePermissionRef;
+import com.example.hotel.mapper.RoleMapper;
+import com.example.hotel.service.RolePermissionRefService;
+import com.example.hotel.service.RoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 角色业务逻辑实现类
+ */
+@Service
+public class RoleServiceImpl implements RoleService {
+
+ @Autowired
+ private RoleMapper roleMapper;
+
+ @Autowired
+ private RolePermissionRefService rolePermissionRefService;
+
+ @Override
+ public BaseMapper getRepository() {
+ return roleMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(Role role) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (role != null) {
+ if (StrUtil.isNotBlank(role.getRole())) {
+ queryWrapper.eq("role", role.getRole());
+ }
+ if (StrUtil.isNotBlank(role.getDescription())) {
+ queryWrapper.eq("description", role.getDescription());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public void deleteByUserId(Long userId) {
+ roleMapper.deleteByUserId(userId);
+ }
+
+ @Override
+ public Role findByRoleId(Long roleId) {
+ return roleMapper.selectById(roleId);
+ }
+
+ @Override
+ public Role findByRoleName(String roleName) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("role", roleName);
+ return roleMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public Role findByUserId(Long userId) {
+ return roleMapper.findByUserId(userId);
+ }
+
+ @Override
+ public Integer countUserByRoleId(Long roleId) {
+ return roleMapper.countUserByRoleId(roleId);
+ }
+
+ @Override
+ public Integer findMaxLevelByUserId(Long userId) {
+ return roleMapper.findMaxLevelByUserId(userId);
+ }
+
+ @Override
+ public List findByLessThanLevel(Integer level) {
+ return roleMapper.findByLessThanLevel(level);
+ }
+
+ @Override
+ public Role findDefaultRole() {
+ return roleMapper.findDefaultRole();
+ }
+
+ @Override
+ public Role getMaxRoleByUserId(Long userId) {
+ return null;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Role insert(Role role) {
+ roleMapper.insert(role);
+ if (role.getPermissions() != null && role.getPermissions().size() > 0) {
+ List rolePermissionRefs = new ArrayList<>(role.getPermissions().size());
+ for (Permission permission : role.getPermissions()) {
+ rolePermissionRefs.add(new RolePermissionRef(role.getId(), permission.getId()));
+ }
+ rolePermissionRefService.batchSaveByRolePermissionRef(rolePermissionRefs);
+ }
+ return role;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Role update(Role role) {
+ roleMapper.updateById(role);
+ if (role.getPermissions() != null && role.getPermissions().size() > 0) {
+ // 删除关联
+ rolePermissionRefService.deleteRefByRoleId(role.getId());
+ // 添加关联
+ List rolePermissionRefs = new ArrayList<>(role.getPermissions().size());
+ for (Permission permission : role.getPermissions()) {
+ rolePermissionRefs.add(new RolePermissionRef(role.getId(), permission.getId()));
+ }
+ rolePermissionRefService.batchSaveByRolePermissionRef(rolePermissionRefs);
+ }
+ return role;
+ }
+
+ @Override
+ public Role insertOrUpdate(Role entity) {
+ if (entity.getId() == null) {
+ insert(entity);
+ } else {
+ update(entity);
+ }
+ return entity;
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/service/impl/UserRoleRefServiceImpl.java b/src/main/java/com/example/hotel/service/impl/UserRoleRefServiceImpl.java
new file mode 100644
index 0000000..6ec0bea
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/UserRoleRefServiceImpl.java
@@ -0,0 +1,44 @@
+package com.example.hotel.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.hotel.entity.UserRoleRef;
+import com.example.hotel.mapper.UserRoleRefMapper;
+import com.example.hotel.service.UserRoleRefService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+@Service
+public class UserRoleRefServiceImpl implements UserRoleRefService {
+
+ @Autowired
+ private UserRoleRefMapper roleRefMapper;
+
+
+ @Override
+ public void deleteByUserId(Long userId) {
+ roleRefMapper.deleteByUserId(userId);
+ }
+
+ @Override
+ public BaseMapper getRepository() {
+ return roleRefMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(UserRoleRef userRoleRef) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (userRoleRef != null) {
+ if (userRoleRef.getUserId() != null) {
+ queryWrapper.eq("user_id", userRoleRef.getUserId());
+ }
+ if (userRoleRef.getRoleId() != null) {
+ queryWrapper.eq("role_id", userRoleRef.getRoleId());
+ }
+ }
+ return queryWrapper;
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/service/impl/UserServiceImpl.java b/src/main/java/com/example/hotel/service/impl/UserServiceImpl.java
new file mode 100644
index 0000000..049a462
--- /dev/null
+++ b/src/main/java/com/example/hotel/service/impl/UserServiceImpl.java
@@ -0,0 +1,199 @@
+package com.example.hotel.service.impl;
+
+import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.dto.JsonResult;
+import com.example.hotel.exception.MyBusinessException;
+import com.example.hotel.common.constant.CommonConstant;
+import com.example.hotel.entity.Role;
+import com.example.hotel.mapper.OrderMapper;
+import com.example.hotel.mapper.RecordMapper;
+import com.example.hotel.mapper.UserMapper;
+import com.example.hotel.entity.User;
+import com.example.hotel.enums.TrueFalseEnum;
+import com.example.hotel.service.PostService;
+import com.example.hotel.service.RoleService;
+import com.example.hotel.service.UserService;
+import com.example.hotel.util.Md5Util;
+import com.example.hotel.util.RegexUtil;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+/**
+ * 用户业务逻辑实现类
+ */
+@Service
+public class UserServiceImpl implements UserService {
+
+ @Autowired
+ private UserMapper userMapper;
+
+ @Autowired
+ private RoleService roleService;
+
+ @Autowired
+ private OrderMapper orderMapper;
+
+ @Autowired
+ private RecordMapper recordMapper;
+
+ @Override
+ public User findByUserName(String userName) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("user_name", userName);
+ return userMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public User findByIdCard(String idCard) {
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("id_card", idCard);
+ return userMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public void updatePassword(Long userId, String password) {
+ User user = new User();
+ user.setId(userId);
+ user.setUserPass(Md5Util.toMd5(password, CommonConstant.PASSWORD_SALT, 10));
+ userMapper.updateById(user);
+ }
+
+ @Override
+ public Page findByRoleAndCondition(String roleName, User condition, Page page) {
+ List users = new ArrayList<>();
+ if (Objects.equals(roleName, CommonConstant.NONE)) {
+ users = userMapper.findByCondition(condition, page);
+ } else {
+ Role role = roleService.findByRoleName(roleName);
+ if (role != null) {
+ users = userMapper.findByRoleIdAndCondition(role.getId(), condition, page);
+ }
+ }
+ return page.setRecords(users);
+ }
+
+ @Override
+ public BaseMapper getRepository() {
+ return userMapper;
+ }
+
+ @Override
+ public QueryWrapper getQueryWrapper(User user) {
+ //对指定字段查询
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if (user != null) {
+ if (StrUtil.isNotBlank(user.getUserName())) {
+ queryWrapper.eq("user_name", user.getUserName());
+ }
+ if (StrUtil.isNotBlank(user.getIdCard())) {
+ queryWrapper.eq("id_card", user.getIdCard());
+ }
+ }
+ return queryWrapper;
+ }
+
+ @Override
+ public User insert(User user) {
+ // 1.检查长度
+ basicCheck(user);
+ // 2.验证手机号和身份证号码是否存在
+ checkUserNameAndIdCard(user);
+ // 3.添加
+ userMapper.insert(user);
+ return user;
+ }
+
+ @Override
+ public User update(User user) {
+ // 1.检查长度
+ basicCheck(user);
+ // 2.验证手机号和身份证号码是否存在
+ checkUserNameAndIdCard(user);
+ // 3.更新
+ userMapper.updateById(user);
+ return user;
+ }
+
+ private void checkUserNameAndIdCard(User user) {
+ //验证手机号和身份证号码是否存在
+ if (user.getUserName() != null) {
+ User nameCheck = findByUserName(user.getUserName());
+ Boolean isExist = (user.getId() == null && nameCheck != null) ||
+ (user.getId() != null && nameCheck != null && !Objects.equals(nameCheck.getId(), user.getId()));
+ if (isExist) {
+ throw new MyBusinessException("手机号已经存在");
+ }
+ }
+ if (user.getIdCard() != null) {
+ User idCardCheck = findByIdCard(user.getIdCard());
+ Boolean isExist = (user.getId() == null && idCardCheck != null) ||
+ (user.getId() != null && idCardCheck != null && !Objects.equals(idCardCheck.getId(), user.getId()));
+ if (isExist) {
+ throw new MyBusinessException("身份证号码已经存在");
+ }
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(Long userId) {
+ //删除用户
+ User user = get(userId);
+ if (user != null) {
+ // 1.修改用户状态为已删除
+ userMapper.deleteById(userId);
+ // 2.修改用户和角色关联
+ roleService.deleteByUserId(userId);
+ // 3.删除订单
+ Map map = new HashMap<>();
+ map.put("user_id", userId);
+ orderMapper.deleteByMap(map);
+ // 4.删除预定
+ recordMapper.deleteByMap(map);
+ }
+ }
+
+ @Override
+ public User insertOrUpdate(User user) {
+ if (user.getId() == null) {
+ user.setUserAvatar("/static/images/avatar/" + RandomUtils.nextInt(1, 41) + ".jpeg");
+ insert(user);
+ } else {
+ update(user);
+ }
+ return user;
+ }
+
+ private void basicCheck(User user) {
+ String userName = user.getUserName();
+ String idCard = user.getIdCard();
+ String userDisplayName = user.getUserDisplayName();
+ // 1.身份证号码是否合法
+ if (StringUtils.isNotEmpty(idCard) && !RegexUtil.isIdCard(idCard)) {
+ throw new MyBusinessException("身份证号码不合法");
+ }
+ // 2.手机号码长度是否合法
+ if (StringUtils.isNotEmpty(userName) && userName.length() != 11) {
+ throw new MyBusinessException("手机号码不合法");
+ }
+ // 3.姓名长度是否合法
+ if (StringUtils.isNotEmpty(userDisplayName) && userDisplayName.length() > 10 || userDisplayName.length() < 2) {
+ throw new MyBusinessException("姓名长度不合法");
+ }
+ }
+
+ @Override
+ public User get(Long id) {
+ User user = userMapper.selectById(id);
+ return user;
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/DateUtil.java b/src/main/java/com/example/hotel/util/DateUtil.java
new file mode 100644
index 0000000..c4510e4
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/DateUtil.java
@@ -0,0 +1,67 @@
+package com.example.hotel.util;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @author 言曌
+ * @date 2020/4/5 4:36 下午
+ */
+
+public class DateUtil {
+
+ public static final String FORMAT = "yyyy-MM-dd";
+ public static final ThreadLocal THREAD_LOCAL = new ThreadLocal<>();
+
+
+ public static List getBetweenDates(String start, int count) {
+ Date startDate = null;
+ SimpleDateFormat sdf = THREAD_LOCAL.get();
+ if (sdf == null) {
+ sdf = new SimpleDateFormat(FORMAT);
+ }
+ try {
+ startDate = sdf.parse(start);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return Collections.emptyList();
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(startDate);
+ c.add(Calendar.DAY_OF_MONTH, count);
+ Date endDate = c.getTime();
+ String end = sdf.format(endDate);
+ return getBetweenDates(start, end);
+ }
+
+ public static List getBetweenDates(String start, String end) {
+
+ List result = new ArrayList<>();
+ try {
+ SimpleDateFormat sdf = THREAD_LOCAL.get();
+ if (sdf == null) {
+ sdf = new SimpleDateFormat(FORMAT);
+ }
+ Date start_date = sdf.parse(start);
+ Date end_date = sdf.parse(end);
+ Calendar tempStart = Calendar.getInstance();
+ tempStart.setTime(start_date);
+ Calendar tempEnd = Calendar.getInstance();
+ tempEnd.setTime(end_date);
+ while (tempStart.before(tempEnd)) {
+ result.add(sdf.format(tempStart.getTime()));
+ tempStart.add(Calendar.DAY_OF_YEAR, 1);
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(getBetweenDates("2020-04-05", 1));
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/hotel/util/FileUtil.java b/src/main/java/com/example/hotel/util/FileUtil.java
new file mode 100644
index 0000000..a009553
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/FileUtil.java
@@ -0,0 +1,81 @@
+package com.example.hotel.util;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.text.StrBuilder;
+import com.example.hotel.exception.MyBusinessException;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author 言曌
+ * @date 2020/3/8 5:45 下午
+ */
+public class FileUtil {
+
+ /**
+ * 上传文件返回URL
+ *
+ * @param file
+ * @return
+ */
+ public static String upload(MultipartFile file) {
+ String path = "";
+ try {
+ //用户目录
+ final StrBuilder uploadPath = new StrBuilder(System.getProperties().getProperty("user.home"));
+ uploadPath.append("/sens/upload/" + DateUtil.thisYear()).append("/").append(DateUtil.thisMonth() + 1).append("/");
+ final File mediaPath = new File(uploadPath.toString());
+ if (!mediaPath.exists()) {
+ if (!mediaPath.mkdirs()) {
+ throw new MyBusinessException("上传失败");
+ }
+ }
+
+ //不带后缀
+ String nameWithOutSuffix = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf('.')).replaceAll(" ", "_").replaceAll(",", "");
+
+ //文件后缀
+ final String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1);
+
+ //带后缀
+ String fileName = nameWithOutSuffix + "." + fileSuffix;
+
+ //判断文件名是否已存在
+ File descFile = new File(mediaPath.getAbsoluteFile(), fileName);
+ int i = 1;
+ while (descFile.exists()) {
+ nameWithOutSuffix = nameWithOutSuffix + "(" + i + ")";
+ descFile = new File(mediaPath.getAbsoluteFile(), nameWithOutSuffix + "." + fileSuffix);
+ i++;
+ }
+ file.transferTo(descFile);
+
+ //文件原路径
+ final StrBuilder fullPath = new StrBuilder(mediaPath.getAbsolutePath());
+ fullPath.append("/");
+ fullPath.append(nameWithOutSuffix + "." + fileSuffix);
+
+ //压缩文件路径
+ final StrBuilder fullSmallPath = new StrBuilder(mediaPath.getAbsolutePath());
+ fullSmallPath.append("/");
+ fullSmallPath.append(nameWithOutSuffix);
+ fullSmallPath.append("_small.");
+ fullSmallPath.append(fileSuffix);
+
+ //映射路径
+ final StrBuilder filePath = new StrBuilder("/upload/");
+ filePath.append(DateUtil.thisYear());
+ filePath.append("/");
+ filePath.append(DateUtil.thisMonth() + 1);
+ filePath.append("/");
+ filePath.append(nameWithOutSuffix + "." + fileSuffix);
+ path = filePath.toString();
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return path;
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/IpInfoUtil.java b/src/main/java/com/example/hotel/util/IpInfoUtil.java
new file mode 100755
index 0000000..bce3c62
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/IpInfoUtil.java
@@ -0,0 +1,57 @@
+package com.example.hotel.util;
+
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+
+/**
+ * @author example
+ */
+@Slf4j
+public class IpInfoUtil {
+
+ /**
+ * 获取客户端IP地址
+ * @param request 请求
+ * @return
+ */
+ public static String getIpAddr(HttpServletRequest request) {
+
+ String ip = request.getHeader("x-forwarded-for");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ if ("127.0.0.1".equals(ip)) {
+ //根据网卡取本机配置的IP
+ InetAddress inet = null;
+ try {
+ inet = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ ip = inet.getHostAddress();
+ }
+ }
+ // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+ if (ip != null && ip.length() > 15) {
+ if (ip.indexOf(",") > 0) {
+ ip = ip.substring(0, ip.indexOf(","));
+ }
+ }
+ if("0:0:0:0:0:0:0:1".equals(ip)){
+ ip = "127.0.0.1";
+ }
+ return ip;
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/util/Md5Util.java b/src/main/java/com/example/hotel/util/Md5Util.java
new file mode 100755
index 0000000..915055f
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/Md5Util.java
@@ -0,0 +1,74 @@
+package com.example.hotel.util;
+
+import cn.hutool.core.text.StrBuilder;
+import org.apache.shiro.crypto.hash.Md5Hash;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.InputStream;
+import java.security.MessageDigest;
+
+/**
+ * 获取文件hash
+ */
+public class Md5Util {
+
+
+ /**
+ * shiro的md5加密
+ *
+ * @param pwd 密码
+ * @param salt 盐
+ * @param i 加密次数
+ * @return 加密后字符串
+ */
+ public static String toMd5(String pwd, String salt, int i) {
+ Md5Hash toMd5 = new Md5Hash(pwd, salt, i);
+ return toMd5.toString();
+ }
+
+ /**
+ * 计算文件MD5编码
+ *
+ * @param file file
+ * @return byte
+ * @throws Exception Exception
+ */
+ private static byte[] createChecksum(MultipartFile file) throws Exception {
+ final InputStream fis = file.getInputStream();
+
+ final byte[] buffer = new byte[1024];
+ final MessageDigest complete = MessageDigest.getInstance("MD5");
+ int numRead;
+
+ do {
+ numRead = fis.read(buffer);
+ if (numRead > 0) {
+ complete.update(buffer, 0, numRead);
+ }
+ } while (numRead != -1);
+
+ fis.close();
+ return complete.digest();
+ }
+
+ /**
+ * 生成文件hash值
+ *
+ * @param file file
+ * @return String
+ * @throws Exception Exception
+ */
+ public static String getMD5Checksum(MultipartFile file) throws Exception {
+ final byte[] b = createChecksum(file);
+ StrBuilder result = new StrBuilder();
+
+ for (int i = 0; i < b.length; i++) {
+ result.append(Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ return result.toString();
+ }
+
+ public static void main(String args[]) {
+
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/ObjectUtil.java b/src/main/java/com/example/hotel/util/ObjectUtil.java
new file mode 100755
index 0000000..300e409
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/ObjectUtil.java
@@ -0,0 +1,57 @@
+package com.example.hotel.util;
+
+import cn.hutool.core.util.StrUtil;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import org.springframework.cglib.beans.BeanMap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author example
+ */
+public class ObjectUtil {
+
+ public static String mapToString(Map paramMap){
+
+ if (paramMap == null) {
+ return "";
+ }
+ Map params = new HashMap<>(16);
+ for (Map.Entry param : paramMap.entrySet()) {
+
+ String key = param.getKey();
+ String paramValue = (param.getValue() != null && param.getValue().length > 0 ? param.getValue()[0] : "");
+ String obj = StrUtil.endWithIgnoreCase(param.getKey(), "password") ? "密码隐藏" : paramValue;
+ params.put(key,obj);
+ }
+ return new Gson().toJson(params);
+ }
+
+ public static String mapToStringAll(Map paramMap){
+
+ if (paramMap == null) {
+ return "";
+ }
+ Map params = new HashMap<>(16);
+ for (Map.Entry param : paramMap.entrySet()) {
+
+ String key = param.getKey();
+ String paramValue = (param.getValue() != null && param.getValue().length > 0 ? param.getValue()[0] : "");
+ params.put(key, paramValue);
+ }
+ return new Gson().toJson(params);
+ }
+
+ public static Map beanToMap(T bean) {
+ Map map = Maps.newHashMap();
+ if (bean != null) {
+ BeanMap beanMap = BeanMap.create(bean);
+ for (Object key : beanMap.keySet()) {
+ map.put(key+"", beanMap.get(key));
+ }
+ }
+ return map;
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/PageUtil.java b/src/main/java/com/example/hotel/util/PageUtil.java
new file mode 100755
index 0000000..6591f7b
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/PageUtil.java
@@ -0,0 +1,148 @@
+package com.example.hotel.util;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.example.hotel.vo.PageVo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @author example
+ */
+public class PageUtil {
+
+ /**
+ * 最大分页大小
+ */
+ public static final int MAX_PAGE_SIZE = 100;
+
+ /**
+ * mybatis分页封装
+ *
+ * @param pageNumber 页码
+ * @param pageSize 页大小
+ * @param sort 排序字段
+ * @param order 倒序/升序
+ * @return
+ */
+ public static Page initMpPage(long pageNumber, long pageSize, String sort, String order) {
+
+ Page p = null;
+ if (StrUtil.isNotBlank(sort)) {
+ //驼峰法转下划线, createTime -> create_time
+ sort = camelToUnderline(sort);
+ }
+
+ if (pageNumber < 1) {
+ pageNumber = 1;
+ }
+ if (pageSize < 1) {
+ pageSize = 10;
+ }
+ if (pageSize > MAX_PAGE_SIZE) {
+ pageSize = MAX_PAGE_SIZE;
+ }
+ if (StrUtil.isNotBlank(sort)) {
+ Boolean isAsc = false;
+ if (StrUtil.isBlank(order)) {
+ isAsc = false;
+ } else {
+ if ("desc".equals(order.toLowerCase())) {
+ isAsc = false;
+ } else if ("asc".equals(order.toLowerCase())) {
+ isAsc = true;
+ }
+ }
+ p = new Page(pageNumber, pageSize);
+ if (isAsc) {
+ p.setAsc(sort);
+ } else {
+ p.setDesc(sort);
+ }
+ } else {
+ p = new Page(pageNumber, pageSize);
+ }
+ return p;
+ }
+
+ /**
+ * List 手动分页
+ *
+ * @param page
+ * @param list
+ * @return
+ */
+ public static List listToPage(PageVo page, List list) {
+
+ long pageNumber = page.getPage() - 1;
+ long pageSize = page.getSize();
+
+ if (pageNumber < 0) {
+ pageNumber = 0;
+ }
+ if (pageSize < 1) {
+ pageSize = 10;
+ }
+
+ long fromIndex = pageNumber * pageSize;
+ long toIndex = pageNumber * pageSize + pageSize;
+
+ if (fromIndex > list.size()) {
+ return new ArrayList();
+ } else if (toIndex >= list.size()) {
+ return list.subList((int) fromIndex, list.size());
+ } else {
+ return list.subList((int) fromIndex, (int) toIndex);
+ }
+ }
+
+ /**
+ * 驼峰转下划线
+ *
+ * @param str
+ * @return
+ */
+ private static String camelToUnderline(String str) {
+ if (str == null || str.trim().isEmpty()) {
+ return "";
+ }
+ int len = str.length();
+ StringBuilder sb = new StringBuilder(len);
+ sb.append(str.substring(0, 1).toLowerCase());
+ for (int i = 1; i < len; i++) {
+ char c = str.charAt(i);
+ if (Character.isUpperCase(c)) {
+ sb.append("_");
+ sb.append(Character.toLowerCase(c));
+ } else {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 设计缺陷,前端无法获取mybatis-plus的分页page中的pages,所以自己封装一个PageVO
+ * 同时将分页信息塞到PageVo中
+ *
+ * @param page mybatis-plus分页类
+ * @return
+ */
+ public static PageVo convertPageVo(Page page) {
+ PageVo pageVo = new PageVo();
+ pageVo.setSize(page.getSize());
+ pageVo.setTotal(page.getTotal());
+ pageVo.setCurrent(page.getCurrent());
+ pageVo.setPages(page.getPages());
+ List orderItems = page.getOrders();
+ if (orderItems != null && orderItems.size() > 0) {
+ pageVo.setSort(orderItems.get(0).getColumn());
+ pageVo.setOrder(orderItems.get(0).isAsc() ? "asc" : "desc");
+ }
+ return pageVo;
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/util/PermissionUtil.java b/src/main/java/com/example/hotel/util/PermissionUtil.java
new file mode 100755
index 0000000..78a4db4
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/PermissionUtil.java
@@ -0,0 +1,108 @@
+package com.example.hotel.util;
+
+import com.example.hotel.entity.Permission;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 拼装菜单
+ */
+public class PermissionUtil {
+
+ /**
+ * 获取组装好的菜单
+ * 以树的形式显示
+ *
+ * @param permissionsRoot permissionsRoot
+ * @return List
+ */
+ public static List getPermissionTree(List permissionsRoot) {
+ List permissionsResult = new ArrayList<>();
+
+ for (Permission permission : permissionsRoot) {
+ if (permission.getPid() == 0) {
+ permissionsResult.add(permission);
+ }
+ }
+
+ for (Permission permission : permissionsResult) {
+ permission.setChildPermissions(getChildTree(permission.getId(), permissionsRoot));
+ }
+ return permissionsResult;
+ }
+
+ /**
+ * 获取菜单的子菜单
+ *
+ * @param id 菜单编号
+ * @param permissionsRoot permissionsRoot
+ * @return List
+ */
+ private static List getChildTree(Long id, List permissionsRoot) {
+ List permissionsChild = new ArrayList<>();
+ for (Permission permission : permissionsRoot) {
+ if (permission.getPid() != 0) {
+ if (permission.getPid().equals(id)) {
+ permissionsChild.add(permission);
+ }
+ }
+ }
+ for (Permission permission : permissionsChild) {
+ if (permission.getPid() != 0) {
+ permission.setChildPermissions(getChildTree(permission.getId(), permissionsRoot));
+ }
+ }
+ if (permissionsChild.size() == 0) {
+ return null;
+ }
+ return permissionsChild;
+ }
+
+ /**
+ * 获取组装好的菜单,
+ *
+ * @param permissionsRoot permissionsRoot
+ * @return List
+ */
+ public static List getPermissionList(List permissionsRoot) {
+ List permissionsResult = new ArrayList<>();
+
+ for (Permission permission : permissionsRoot) {
+ if (permission.getPid() == 0) {
+ permission.setLevel(1);
+ permissionsResult.add(permission);
+ permissionsResult.addAll(getChildList(permission, permissionsRoot));
+ }
+ }
+ return permissionsResult;
+ }
+
+ /**
+ * 获取菜单的子菜单
+ *
+ * @param parentPermission 菜单编号
+ * @param permissionsRoot permissionsRoot
+ * @return List
+ */
+ private static List getChildList(Permission parentPermission, List permissionsRoot) {
+ List permissionsChild = new ArrayList<>();
+ for (Permission permission : permissionsRoot) {
+ if (permission.getPid() != 0) {
+ if (permission.getPid().equals(parentPermission.getId())) {
+ permission.setLevel(parentPermission.getLevel() + 1);
+ permissionsChild.add(permission);
+ List tempList = getChildList(permission, permissionsRoot);
+ tempList.sort((a, b) -> (int) (b.getSort() - a.getSort()));
+ permissionsChild.addAll(tempList);
+ }
+ }
+ }
+ if (permissionsChild.size() == 0) {
+ return Collections.emptyList();
+ }
+ return permissionsChild;
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/util/RegexUtil.java b/src/main/java/com/example/hotel/util/RegexUtil.java
new file mode 100644
index 0000000..23c3b23
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/RegexUtil.java
@@ -0,0 +1,62 @@
+package com.example.hotel.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author 言曌
+ * @date 2020/3/8 1:55 下午
+ */
+
+public class RegexUtil {
+
+ /**
+ * 判断Email合法性
+ *
+ * @param email
+ * @return
+ */
+ public static boolean isEmail(String email) {
+ if (email == null) {
+ return false;
+ }
+ String rule = "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?";
+ Pattern pattern = Pattern.compile(rule);
+ Matcher matcher = pattern.matcher(email);
+ return matcher.matches();
+ }
+
+ /**
+ * 是否为合法身份证号码
+ * @param idCard
+ * @return
+ */
+ public static boolean isIdCard(String idCard) {
+ if(idCard == null) {
+ return false;
+ }
+ return idCard.length() == 15 || idCard.length() == 18;
+ }
+
+ public static List getImgSrc(String htmlStr) {
+ String img = "";
+ Pattern imgPattern;
+ Matcher imgMatcher;
+ List pics = new ArrayList<>();
+ String imgReg = "]*?>";
+ imgPattern = Pattern.compile(imgReg, Pattern.CASE_INSENSITIVE);
+ imgMatcher = imgPattern.matcher(htmlStr);
+ while (imgMatcher.find()) {
+ img = img + "," + imgMatcher.group();
+ Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(img);
+ while (m.find()) {
+ pics.add(m.group(1));
+ }
+ }
+ return pics;
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/util/RelativeDateFormat.java b/src/main/java/com/example/hotel/util/RelativeDateFormat.java
new file mode 100644
index 0000000..2da719a
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/RelativeDateFormat.java
@@ -0,0 +1,78 @@
+package com.example.hotel.util;
+
+
+import java.util.Date;
+
+/**
+ * @author 言曌
+ * @date 2020/3/10 9:48 下午
+ */
+
+public class RelativeDateFormat {
+
+ private static final long ONE_MINUTE = 60000L;
+ private static final long ONE_HOUR = 3600000L;
+ private static final long ONE_DAY = 86400000L;
+ private static final long ONE_WEEK = 604800000L;
+
+ private static final String ONE_SECOND_AGO = "秒前";
+ private static final String ONE_MINUTE_AGO = "分钟前";
+ private static final String ONE_HOUR_AGO = "小时前";
+ private static final String ONE_DAY_AGO = "天前";
+ private static final String ONE_MONTH_AGO = "月前";
+ private static final String ONE_YEAR_AGO = "年前";
+
+ public static String format(Date date) {
+ long delta = System.currentTimeMillis() - date.getTime();
+ if (delta < 1L * ONE_MINUTE) {
+ long seconds = toSeconds(delta);
+ return (seconds <= 0 ? 1 : seconds) + ONE_SECOND_AGO;
+ }
+ if (delta < 45L * ONE_MINUTE) {
+ long minutes = toMinutes(delta);
+ return (minutes <= 0 ? 1 : minutes) + ONE_MINUTE_AGO;
+ }
+ if (delta < 24L * ONE_HOUR) {
+ long hours = toHours(delta);
+ return (hours <= 0 ? 1 : hours) + ONE_HOUR_AGO;
+ }
+ if (delta < 48L * ONE_HOUR) {
+ return "昨天";
+ }
+ if (delta < 30L * ONE_DAY) {
+ long days = toDays(delta);
+ return (days <= 0 ? 1 : days) + ONE_DAY_AGO;
+ }
+ if (delta < 12L * 4L * ONE_WEEK) {
+ long months = toMonths(delta);
+ return (months <= 0 ? 1 : months) + ONE_MONTH_AGO;
+ } else {
+ long years = toYears(delta);
+ return (years <= 0 ? 1 : years) + ONE_YEAR_AGO;
+ }
+ }
+
+ private static long toSeconds(long date) {
+ return date / 1000L;
+ }
+
+ private static long toMinutes(long date) {
+ return toSeconds(date) / 60L;
+ }
+
+ private static long toHours(long date) {
+ return toMinutes(date) / 60L;
+ }
+
+ private static long toDays(long date) {
+ return toHours(date) / 24L;
+ }
+
+ private static long toMonths(long date) {
+ return toDays(date) / 30L;
+ }
+
+ private static long toYears(long date) {
+ return toMonths(date) / 365L;
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/Response.java b/src/main/java/com/example/hotel/util/Response.java
new file mode 100644
index 0000000..ebbba8d
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/Response.java
@@ -0,0 +1,101 @@
+package com.example.hotel.util;
+
+public class Response {
+
+ private Boolean success;
+
+ private String message;
+
+ private T data;
+
+ /**
+ * 状态码
+ */
+ private Integer status = 200;
+
+ public Response() {
+ }
+
+ public Response(Boolean success) {
+ this.success = success;
+ }
+
+ public Response(Boolean success, String message) {
+ this.success = success;
+ this.message = message;
+ }
+
+ public Response(Boolean success, String message, T data) {
+ this.success = success;
+ this.message = message;
+ this.data = data;
+ }
+
+ public Response(Boolean success, Integer status, String message, T data) {
+ this.success = success;
+ this.message = message;
+ this.data = data;
+ this.status = status;
+ }
+
+
+ public static Response yes() {
+ return new Response(true, 200, "成功", null);
+ }
+
+ public static Response yes(T data) {
+ return new Response(true, 200, "成功", data);
+ }
+
+ public static Response yes(String message, T data) {
+ return new Response(true, 200, message, data);
+ }
+
+ public static Response no() {
+ return new Response(false, 500, "失败", null);
+ }
+
+ public static Response no(String message) {
+ return new Response(false, 500, message, null);
+ }
+
+ public static Response no(Integer status, String message) {
+ return new Response(false, status, message, null);
+ }
+
+ public Boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(Boolean success) {
+ this.success = success;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public void setData(T data) {
+ this.data = data;
+ }
+
+ public Boolean getSuccess() {
+ return success;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/SensUtils.java b/src/main/java/com/example/hotel/util/SensUtils.java
new file mode 100755
index 0000000..c7b1bc9
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/SensUtils.java
@@ -0,0 +1,50 @@
+package com.example.hotel.util;
+
+import io.github.biezhi.ome.OhMyEmail;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.*;
+
+/**
+ *
+ * 常用工具
+ *
+ */
+@Slf4j
+public class SensUtils {
+
+ /**
+ * 配置邮件
+ *
+ * @param smtpHost smtpHost
+ * @param userName 邮件地址
+ * @param password password
+ */
+ public static void configMail(String smtpHost, String userName, String password) {
+ Properties properties = OhMyEmail.defaultConfig(false);
+ properties.setProperty("mail.smtp.host", smtpHost);
+ OhMyEmail.config(properties, userName, password);
+ }
+
+
+ public static String listToStr(List list) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String str : list) {
+ stringBuilder.append(str).append(",");
+ }
+ String temp = stringBuilder.toString();
+ if (temp.length() > 0) {
+ return temp.substring(0, temp.length() - 1);
+ }
+ return temp;
+ }
+
+ public static void main(String[] args) {
+ List list = new ArrayList<>();
+ list.add("11");
+ list.add("22");
+ list.add("13");
+ System.out.println(listToStr(list));
+ }
+
+}
diff --git a/src/main/java/com/example/hotel/util/SpringUtil.java b/src/main/java/com/example/hotel/util/SpringUtil.java
new file mode 100755
index 0000000..bb6951b
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/SpringUtil.java
@@ -0,0 +1,49 @@
+package com.example.hotel.util;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SpringUtil implements ApplicationContextAware {
+
+ private static ApplicationContext applicationContext;
+
+ /**
+ * 获取applicationContext
+ *
+ * @return ApplicationContext
+ */
+ public static ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ if (SpringUtil.applicationContext == null) {
+ SpringUtil.applicationContext = applicationContext;
+ }
+ }
+
+ /**
+ * 通过name获取 Bean.
+ *
+ * @param name name
+ * @return Object
+ */
+ public static Object getBean(String name) {
+ return getApplicationContext().getBean(name);
+ }
+
+ /**
+ * 通过class获取Bean
+ *
+ * @param clazz clazz
+ * @param
+ * @return T
+ */
+ public static T getBean(Class clazz) {
+ return getApplicationContext().getBean(clazz);
+ }
+}
diff --git a/src/main/java/com/example/hotel/util/ThreadPoolUtil.java b/src/main/java/com/example/hotel/util/ThreadPoolUtil.java
new file mode 100755
index 0000000..731b27d
--- /dev/null
+++ b/src/main/java/com/example/hotel/util/ThreadPoolUtil.java
@@ -0,0 +1,44 @@
+package com.example.hotel.util;
+
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author example
+ */
+public class ThreadPoolUtil {
+
+ /**
+ * 线程缓冲队列
+ */
+ private static BlockingQueue bqueue = new ArrayBlockingQueue(100);
+ /**
+ * 核心线程数,会一直存活,即使没有任务,线程池也会维护线程的最少数量
+ */
+ private static final int SIZE_CORE_POOL = 5;
+ /**
+ * 线程池维护线程的最大数量
+ */
+ private static final int SIZE_MAX_POOL = 10;
+ /**
+ * 线程池维护线程所允许的空闲时间
+ */
+ private static final long ALIVE_TIME = 2000;
+
+ private static ThreadPoolExecutor pool = new ThreadPoolExecutor(SIZE_CORE_POOL, SIZE_MAX_POOL, ALIVE_TIME, TimeUnit.MILLISECONDS, bqueue, new ThreadPoolExecutor.CallerRunsPolicy());
+
+ static {
+
+ pool.prestartAllCoreThreads();
+ }
+
+ public static ThreadPoolExecutor getPool() {
+ return pool;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(pool.getPoolSize());
+ }
+}
diff --git a/src/main/java/com/example/hotel/vo/PageVo.java b/src/main/java/com/example/hotel/vo/PageVo.java
new file mode 100755
index 0000000..c9a8b94
--- /dev/null
+++ b/src/main/java/com/example/hotel/vo/PageVo.java
@@ -0,0 +1,68 @@
+package com.example.hotel.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * @author example
+ */
+@Data
+public class PageVo implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 页号
+ */
+ private long page = 1;
+
+ /**
+ * 页大小
+ */
+ private long size = 10;
+
+ /**
+ * 排序字段
+ */
+ private String sort = "create_time";
+
+ /**
+ * 排序方式 asc/desc
+ */
+ private String order = "desc";
+
+ /**
+ * 当前页码
+ */
+ private long current;
+
+ /**
+ * 总数
+ */
+ private long total;
+
+ /**
+ * 页数
+ */
+ private long pages;
+
+
+ public PageVo() {
+ }
+
+ public PageVo(int page, int size) {
+ this.page = page;
+ this.size = size;
+ }
+
+ public PageVo(int page, int size, String sort, String order) {
+ this.page = page;
+ this.size = size;
+ this.sort = sort;
+ this.order = order;
+ }
+
+
+}
diff --git a/src/main/java/com/example/hotel/vo/SearchVo.java b/src/main/java/com/example/hotel/vo/SearchVo.java
new file mode 100755
index 0000000..8212f61
--- /dev/null
+++ b/src/main/java/com/example/hotel/vo/SearchVo.java
@@ -0,0 +1,22 @@
+package com.example.hotel.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author example
+ */
+@Data
+public class SearchVo implements Serializable {
+
+ /**
+ * 起始日期
+ */
+ private String startDate;
+
+ /**
+ * 结束日期
+ */
+ private String endDate;
+}
diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml
new file mode 100755
index 0000000..749e0be
--- /dev/null
+++ b/src/main/resources/application.yaml
@@ -0,0 +1,81 @@
+server:
+ port: 8080
+ forward-headers-strategy: true
+ undertow:
+ io-threads: 2
+ worker-threads: 36
+ buffer-size: 1024
+ directBuffers: true
+ servlet:
+ session:
+ timeout: 86400
+
+spring:
+ transaction:
+ rollback-on-commit-failure: true
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ #MySql配置
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://127.0.0.1:3306/hotux?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowMultiQueries=true
+ username: root
+ password: 123456
+ thymeleaf:
+ mode: HTML5
+ cache: false
+ prefix: classpath:/templates/
+ encoding: UTF-8
+ suffix: .html
+ check-template-location: false
+ servlet:
+ multipart:
+ max-file-size: 2000MB
+ max-request-size: 2000MB
+ devtools:
+ restart:
+ enabled: true
+ additional-paths: src/main/java
+
+mybatis-plus:
+ mapper-locations: classpath*:/mapper/**Mapper.xml
+ #实体扫描,多个package用逗号或者分号分隔
+ typeAliasesPackage: com.example.sens.entity
+ global-config:
+ #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+ id-type: 0
+ #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+ field-strategy: 2
+ #驼峰下划线转换
+ db-column-underline: true
+ #刷新mapper 调试神器
+ refresh-mapper: true
+ #逻辑删除配置(下面3个配置)
+ logic-delete-value: 1
+ logic-not-delete-value: 0
+ configuration:
+ map-underscore-to-camel-case: true
+ cache-enabled: true
+
+logging:
+ file: ./logs/log.log
+ level:
+ org:
+ springframework:
+ boot:
+ autoconfigure: error
+# web:
+# trace
+
+application:
+ formatted-version: 1.0.0
+
+shiro:
+ userNativeSessionManager: true
+
+mail:
+ smtp:
+ host: smtp.qq.com
+ username: 847064370@qq.com
+ password: vtvhcjsacnuubdaj
+ from:
+ name: Hotux
diff --git a/src/main/resources/mapper/CategoryMapper.xml b/src/main/resources/mapper/CategoryMapper.xml
new file mode 100644
index 0000000..819550a
--- /dev/null
+++ b/src/main/resources/mapper/CategoryMapper.xml
@@ -0,0 +1,23 @@
+
+
+