operation.sql 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. ---- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓此位置加入最新修改的脚本↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  2. -- 2018-08-20 laiyinghe DB:hr_saas
  3. -- 新增表.
  4. CREATE TABLE `t_wxyj_interaction` (
  5. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  6. `summary_id` int(11) NOT NULL,
  7. `eid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'wxyj_employee表的ID',
  8. `com_userid` int(11) NOT NULL,
  9. `edec` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否减员数据的交互',
  10. `wxyj` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '五险一金类别',
  11. `wxyj_month` mediumint(9) NOT NULL DEFAULT '0' COMMENT '月份',
  12. `jh_opt` varchar(16) NOT NULL DEFAULT '',
  13. `email` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否邮件通知',
  14. `kefu_uid` int(11) NOT NULL DEFAULT '0' COMMENT '客服ID',
  15. `prof_uid` int(11) NOT NULL DEFAULT '0' COMMENT '专员ID',
  16. `kefu_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '处理状态',
  17. `prof_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '处理状态',
  18. `kefu_content` varchar(127) NOT NULL DEFAULT '' COMMENT '内容',
  19. `prof_content` varchar(127) NOT NULL DEFAULT '' COMMENT '内容',
  20. `kefu_time` datetime DEFAULT NULL,
  21. `prof_time` datetime DEFAULT NULL,
  22. PRIMARY KEY (`id`),
  23. KEY `wxyj_interaction_kefu_idx` (`kefu_uid`),
  24. KEY `wxyj_interaction_prof_idx` (`prof_uid`),
  25. KEY `wxyj_interaction_sumid_idx` (`summary_id`)
  26. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='专员客服交互表';
  27. -- 2018-08-08 laiyinghe DB:hr_saas
  28. -- 新增表.
  29. CREATE TABLE `t_wxyj_summary_kefu` (
  30. `summary_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '汇总数据ID',
  31. `kefu_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '客服ID',
  32. `opt_month` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '核算操作月份',
  33. KEY `wxyj_summary_id_idx` (`summary_id`),
  34. KEY `wxyj_summary_kefuid_idx` (`kefu_uid`)
  35. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='五险一金汇总数据与客服标识的关联表';
  36. -- 新增字段,索引
  37. ALTER TABLE `t_wxyj_employee`
  38. ADD COLUMN `kefu_uid` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '客服的ID' AFTER `summary_id`,
  39. ADD INDEX `wxyj_e_summayid_idx` (`summary_id`) ,
  40. ADD INDEX `wxyj_e_opt_month_idx` (`opt_month`) ,
  41. ADD INDEX `wxyj_e_city_idx` (`city_code`) ,
  42. ADD INDEX `wxyj_e_kefuid_idx` (`kefu_uid`) ;
  43. -- 新增字段
  44. ALTER TABLE `t_wxyj_employee_dec`
  45. ADD COLUMN `kefu_uid` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '客服用户ID' AFTER `summary_id`;
  46. -- 2018-07-31 laiyinghe DB:hr_saas
  47. -- 新增企业联系人表.
  48. CREATE TABLE `t_company_contact` (
  49. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  50. `company_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '企业ID',
  51. `uname` varchar(16) NOT NULL DEFAULT '' COMMENT '联系人姓名',
  52. `uphone` varchar(16) NOT NULL DEFAULT '' COMMENT '联系人手机号码',
  53. `uemail` varchar(32) NOT NULL DEFAULT '' COMMENT '联系人邮箱',
  54. `gen_user` varchar(255) NOT NULL DEFAULT '' COMMENT '操作用户',
  55. `update_time` datetime DEFAULT NULL,
  56. PRIMARY KEY (`id`),
  57. KEY `com_contact_cid_idx` (`company_id`)
  58. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='企业联系人表';
  59. -- 新增企业邮递信息表.
  60. CREATE TABLE `t_company_mail` (
  61. `company_id` int(10) unsigned NOT NULL,
  62. `muser` varchar(16) NOT NULL DEFAULT '' COMMENT '收件人姓名',
  63. `mphone` varchar(16) NOT NULL DEFAULT '' COMMENT '收件人电话',
  64. `maddress` varchar(64) NOT NULL DEFAULT '' COMMENT '收件地址',
  65. `zip_code` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '收件邮编',
  66. `opt_user` varchar(16) NOT NULL DEFAULT '' COMMENT '更新人',
  67. `update_time` datetime DEFAULT NULL,
  68. PRIMARY KEY (`company_id`)
  69. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='企业邮递信息';
  70. -- 2018-07-27 laiyinghe DB:hr_saas
  71. -- 新增专员报送日 配置表.
  72. CREATE TABLE `t_base_submit_day` (
  73. `city_code` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '城市代码',
  74. `use_submit` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '使用的报送日',
  75. `submit1` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '报送日',
  76. `submit2` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '报送日',
  77. `submit3` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '报送日',
  78. `opt_user` varchar(16) NOT NULL DEFAULT '' COMMENT '配置人',
  79. `update_time` datetime NOT NULL COMMENT '更新时间',
  80. PRIMARY KEY (`city_code`)
  81. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='专员报送日';
  82. -- 2018-07-19 laiyinghe DB:hr_saas
  83. -- 新增字段.
  84. ALTER TABLE `t_base_shebao`
  85. ADD COLUMN `app_use` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否适用于APP使用' AFTER `p_id`;
  86. -- 2018-07-09 laiyinghe DB:hr_saas
  87. -- 新增 增加专员ID字段, 增加客服ID字段.
  88. ALTER TABLE `t_wxyj_employee_summary`
  89. ADD COLUMN `prof_uid` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '专员的用户ID' AFTER `ent_id`,
  90. COMMENT='五险一金参缴主表';
  91. -- 2018-07-04 laiyinghe DB:hr_saas
  92. -- 新增 提交的导入增员的员工数据表.
  93. CREATE TABLE `t_wxyj_import_inc_member` (
  94. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  95. `inc_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '主表ID',
  96. `com_userid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '员工ID',
  97. `shebao_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '社保增员月份',
  98. `shebao_added_months` varchar(72) NOT NULL DEFAULT '' COMMENT '社保补缴月份',
  99. `fund_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '公积金月份',
  100. `fund_added_months` varchar(72) NOT NULL DEFAULT '' COMMENT '公积金补缴月份',
  101. `calced` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否已计算',
  102. `e_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 't_wxyj_employee表的ID',
  103. PRIMARY KEY (`id`),
  104. KEY `wxyj_import_incm_iid_idx` (`inc_id`)
  105. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='提交的导入增员的员工数据表.';
  106. -- 2018-07-04 laiyinghe DB:hr_saas
  107. -- 新增 提交导入的增员数据主表.
  108. CREATE TABLE `t_wxyj_import_inc` (
  109. `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  110. `temp_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '导入数据的主ID',
  111. `proxy_no` varchar(32) NOT NULL DEFAULT '' COMMENT '代缴ID',
  112. `city_code` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  113. `opt_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '操作月份',
  114. `ent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '企业ID',
  115. `prof_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '专员ID',
  116. `kefu_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '客服ID',
  117. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  118. `gen_time` datetime NOT NULL COMMENT '生成时间',
  119. `summary_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '计算生成的数据主ID',
  120. `calc_time` datetime NOT NULL COMMENT '完成计算时间',
  121. PRIMARY KEY (`id`),
  122. UNIQUE KEY `wxyj_import_inc_proxyno_idx` (`proxy_no`)
  123. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='提交导入的增员数据主表';
  124. -- 2018-06-27 laiyinghe DB:hr_saas
  125. -- 新增增减员导入主表.
  126. CREATE TABLE `t_wxyj_temp_inc_dec` (
  127. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  128. `create_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上传人',
  129. `file_path_name` varchar(128) NOT NULL DEFAULT '' COMMENT '文件',
  130. `gen_time` datetime NOT NULL COMMENT '创建时间',
  131. PRIMARY KEY (`id`)
  132. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='增减员导入主表';
  133. -- 新增增员导入的数据表.
  134. CREATE TABLE `t_wxyj_temp_inc_data` (
  135. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  136. `temp_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '主表ID',
  137. `company_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '企业ID',
  138. `city_code` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '城市代码',
  139. `param_id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '社保方案ID',
  140. `conflicts` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '数据冲突数',
  141. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '员工标识',
  142. `pcity` varchar(16) NOT NULL DEFAULT '' COMMENT '省份',
  143. `city` varchar(16) NOT NULL DEFAULT '' COMMENT '城市',
  144. `prof_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '专员的用户ID',
  145. `prof_user` varchar(16) NOT NULL DEFAULT '' COMMENT '社保专员',
  146. `company` varchar(32) NOT NULL DEFAULT '' COMMENT '客户名称',
  147. `username` varchar(20) NOT NULL DEFAULT '' COMMENT '姓名',
  148. `idcard` varchar(18) NOT NULL DEFAULT '' COMMENT '身份证号码',
  149. `gender` varchar(4) NOT NULL DEFAULT '' COMMENT '性别',
  150. `nation` varchar(16) NOT NULL DEFAULT '' COMMENT '民族',
  151. `hukou` varchar(4) NOT NULL DEFAULT '' COMMENT '户藉类型',
  152. `sbopt_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '社保操作月份',
  153. `sb_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '社保月份',
  154. `sbadded_month` varchar(32) NOT NULL DEFAULT '' COMMENT '社保补缴月份',
  155. `sb_radix` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '社保缴费基数',
  156. `sb_name` varchar(16) NOT NULL DEFAULT '' COMMENT '社保方案',
  157. `fund_optmonth` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '公积金操作月份',
  158. `fund_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '公积金月份',
  159. `fundadded_month` varchar(64) NOT NULL DEFAULT '' COMMENT '公积金补缴月份',
  160. `fund_radix` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '公积金缴费基数',
  161. `ent_ratio` decimal(6,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '单位比例',
  162. `p_ratio` decimal(6,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '个人比例',
  163. `note1` varchar(128) NOT NULL DEFAULT '' COMMENT '补充信息1',
  164. `note2` varchar(128) NOT NULL DEFAULT '' COMMENT '补充信息2',
  165. `note3` varchar(128) NOT NULL DEFAULT '' COMMENT '补充信息3',
  166. PRIMARY KEY (`id`),
  167. KEY `temp_inc_dec_id_idx` (`temp_id`)
  168. ) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8 COMMENT='增员导入的数据表';
  169. -- 新增 导入数据冲突的 数据表.
  170. CREATE TABLE `t_wxyj_temp_inc_dec_error` (
  171. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  172. `temp_id` int(11) NOT NULL DEFAULT '0' COMMENT '临时数据ID',
  173. `data_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '临时数据项ID',
  174. `err_code` varchar(16) NOT NULL DEFAULT '' COMMENT '冲突类型',
  175. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '与冲突的用户ID',
  176. `user_value` varchar(64) NOT NULL DEFAULT '' COMMENT '冲突值',
  177. `opt_value` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '冲突解决代码值',
  178. `notes` varchar(256) NOT NULL DEFAULT '' COMMENT '冲突描述',
  179. PRIMARY KEY (`id`)
  180. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  181. -- 新增 减员 导入的数据表.
  182. CREATE TABLE `t_wxyj_temp_dec_data` (
  183. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  184. `temp_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '主表ID',
  185. `company_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '企业ID',
  186. `city_code` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '城市代码',
  187. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '员工ID',
  188. `pcity` varchar(16) NOT NULL DEFAULT '' COMMENT '省份',
  189. `city` varchar(16) NOT NULL DEFAULT '' COMMENT '城市',
  190. `prof_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '专员的用户ID',
  191. `prof_user` varchar(16) NOT NULL DEFAULT '' COMMENT '社保专员',
  192. `company` varchar(32) NOT NULL DEFAULT '' COMMENT '客户名称',
  193. `username` varchar(20) NOT NULL DEFAULT '' COMMENT '姓名',
  194. `idcard` varchar(18) NOT NULL DEFAULT '' COMMENT '身份证号码',
  195. `gender` varchar(4) NOT NULL DEFAULT '' COMMENT '性别',
  196. `sbopt_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '社保操作月份',
  197. `sb_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '社保月份',
  198. `fund_optmonth` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '公积金操作月份',
  199. `fund_month` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '公积金月份',
  200. `note1` varchar(128) NOT NULL DEFAULT '' COMMENT '补充信息1',
  201. `note2` varchar(128) NOT NULL DEFAULT '' COMMENT '补充信息2',
  202. `note3` varchar(128) NOT NULL DEFAULT '' COMMENT '补充信息3',
  203. `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '数据说明',
  204. PRIMARY KEY (`id`),
  205. KEY `temp_dec_id_idx` (`temp_id`)
  206. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='减员导入的数据表';
  207. -- 2018-06-26 laiyinghe DB:hr_saas
  208. -- 新增专员负责的城市表.
  209. CREATE TABLE `t_base_user_prof` (
  210. `puid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '专员ID',
  211. `setting_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '设置人ID',
  212. `pcity_code` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '省份代码',
  213. `city_codes` varchar(128) NOT NULL DEFAULT '' COMMENT '负责城市列表',
  214. KEY `prof_uid_idx` (`puid`)
  215. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='专员负责城市表';
  216. -- 新增客服业务表.
  217. CREATE TABLE `t_base_user_kefu` (
  218. `kefu_id` int(10) unsigned NOT NULL DEFAULT '0',
  219. `setting_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配置人ID',
  220. `company_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '企业标识',
  221. `business` varchar(32) NOT NULL DEFAULT '' COMMENT '业务',
  222. KEY `kefu_busi_uid_idx` (`kefu_id`)
  223. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客服业务表';
  224. -- 2018-06-25 laiyinghe DB:hr_saas
  225. -- 用户表增加字段
  226. ALTER TABLE `t_base_user`
  227. ADD COLUMN `u_role` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户工作角色(0企业用户 1客服 2专员)' AFTER `enabled`;
  228. ALTER TABLE `t_base_user`
  229. MODIFY COLUMN `email` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮箱' AFTER `password`,
  230. MODIFY COLUMN `nickname` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '姓名或昵称' AFTER `email_verify`;
  231. -- 2018-06-11 laiyinghe DB:hr_saas
  232. -- 补缴的结果表.
  233. CREATE TABLE `t_wxyj_added_result` (
  234. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  235. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
  236. `wxyj` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '社保OR公积金',
  237. `opt_month` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '核算月份',
  238. `added_month` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '补缴月份',
  239. `added_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '补缴结果',
  240. `gen_time` datetime NOT NULL COMMENT '生成时间',
  241. PRIMARY KEY (`id`),
  242. KEY `added_result_uid_idx` (`user_id`)
  243. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='补缴的结果表';
  244. -- 2018-04-11 laiyinghe DB:hr_saas
  245. -- 增加计算任务时,有批次号,因为前端支持多个城市一起生成.
  246. ALTER TABLE `t_wxyj_task`
  247. ADD COLUMN `batch_no` varchar(12) NOT NULL DEFAULT '' COMMENT '批次' AFTER `ask_user`;
  248. -- 2018-04-09 laiyinghe DB:hr_saas
  249. -- 增加计算任务生成时,顺便生成每项头.
  250. ALTER TABLE `t_wxyj_employee_summary`
  251. DROP COLUMN `shebao_head`,
  252. MODIFY COLUMN `remark` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '说明' AFTER `update_time`,
  253. ADD COLUMN `shebao_head` varchar(255) NOT NULL DEFAULT '' COMMENT '社保表头项' AFTER `update_time`;
  254. -- 2018-03-28 laiyinghe DB:hr_saas
  255. -- 增加补缴的兼容配置字段,补缴与正常交是一样的数据,则用这些字段.
  256. ALTER TABLE `t_base_shebao`
  257. MODIFY COLUMN `shebao_desc` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT ' 社保参数描述' AFTER `dec_day`,
  258. ADD COLUMN `repay_charge` decimal(6,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '补缴服务费' AFTER `repay_num`,
  259. ADD COLUMN `repay_desc` varchar(256) NOT NULL DEFAULT '' COMMENT '补缴描述' AFTER `repay_charge`;
  260. -- 2018-03-19 laiyinghe DB:hr_saas
  261. -- 修改员工方案表, 参保状态一个分两个.
  262. ALTER TABLE `t_wxyj_employee_plan`
  263. CHANGE COLUMN `fund_buy` `shebao_buy` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否参保社保' AFTER `shebao_uptime`,
  264. CHANGE COLUMN `status` `fund_buy` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否参缴公积金' AFTER `fund_pratio`;
  265. ALTER TABLE `t_base_user` ADD COLUMN `email` VARCHAR(64) DEFAULT NULL COMMENT '邮箱' AFTER `password`;
  266. ALTER TABLE `t_base_user` ADD COLUMN `email_verify` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '邮箱是否已验证 0-未验证 1-已验证' AFTER `email`;
  267. -- 2017-07-11 laiyinghe DB:hr_saas
  268. -- 新建代发工资导入临时表。
  269. CREATE TABLE `t_temp_payroll` (
  270. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  271. `for_month` int(10) unsigned NOT NULL,
  272. `company_id` int(10) unsigned NOT NULL,
  273. `service_item` tinyint(3) unsigned NOT NULL,
  274. `user_name` varchar(16) NOT NULL,
  275. `bank_card` varchar(20) NOT NULL,
  276. `bank_name` varchar(32) NOT NULL,
  277. `wage` decimal(8,2) unsigned NOT NULL,
  278. `remark` varchar(64) DEFAULT NULL,
  279. `gen_time` datetime DEFAULT NULL,
  280. PRIMARY KEY (`id`),
  281. KEY `temp_payroll_comid_idx` (`company_id`)
  282. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导入临时表';
  283. -- 2017-07-11 laiyinghe DB:hr_saas
  284. -- 新建代发工资主表。
  285. CREATE TABLE `t_payroll_list` (
  286. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  287. `payroll_id` int(10) unsigned NOT NULL COMMENT '清单标识',
  288. `user_id` int(10) unsigned NOT NULL COMMENT '用户/员工标识',
  289. `bank_card` varchar(32) NOT NULL COMMENT '银行卡号',
  290. `bank_code` varchar(32) NOT NULL DEFAULT '' COMMENT '银行清算代码',
  291. `bank_name` varchar(32) NOT NULL COMMENT '银行中文名称',
  292. `wage` decimal(8,2) unsigned NOT NULL COMMENT '工资',
  293. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '工资发放状态',
  294. `remark` varchar(64) DEFAULT NULL COMMENT '备注',
  295. `gen_time` datetime DEFAULT NULL COMMENT '生成时间',
  296. `pay_times` tinyint(3) unsigned DEFAULT NULL COMMENT '尝试交易次数',
  297. `pay_no` varchar(64) DEFAULT NULL COMMENT '交易流水号',
  298. `pay_remark` varchar(256) DEFAULT NULL COMMENT '交易描述',
  299. `pay_time` datetime DEFAULT NULL COMMENT '交易时间',
  300. PRIMARY KEY (`id`),
  301. KEY `payroll_list_id_idx` (`payroll_id`)
  302. ) ENGINE=InnoDB AUTO_INCREMENT=3508 DEFAULT CHARSET=utf8 COMMENT='代发工资清单';
  303. -- 2017-07-11 laiyinghe DB:hr_saas
  304. -- 新建代发工资主表。CREATE TABLE `t_payroll` (
  305. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  306. `company_id` int(10) unsigned NOT NULL COMMENT '企业标识',
  307. `service_item` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用途、项目',
  308. `for_month` int(10) unsigned NOT NULL COMMENT '月份',
  309. `total_fee` decimal(10,2) unsigned NOT NULL COMMENT '总金额',
  310. `members` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '员工数',
  311. `pay_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '工资发放方式',
  312. `pay_result` varchar(32) DEFAULT NULL COMMENT '发薪结果描述',
  313. `status` tinyint(3) unsigned DEFAULT '0' COMMENT '状态',
  314. `remark` varchar(128) DEFAULT NULL COMMENT '备注',
  315. `gen_user` int(10) unsigned NOT NULL COMMENT '生成此数据的用户',
  316. `gen_time` datetime DEFAULT NULL COMMENT '生成时间',
  317. `verify_user` int(10) unsigned DEFAULT '0' COMMENT '审核人员',
  318. `verify_remark` varchar(64) DEFAULT '' COMMENT '审核意见描述',
  319. `verify_time` datetime DEFAULT NULL COMMENT '审核时间',
  320. PRIMARY KEY (`id`),
  321. KEY `payroll_companyid_idx` (`company_id`),
  322. KEY `payroll_month_idx` (`for_month`)
  323. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='代发工资主表';
  324. -- 2017-07-11 laiyinghe DB:hr_saas
  325. -- 新建企业员工表。
  326. CREATE TABLE `t_company_user` (
  327. `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  328. `company_id` int(10) unsigned NOT NULL COMMENT '公司标识',
  329. `user_name` varchar(16) NOT NULL COMMENT '员工姓名',
  330. `bank_card` varchar(20) NOT NULL COMMENT '银行卡号',
  331. `bank_name` varchar(32) NOT NULL,
  332. `status` tinyint(3) unsigned DEFAULT '0' COMMENT '员工状态(试用、正式、外包等)',
  333. `gen_time` datetime DEFAULT NULL,
  334. PRIMARY KEY (`user_id`),
  335. KEY `company_user_comId_idx` (`company_id`)
  336. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='企业的员工';
  337. -- 2017-04-20 laiyinghe DB:hr_saas
  338. -- 新建企业数据表。
  339. CREATE TABLE `t_company` (
  340. `company_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  341. `full_name` varchar(64) NOT NULL COMMENT '企业全称',
  342. `address` varchar(64) DEFAULT NULL COMMENT '公司地址',
  343. `business_license_img` varchar(128) DEFAULT NULL COMMENT '营业执照',
  344. `legal_person` varchar(16) DEFAULT NULL COMMENT '法人',
  345. `legal_idcard_img` varchar(128) DEFAULT NULL COMMENT '法人身份证图片',
  346. `create_uid` int(10) unsigned DEFAULT '0' COMMENT '创建此记录用户标识',
  347. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '状态,见ComUserStatus',
  348. `gen_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  349. PRIMARY KEY (`company_id`)
  350. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  351. -- 2017-04-20 laiyinghe DB:hr_saas
  352. -- 新建用户的权限表、用户角色的权限表。
  353. CREATE TABLE `t_privilege_user` (
  354. `user_id` int UNSIGNED NOT NULL COMMENT '用户ID' ,
  355. `role_id` int UNSIGNED NOT NULL COMMENT '角色ID' ,
  356. `create_uid` int UNSIGNED NOT NULL COMMENT '生成此权限的用户ID' ,
  357. `module_name` varchar(32) NULL DEFAULT '' COMMENT '模块名称PModule.pname' ,
  358. `privilege` varchar(64) NULL DEFAULT '' COMMENT '权限信息' ,
  359. `update_time` datetime NULL COMMENT '更新时间' ,
  360. INDEX `privilege_userid_idx` (`user_id`)
  361. )
  362. ;
  363. -- 2017-04-18 laiyinghe DB:hr_saas
  364. -- 新建角色的权限表。
  365. CREATE TABLE `t_privilege_role` (
  366. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  367. `role_id` int(10) unsigned NOT NULL COMMENT '角色ID',
  368. `module_name` varchar(32) NOT NULL COMMENT '模块名称PModule.pname',
  369. `privilege` varchar(64) NOT NULL COMMENT '权限信息',
  370. `create_uid` int(10) unsigned NOT NULL,
  371. `update_time` datetime DEFAULT NULL,
  372. PRIMARY KEY (`id`),
  373. KEY `privilege_roleid_idx` (`role_id`)
  374. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  375. CREATE TABLE `t_base_role` (
  376. `role_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  377. `role_name` varchar(32) NOT NULL COMMENT '角色名称',
  378. `role_desc` varchar(255) NOT NULL COMMENT '角色描述',
  379. `create_uid` int(10) unsigned NOT NULL COMMENT '创建用户的id',
  380. `enabled` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否可用',
  381. `create_time` datetime DEFAULT NULL,
  382. PRIMARY KEY (`role_id`)
  383. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  384. -- 2017-04-18 laiyinghe DB:hr_saas
  385. -- 新建基础用户表。
  386. CREATE TABLE `t_base_user` (
  387. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  388. `username` varchar(32) NOT NULL COMMENT '帐号',
  389. `password` varchar(32) NOT NULL,
  390. `nickname` varchar(32) DEFAULT NULL COMMENT '姓名或昵称',
  391. `company_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属公司标识',
  392. `create_uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建者标识',
  393. `enabled` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否可用',
  394. `reg_time` datetime DEFAULT NULL COMMENT '注册时间',
  395. `login_time` datetime DEFAULT NULL COMMENT '最新登录时间',
  396. PRIMARY KEY (`id`),
  397. UNIQUE KEY `user_name_indx` (`username`)
  398. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;