text: /*
  Navicat MySQL Data Transfer
  
  Source Server         : 个人服务器
  Source Server Version : 50720
  Source Host           : 39.106.64.79:3306
  Source Database       : xlauch
  
  Target Server Type    : MYSQL
  Target Server Version : 50720
  File Encoding         : 65001
  
  Date: 2017-11-06 15:58:00
  */
  
  SET FOREIGN_KEY_CHECKS=0;
  
  -- ----------------------------
  -- Table structure for t_sys_permission
  -- ----------------------------
  DROP TABLE IF EXISTS `t_sys_permission`;
  CREATE TABLE `t_sys_permission` (
    `permission_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `url` varchar(256) DEFAULT NULL COMMENT 'url地址',
    `name` varchar(64) DEFAULT NULL COMMENT 'url描述',
    PRIMARY KEY (`permission_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='权限表';
  
  -- ----------------------------
  -- Records of t_sys_permission
  -- ----------------------------
  
  -- ----------------------------
  -- Table structure for t_sys_role
  -- ----------------------------
  DROP TABLE IF EXISTS `t_sys_role`;
  CREATE TABLE `t_sys_role` (
    `role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `name` varchar(32) DEFAULT NULL COMMENT '角色名称',
    `type` varchar(10) DEFAULT NULL COMMENT '角色类型',
    PRIMARY KEY (`role_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='角色表';
  
  -- ----------------------------
  -- Records of t_sys_role
  -- ----------------------------
  
  -- ----------------------------
  -- Table structure for t_sys_role_permission
  -- ----------------------------
  DROP TABLE IF EXISTS `t_sys_role_permission`;
  CREATE TABLE `t_sys_role_permission` (
    `role_id` bigint(20) DEFAULT NULL COMMENT '角色ID',
    `permission_id` bigint(20) DEFAULT NULL COMMENT '权限ID'
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色权限表';
  
  -- ----------------------------
  -- Records of t_sys_role_permission
  -- ----------------------------
  
  -- ----------------------------
  -- Table structure for t_sys_user
  -- ----------------------------
  DROP TABLE IF EXISTS `t_sys_user`;
  CREATE TABLE `t_sys_user` (
    `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `username` varchar(32) NOT NULL COMMENT '用户号码',
    `mobile` varchar(15) DEFAULT NULL COMMENT '手机号码',
    `nickname` varchar(20) DEFAULT NULL COMMENT '用户昵称',
    `email` varchar(128) DEFAULT NULL COMMENT '邮箱|登录帐号',
    `pswd` varchar(32) DEFAULT NULL COMMENT '密码',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
    `status` bigint(1) DEFAULT '1' COMMENT '1:有效，0:禁止登录',
    PRIMARY KEY (`user_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='系统用户表';
  
  -- ----------------------------
  -- Records of t_sys_user
  -- ----------------------------
  INSERT INTO `t_sys_user` VALUES ('15', '', null, '火华', '15980273571', 'e10adc3949ba59abbe56e057f20f883e', '2017-11-06 15:37:19', null, '1');
  
  -- ----------------------------
  -- Table structure for t_sys_user_role
  -- ----------------------------
  DROP TABLE IF EXISTS `t_sys_user_role`;
  CREATE TABLE `t_sys_user_role` (
    `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
    `role_id` bigint(20) DEFAULT NULL COMMENT '角色ID'
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色关联表';
  
  -- ----------------------------
  -- Records of t_sys_user_role
  -- ----------------------------
  
  CREATE FUNCTION `getPmsChildLst`(rootId INT) RETURNS varchar(1000) CHARSET utf8
  BEGIN
  	DECLARE sTemp VARCHAR(1000);
  	DECLARE sTempChd VARCHAR(1000);
  
  	SET sTemp = '$';
  	SET sTempChd =cast(rootId as CHAR);
  
  	WHILE sTempChd is not null DO
  		if sTempChd != cast(rootId as CHAR) then
  			SET sTemp = concat(sTemp,',',sTempChd);
  		end if;
  		SELECT group_concat(permission_id) INTO sTempChd FROM t_sys_permission where FIND_IN_SET(parent_pid,sTempChd);
  	END WHILE;
  	RETURN sTemp;
  END
  