SpringBoot 分页处理
Posted 魔流剑●风之痕
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot 分页处理相关的知识,希望对你有一定的参考价值。
开始主要是要使用已经设计好的数据库
-- ---------------------------------------------------- -- 用户 -- ---------------------------------------------------- -- Table structure for `sys_user` -- ---------------------------------------------------- CREATE TABLE `sys_user` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `name` varchar(50) NOT NULL COMMENT \'用户名\', `password` varchar(100) COMMENT \'密码\', `salt` varchar(40) COMMENT \'盐\', `email` varchar(100) COMMENT \'邮箱\', `mobile` varchar(100) COMMENT \'手机号\', `status` tinyint COMMENT \'状态 0:禁用 1:正常\', `dept_id` bigint(20) COMMENT \'机构ID\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', `del_flag` tinyint DEFAULT 0 COMMENT \'是否删除 -1:已删除 0:正常\', PRIMARY KEY (`id`), UNIQUE INDEX (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'用户\'; -- ---------------------------------------------------- -- 机构 -- ------------------------------------------------ -- Table structure for `sys_dept` -- ------------------------------------------------ CREATE TABLE `sys_dept` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `name` varchar(50) COMMENT \'机构名称\', `parent_id` bigint COMMENT \'上级机构ID,一级机构为0\', `order_num` int COMMENT \'排序\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', `del_flag` tinyint DEFAULT 0 COMMENT \'是否删除 -1:已删除 0:正常\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'机构管理\'; -- ------------------------------------------------ -- 角色 -- ------------------------------------------------ -- Table structure for `sys_role` -- ------------------------------------------------ CREATE TABLE `sys_role` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `name` varchar(100) COMMENT \'角色名称\', `remark` varchar(100) COMMENT \'备注\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', `del_flag` tinyint DEFAULT 0 COMMENT \'是否删除 -1:已删除 0:正常\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'角色\'; -- ------------------------------------------------ -- 菜单 -- ------------------------------------------------ -- Table structure for `sys_menu` -- ------------------------------------------------ CREATE TABLE `sys_menu` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `name` varchar(50) COMMENT \'菜单名称\', `parent_id` bigint COMMENT \'父菜单ID,一级菜单为0\', `url` varchar(200) COMMENT \'菜单URL\', `perms` varchar(500) COMMENT \'授权(多个用逗号分隔,如:user:view,user:create)\', `type` int COMMENT \'类型 0:目录 1:菜单 2:按钮\', `icon` varchar(50) COMMENT \'菜单图标\', `order_num` int COMMENT \'排序\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', `del_flag` tinyint DEFAULT 0 COMMENT \'是否删除 -1:已删除 0:正常\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'菜单管理\'; -- ------------------------------------------------ -- 用户与角色对应关系 -- ------------------------------------------------ -- Table structure for `sys_user_role` -- ------------------------------------------------ CREATE TABLE `sys_user_role` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `user_id` bigint COMMENT \'用户ID\', `role_id` bigint COMMENT \'角色ID\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'用户与角色对应关系\'; -- ------------------------------------------------ -- 角色与机构对应关系 -- ------------------------------------------------ -- Table structure for `sys_role_dept` -- ------------------------------------------------ CREATE TABLE `sys_role_dept` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `role_id` bigint COMMENT \'角色ID\', `dept_id` bigint COMMENT \'机构ID\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'角色与机构对应关系\'; -- ------------------------------------------------ -- 角色与菜单对应关系 -- ------------------------------------------------ -- Table structure for `sys_role_menu` -- ------------------------------------------------ CREATE TABLE `sys_role_menu` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `role_id` bigint COMMENT \'角色ID\', `menu_id` bigint COMMENT \'菜单ID\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'角色与菜单对应关系\'; -- ------------------------------------------------ -- 用户Token -- ------------------------------------------------ -- Table structure for `sys_user_token` -- ------------------------------------------------ CREATE TABLE `sys_user_token` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `user_id` bigint NOT NULL, `token` varchar(100) NOT NULL COMMENT \'token\', `expire_time` datetime DEFAULT NULL COMMENT \'过期时间\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', PRIMARY KEY (`id`), UNIQUE KEY `token` (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'用户Token\'; -- ------------------------------------------------ -- 系统日志 -- ------------------------------------------------ -- Table structure for `sys_log` -- ------------------------------------------------ CREATE TABLE `sys_log` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `user_name` varchar(50) COMMENT \'用户名\', `operation` varchar(50) COMMENT \'用户操作\', `method` varchar(200) COMMENT \'请求方法\', `params` varchar(5000) COMMENT \'请求参数\', `time` bigint NOT NULL COMMENT \'执行时长(毫秒)\', `ip` varchar(64) COMMENT \'IP地址\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', PRIMARY KEY (`id`) ) ENGINE=`InnoDB` DEFAULT CHARACTER SET utf8 COMMENT=\'系统日志\'; -- ------------------------------------------------ -- 数据字典 -- ------------------------------------------------ -- Table structure for `sys_dict` -- ------------------------------------------------ DROP TABLE IF EXISTS `sys_dict`; CREATE TABLE `sys_dict` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT \'编号\', `value` varchar(100) NOT NULL COMMENT \'数据值\', `label` varchar(100) NOT NULL COMMENT \'标签名\', `type` varchar(100) NOT NULL COMMENT \'类型\', `description` varchar(100) NOT NULL COMMENT \'描述\', `sort` decimal(10,0) NOT NULL COMMENT \'排序(升序)\', `create_by` varchar(50) COMMENT \'创建人\', `create_time` datetime COMMENT \'创建时间\', `last_update_by` varchar(50) COMMENT \'更新人\', `last_update_time` datetime COMMENT \'更新时间\', `remarks` varchar(255) DEFAULT NULL COMMENT \'备注信息\', `del_flag` tinyint DEFAULT 0 COMMENT \'是否删除 -1:已删除 0:正常\', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'字典表\'; -- -------------------------------------- -- 初始数据 -- -------------------------------------- -- Records of `sys_user` -- -------------------------------------- INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'1\', \'admin\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'4\', \'admin@qq.com\', \'13612345678\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'2\', \'Louis\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'6\', \'louis@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'3\', \'Kobe\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'7\', \'kobe@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'4\', \'Iverson\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'8\', \'iverson@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'5\', \'Iverson5\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'12\', \'iverson@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'6\', \'Iverson6\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'12\', \'iverson@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'7\', \'Iverson7\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'13\', \'iverson@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'8\', \'Iverson8\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'14\', \'iverson@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'9\', \'Iverson9\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\', \'YzcmCZNvbXocrsz9dm8e\', \'15\', \'iverson@qq.com\', \'18200932238\', \'1\', \'2018-08-14 11:11:11\'); INSERT INTO `sys_user` (`id`, `name`, `password`, `salt`, `dept_id`, `email`, `mobile`, `status`, `create_time`) VALUES (\'10\', \'Iverson10\', \'9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d\',以上是关于SpringBoot 分页处理的主要内容,如果未能解决你的问题,请参考以下文章
springboot环境下使用pageHelper插件进行分页