operation.sql 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. ---- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓此位置加入最新修改的脚本↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  2. ALTER TABLE `t_base_user` ADD COLUMN `email` VARCHAR(64) DEFAULT NULL COMMENT '邮箱' AFTER `password`;
  3. ALTER TABLE `t_base_user` ADD COLUMN `email_verify` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '邮箱是否已验证 0-未验证 1-已验证' AFTER `email`;
  4. -- 2017-07-11 laiyinghe DB:hr_saas
  5. -- 新建代发工资导入临时表。
  6. CREATE TABLE `t_temp_payroll` (
  7. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  8. `for_month` int(10) unsigned NOT NULL,
  9. `company_id` int(10) unsigned NOT NULL,
  10. `service_item` tinyint(3) unsigned NOT NULL,
  11. `user_name` varchar(16) NOT NULL,
  12. `bank_card` varchar(20) NOT NULL,
  13. `bank_name` varchar(32) NOT NULL,
  14. `wage` decimal(8,2) unsigned NOT NULL,
  15. `remark` varchar(64) DEFAULT NULL,
  16. `gen_time` datetime DEFAULT NULL,
  17. PRIMARY KEY (`id`),
  18. KEY `temp_payroll_comid_idx` (`company_id`)
  19. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导入临时表';
  20. -- 2017-07-11 laiyinghe DB:hr_saas
  21. -- 新建代发工资主表。
  22. CREATE TABLE `t_payroll_list` (
  23. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  24. `payroll_id` int(10) unsigned NOT NULL COMMENT '清单标识',
  25. `user_id` int(10) unsigned NOT NULL COMMENT '用户/员工标识',
  26. `bank_card` varchar(32) NOT NULL COMMENT '银行卡号',
  27. `bank_code` varchar(32) NOT NULL DEFAULT '' COMMENT '银行清算代码',
  28. `bank_name` varchar(32) NOT NULL COMMENT '银行中文名称',
  29. `wage` decimal(8,2) unsigned NOT NULL COMMENT '工资',
  30. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '工资发放状态',
  31. `remark` varchar(64) DEFAULT NULL COMMENT '备注',
  32. `gen_time` datetime DEFAULT NULL COMMENT '生成时间',
  33. `pay_times` tinyint(3) unsigned DEFAULT NULL COMMENT '尝试交易次数',
  34. `pay_no` varchar(64) DEFAULT NULL COMMENT '交易流水号',
  35. `pay_remark` varchar(256) DEFAULT NULL COMMENT '交易描述',
  36. `pay_time` datetime DEFAULT NULL COMMENT '交易时间',
  37. PRIMARY KEY (`id`),
  38. KEY `payroll_list_id_idx` (`payroll_id`)
  39. ) ENGINE=InnoDB AUTO_INCREMENT=3508 DEFAULT CHARSET=utf8 COMMENT='代发工资清单';
  40. -- 2017-07-11 laiyinghe DB:hr_saas
  41. -- 新建代发工资主表。CREATE TABLE `t_payroll` (
  42. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  43. `company_id` int(10) unsigned NOT NULL COMMENT '企业标识',
  44. `service_item` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用途、项目',
  45. `for_month` int(10) unsigned NOT NULL COMMENT '月份',
  46. `total_fee` decimal(10,2) unsigned NOT NULL COMMENT '总金额',
  47. `members` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '员工数',
  48. `pay_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '工资发放方式',
  49. `pay_result` varchar(32) DEFAULT NULL COMMENT '发薪结果描述',
  50. `status` tinyint(3) unsigned DEFAULT '0' COMMENT '状态',
  51. `remark` varchar(128) DEFAULT NULL COMMENT '备注',
  52. `gen_user` int(10) unsigned NOT NULL COMMENT '生成此数据的用户',
  53. `gen_time` datetime DEFAULT NULL COMMENT '生成时间',
  54. `verify_user` int(10) unsigned DEFAULT '0' COMMENT '审核人员',
  55. `verify_remark` varchar(64) DEFAULT '' COMMENT '审核意见描述',
  56. `verify_time` datetime DEFAULT NULL COMMENT '审核时间',
  57. PRIMARY KEY (`id`),
  58. KEY `payroll_companyid_idx` (`company_id`),
  59. KEY `payroll_month_idx` (`for_month`)
  60. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='代发工资主表';
  61. -- 2017-07-11 laiyinghe DB:hr_saas
  62. -- 新建企业员工表。
  63. CREATE TABLE `t_company_user` (
  64. `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  65. `company_id` int(10) unsigned NOT NULL COMMENT '公司标识',
  66. `user_name` varchar(16) NOT NULL COMMENT '员工姓名',
  67. `bank_card` varchar(20) NOT NULL COMMENT '银行卡号',
  68. `bank_name` varchar(32) NOT NULL,
  69. `status` tinyint(3) unsigned DEFAULT '0' COMMENT '员工状态(试用、正式、外包等)',
  70. `gen_time` datetime DEFAULT NULL,
  71. PRIMARY KEY (`user_id`),
  72. KEY `company_user_comId_idx` (`company_id`)
  73. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='企业的员工';
  74. -- 2017-04-20 laiyinghe DB:hr_saas
  75. -- 新建企业数据表。
  76. CREATE TABLE `t_company` (
  77. `company_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  78. `full_name` varchar(64) NOT NULL COMMENT '企业全称',
  79. `address` varchar(64) DEFAULT NULL COMMENT '公司地址',
  80. `business_license_img` varchar(128) DEFAULT NULL COMMENT '营业执照',
  81. `legal_person` varchar(16) DEFAULT NULL COMMENT '法人',
  82. `legal_idcard_img` varchar(128) DEFAULT NULL COMMENT '法人身份证图片',
  83. `create_uid` int(10) unsigned DEFAULT '0' COMMENT '创建此记录用户标识',
  84. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '状态,见ComUserStatus',
  85. `gen_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  86. PRIMARY KEY (`company_id`)
  87. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  88. -- 2017-04-20 laiyinghe DB:hr_saas
  89. -- 新建用户的权限表、用户角色的权限表。
  90. CREATE TABLE `t_privilege_user` (
  91. `user_id` int UNSIGNED NOT NULL COMMENT '用户ID' ,
  92. `role_id` int UNSIGNED NOT NULL COMMENT '角色ID' ,
  93. `create_uid` int UNSIGNED NOT NULL COMMENT '生成此权限的用户ID' ,
  94. `module_name` varchar(32) NULL DEFAULT '' COMMENT '模块名称PModule.pname' ,
  95. `privilege` varchar(64) NULL DEFAULT '' COMMENT '权限信息' ,
  96. `update_time` datetime NULL COMMENT '更新时间' ,
  97. INDEX `privilege_userid_idx` (`user_id`)
  98. )
  99. ;
  100. -- 2017-04-18 laiyinghe DB:hr_saas
  101. -- 新建角色的权限表。
  102. CREATE TABLE `t_privilege_role` (
  103. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  104. `role_id` int(10) unsigned NOT NULL COMMENT '角色ID',
  105. `module_name` varchar(32) NOT NULL COMMENT '模块名称PModule.pname',
  106. `privilege` varchar(64) NOT NULL COMMENT '权限信息',
  107. `create_uid` int(10) unsigned NOT NULL,
  108. `update_time` datetime DEFAULT NULL,
  109. PRIMARY KEY (`id`),
  110. KEY `privilege_roleid_idx` (`role_id`)
  111. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  112. CREATE TABLE `t_base_role` (
  113. `role_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  114. `role_name` varchar(32) NOT NULL COMMENT '角色名称',
  115. `role_desc` varchar(255) NOT NULL COMMENT '角色描述',
  116. `create_uid` int(10) unsigned NOT NULL COMMENT '创建用户的id',
  117. `enabled` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否可用',
  118. `create_time` datetime DEFAULT NULL,
  119. PRIMARY KEY (`role_id`)
  120. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  121. -- 2017-04-18 laiyinghe DB:hr_saas
  122. -- 新建基础用户表。
  123. CREATE TABLE `t_base_user` (
  124. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  125. `username` varchar(32) NOT NULL COMMENT '帐号',
  126. `password` varchar(32) NOT NULL,
  127. `nickname` varchar(32) DEFAULT NULL COMMENT '姓名或昵称',
  128. `company_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属公司标识',
  129. `create_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建者标识',
  130. `enabled` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否可用',
  131. `reg_time` datetime DEFAULT NULL COMMENT '注册时间',
  132. `login_time` datetime DEFAULT NULL COMMENT '最新登录时间',
  133. PRIMARY KEY (`id`),
  134. UNIQUE KEY `user_name_indx` (`username`)
  135. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;