jiapeng преди 7 години
родител
ревизия
6bc7af682a
променени са 1 файла, в които са добавени 1348 реда и са изтрити 0 реда
  1. 1348 0
      src/main/resources/database.sql

+ 1348 - 0
src/main/resources/database.sql

@ -0,0 +1,1348 @@
1
/*
2
init at 20170501
3
*/
4
DROP TABLE IF EXISTS accessory;
5
CREATE TABLE accessory (
6
	accessory_id char(32) NOT NULL,
7
	accessory_src varchar(255) NOT NULL,
8
	operation_id char(32) NOT NULL,
9
	professor_id char(32) NOT NULL,
10
	create_time char(14) NOT NULL,
11
	accessory_name varchar(255)
12
);
13
COMMENT ON TABLE accessory IS '资源交易附件表(目前没用)';
14
COMMENT ON COLUMN accessory.accessory_id IS '附件ID';
15
COMMENT ON COLUMN accessory.accessory_src IS '附件路径';
16
COMMENT ON COLUMN accessory.operation_id IS '资源交易ID';
17
COMMENT ON COLUMN accessory.professor_id IS '用户ID';
18
COMMENT ON COLUMN accessory.create_time IS '创建时间';
19
COMMENT ON COLUMN accessory.accessory_name IS '附件名称';
20
-- ----------------------------
21
-- Table structure for article
22
-- ----------------------------
23
DROP TABLE IF EXISTS article;
24
CREATE TABLE article (
25
	article_id char(32) NOT NULL,
26
	professor_id char(32),
27
	article_title text,
28
	article_content text,
29
	subject text,
30
	industry text,
31
	create_time char(14) NOT NULL,
32
	modify_time char(14) NOT NULL,
33
	article_img varchar(255),
34
	org_id char(32),
35
	article_type char(1),
36
	article_agree int4 NOT NULL,
37
	page_views int4,
38
	status char(1),
39
	publish_time char(14)
40
);
41
COMMENT ON TABLE article IS '科研文章表';
42
COMMENT ON COLUMN article.article_id IS '文章ID';
43
COMMENT ON COLUMN article.professor_id IS '发布人ID';
44
COMMENT ON COLUMN article.article_title IS '文章标题';
45
COMMENT ON COLUMN article.article_content IS '文章内容';
46
COMMENT ON COLUMN article.subject IS '关键词';
47
COMMENT ON COLUMN article.industry IS '应用行业';
48
COMMENT ON COLUMN article.create_time IS '创建时间';
49
COMMENT ON COLUMN article.modify_time IS '修改时间';
50
COMMENT ON COLUMN article.article_img IS '文章封面图片';
51
COMMENT ON COLUMN article.org_id IS '企业ID';
52
COMMENT ON COLUMN article.article_type IS '文章类型(1-个人文章,2-企业文章)';
53
COMMENT ON COLUMN article.article_agree IS '文章被点赞数量';
54
COMMENT ON COLUMN article.page_views IS '浏览量';
55
COMMENT ON COLUMN article.status IS '文章状态(0-草稿,1-发布,2-定时发布,3-删除,4-关闭)';
56
COMMENT ON COLUMN article.publish_time IS '文章发布时间';
57
-- ----------------------------
58
-- Table structure for article_agree
59
-- ----------------------------
60
DROP TABLE IF EXISTS article_agree;
61
CREATE TABLE article_agree (
62
	operate_id char(32) NOT NULL,
63
	article_id char(32) NOT NULL,
64
	create_time char(14) NOT NULL
65
);
66
COMMENT ON TABLE article_agree IS '文章点赞表';
67
COMMENT ON COLUMN article_agree.operate_id IS '点赞人的ID';
68
COMMENT ON COLUMN article_agree.article_id IS '被点赞的文章ID';
69
COMMENT ON COLUMN article_agree.create_time IS '点赞时间';
70

71

72

73
-- ----------------------------
74
-- Table structure for assess
75
-- ----------------------------
76
DROP TABLE IF EXISTS assess;
77
CREATE TABLE assess (
78
	assess_id char(32) NOT NULL,
79
	star_level int2 NOT NULL,
80
	descp text,
81
	operation_id char(32) NOT NULL,
82
	resource_id char(32) NOT NULL,
83
	professor_id char(32) NOT NULL,
84
	create_time char(14) NOT NULL
85
);
86
COMMENT ON TABLE assess IS '交易评价表(暂时没用)';
87
COMMENT ON COLUMN assess.assess_id IS '评价ID';
88
COMMENT ON COLUMN assess.star_level IS '评价星级';
89
COMMENT ON COLUMN assess.descp IS '详细评价';
90
COMMENT ON COLUMN assess.operation_id IS '交易ID';
91
COMMENT ON COLUMN assess.resource_id IS '资源ID';
92
COMMENT ON COLUMN assess.professor_id IS '用户ID';
93
COMMENT ON COLUMN assess.create_time IS '创建时间';
94

95
-- ----------------------------
96
-- Table structure for auth_apply
97
-- ----------------------------
98
DROP TABLE IF EXISTS auth_apply;
99
CREATE TABLE auth_apply (
100
	auth_apply_id char(32) NOT NULL,
101
	professor_id char(32) NOT NULL,
102
	solve_status int2 DEFAULT 0 NOT NULL,
103
	create_time char(14) NOT NULL,
104
	apply_type int2 NOT NULL
105
);
106
COMMENT ON TABLE auth_apply IS '认证申请表';
107
COMMENT ON COLUMN auth_apply.auth_apply_id IS '认证申请ID';
108
COMMENT ON COLUMN auth_apply.professor_id IS '申请人ID(可以是个人或企业用户)';
109
COMMENT ON COLUMN auth_apply.solve_status IS '解决状态(-1-认证失败,1-待处理,2-处理中,3-认证通过)';
110
COMMENT ON COLUMN auth_apply.create_time IS '申请时间';
111
COMMENT ON COLUMN auth_apply.apply_type IS '申请认证类型(1-实名认证,2-专家认证,3-企业认证)';
112

113
DROP TABLE IF EXISTS auth_image;
114
CREATE TABLE auth_image (
115
	auth_image_id char(32) NOT NULL,
116
	auth_apply_id char(32) NOT NULL,
117
	auth_src varchar(255) NOT NULL
118
);
119
COMMENT ON TABLE auth_image IS '认证申请图片表';
120
COMMENT ON COLUMN auth_image.auth_image_id IS '认证图片ID';
121
COMMENT ON COLUMN auth_image.auth_apply_id IS '认证申请ID';
122
COMMENT ON COLUMN auth_image.auth_src IS '认证图片路径';
123

124
DROP TABLE IF EXISTS complain;
125
CREATE TABLE complain (
126
	complain_id char(32) NOT NULL,
127
	professor_id char(32) NOT NULL,
128
	complain_contant varchar(255) NOT NULL,
129
	appellee char(32),
130
	create_time char(14) NOT NULL,
131
	complain_type int2
132
);
133
COMMENT ON TABLE complain IS '投诉表';
134
COMMENT ON COLUMN complain.complain_id IS '投诉ID';
135
COMMENT ON COLUMN complain.professor_id IS '投诉人ID';
136
COMMENT ON COLUMN complain.complain_contant IS '投诉内容';
137
COMMENT ON COLUMN complain.appellee IS '被投诉ID';
138
COMMENT ON COLUMN complain.create_time IS '投诉时间';
139
COMMENT ON COLUMN complain.complain_type IS '投诉类型(0-建议,1-投诉)';
140

141
-- ----------------------------
142
-- Table structure for consult
143
-- ----------------------------
144
DROP TABLE IF EXISTS consult;
145
CREATE TABLE consult (
146
	consult_id char(32) NOT NULL,
147
	consult_type varchar(255) NOT NULL,
148
	consult_title varchar(255) NOT NULL,
149
	consult_contant text NOT NULL,
150
	create_time char(14) NOT NULL,
151
	professor_id char(32),
152
	consultant_id char(32) NOT NULL,
153
	consult_status int2,
154
	finish_time char(14),
155
	assess_status int2,
156
	assess_star int2,
157
	assess_contant text,
158
	assess_time char(14),
159
	thanks_status int2,
160
	thanks_money numeric(24,2),
161
	thanks_time char(14),
162
	revovery_time char(14),
163
	read_status int2 NOT NULL,
164
	demand_id char(32)
165
);
166
COMMENT ON TABLE consult IS '咨询表';
167
COMMENT ON COLUMN consult.consult_id IS '咨询ID';
168
COMMENT ON COLUMN consult.consult_type IS '咨询类型';
169
COMMENT ON COLUMN consult.consult_title IS '咨询主题';
170
COMMENT ON COLUMN consult.consult_contant IS '咨询内容';
171
COMMENT ON COLUMN consult.create_time IS '创建时间';
172
COMMENT ON COLUMN consult.professor_id IS '专家ID';
173
COMMENT ON COLUMN consult.consultant_id IS '咨询者ID';
174
COMMENT ON COLUMN consult.consult_status IS '咨询状态(0-进行中,1-已完成,2-待回复,3-已谢绝)';
175
COMMENT ON COLUMN consult.finish_time IS '完成时间';
176
COMMENT ON COLUMN consult.assess_status IS '评价状态(0-待评价,1-已评价)';
177
COMMENT ON COLUMN consult.assess_star IS '评价星级';
178
COMMENT ON COLUMN consult.assess_contant IS '评价内容';
179
COMMENT ON COLUMN consult.assess_time IS '评价时间';
180
COMMENT ON COLUMN consult.thanks_status IS '感谢状态(0-未感谢,1-以感谢)';
181
COMMENT ON COLUMN consult.thanks_money IS '感谢金额';
182
COMMENT ON COLUMN consult.thanks_time IS '感谢时间';
183
COMMENT ON COLUMN consult.revovery_time IS '最后回复时间';
184
COMMENT ON COLUMN consult.read_status IS '查看状态(0-未查看,1-已查看)';
185
COMMENT ON COLUMN consult.demand_id IS '需求ID';
186

187
-- ----------------------------
188
-- Table structure for consult_reject
189
-- ----------------------------
190
DROP TABLE IF EXISTS consult_reject;
191
CREATE TABLE consult_reject (
192
	reject_id char(32) NOT NULL,
193
	rejector char(32) NOT NULL,
194
	consult_id char(32) NOT NULL,
195
	sort int4 NOT NULL,
196
	reject_reason varchar(255) NOT NULL
197
);
198
COMMENT ON TABLE consult_reject IS '咨询谢绝表(谢绝理由)';
199
COMMENT ON COLUMN consult_reject.reject_id IS '拒绝id';
200
COMMENT ON COLUMN consult_reject.rejector IS '拒绝者';
201
COMMENT ON COLUMN consult_reject.consult_id IS '咨询ID';
202
COMMENT ON COLUMN consult_reject.sort IS '排序字段';
203
COMMENT ON COLUMN consult_reject.reject_reason IS '谢绝理由';
204

205
-- ----------------------------
206
-- Table structure for data_dict
207
-- ----------------------------
208
DROP TABLE IF EXISTS data_dict;
209
CREATE TABLE data_dict (
210
	dict_code varchar(32) NOT NULL,
211
	actived char(1) NOT NULL,
212
	code varchar(32) NOT NULL,
213
	caption varchar(255) NOT NULL,
214
	parent_code varchar(32),
215
	descp text
216
);
217
COMMENT ON TABLE data_dict IS '数据字典';
218
COMMENT ON COLUMN data_dict.dict_code IS '属性分类(学术领域-SUBJECT,应用行业-INDUSTRY,省份-PROVINCE,城市-ADDRESS,研究方向-RESEARCH_AREA)';
219
COMMENT ON COLUMN data_dict.actived IS '激活状态';
220
COMMENT ON COLUMN data_dict.code IS '唯一ID';
221
COMMENT ON COLUMN data_dict.caption IS '属性名称';
222
COMMENT ON COLUMN data_dict.parent_code IS '父ID';
223
COMMENT ON COLUMN data_dict.descp IS '详细描述';
224

225
-- ----------------------------
226
-- Table structure for demand
227
-- ----------------------------
228
DROP TABLE IF EXISTS demand;
229
CREATE TABLE demand (
230
	demand_id char(32) NOT NULL,
231
	demander char(32) NOT NULL,
232
	demand_aim char(1) NOT NULL,
233
	demand_type char(1) NOT NULL,
234
	demand_title varchar(255) NOT NULL,
235
	demand_content text,
236
	demand_status char(1) NOT NULL,
237
	order_key int8 NOT NULL,
238
	create_time char(14) NOT NULL,
239
	close_time char(14),
240
	org_id char(32)
241
);
242
COMMENT ON TABLE demand IS '需求表';
243
COMMENT ON COLUMN demand.demand_id IS '需求ID';
244
COMMENT ON COLUMN demand.demander IS '需求者';
245
COMMENT ON COLUMN demand.demand_aim IS '需求目的(1-技术,2-资源,3-其他)';
246
COMMENT ON COLUMN demand.demand_type IS '需求类型(1-个人,2-企业)';
247
COMMENT ON COLUMN demand.demand_title IS '需求主题';
248
COMMENT ON COLUMN demand.demand_content IS '需求内容';
249
COMMENT ON COLUMN demand.demand_status IS '需求状态(0-关闭,1-发布中)';
250
COMMENT ON COLUMN demand.order_key IS '排序字段';
251
COMMENT ON COLUMN demand.create_time IS '发布时间';
252
COMMENT ON COLUMN demand.close_time IS '关闭时间';
253
COMMENT ON COLUMN demand.org_id IS '企业ID';
254

255
-- ----------------------------
256
-- Table structure for demand_sub_or_indus
257
-- ----------------------------
258
DROP TABLE IF EXISTS demand_sub_or_indus;
259
CREATE TABLE demand_sub_or_indus (
260
	id char(32) NOT NULL,
261
	sort int4 NOT NULL,
262
	sub_or_indus varchar(255) NOT NULL,
263
	demand_id char(32) NOT NULL
264
);
265
COMMENT ON TABLE demand_sub_or_indus IS '需求的学术领域或应用行业';
266
COMMENT ON COLUMN demand_sub_or_indus.id IS '主键ID';
267
COMMENT ON COLUMN demand_sub_or_indus.sort IS '排序字段';
268
COMMENT ON COLUMN demand_sub_or_indus.sub_or_indus IS '学术领域或应用行业';
269
COMMENT ON COLUMN demand_sub_or_indus.demand_id IS '需求ID';
270

271
-- ----------------------------
272
-- Table structure for dict_city
273
-- ----------------------------
274
DROP TABLE IF EXISTS dict_city;
275
CREATE TABLE dict_city (
276
	dict_code varchar(32) NOT NULL,
277
	caption varchar(255) NOT NULL,
278
	parent_code varchar(32)
279
);
280
COMMENT ON TABLE dict_city IS '省份-城市二级数据字典';
281
COMMENT ON COLUMN dict_city.dict_code IS '城市代码';
282
COMMENT ON COLUMN dict_city.caption IS '城市名称';
283
COMMENT ON COLUMN dict_city.parent_code IS '上级代码';
284

285
-- ----------------------------
286
-- Table structure for dict_meta
287
-- ----------------------------
288
DROP TABLE IF EXISTS dict_meta;
289
CREATE TABLE dict_meta (
290
	readonly char(1) NOT NULL,
291
	code varchar(32) NOT NULL,
292
	name varchar(255) NOT NULL,
293
	tree char(1) NOT NULL,
294
	descp text,
295
	create_time char(14) NOT NULL,
296
	modify_time char(14) NOT NULL
297
);
298

299
-- ----------------------------
300
-- Table structure for growth_log
301
-- ----------------------------
302
DROP TABLE IF EXISTS growth_log;
303
CREATE TABLE growth_log (
304
	id char(32) NOT NULL,
305
	professor_id char(32) NOT NULL,
306
	operate varchar(4),
307
	score int4,
308
	sign_in_days int4,
309
	create_time char(14) NOT NULL,
310
	invite_pro char(32)
311
);
312
COMMENT ON TABLE growth_log IS '用户积分成长记录表';
313
COMMENT ON COLUMN growth_log.id IS '主键ID';
314
COMMENT ON COLUMN growth_log.professor_id IS '用户ID';
315
COMMENT ON COLUMN growth_log.operate IS '操作代码(详细见积分规则)';
316
COMMENT ON COLUMN growth_log.score IS '分值';
317
COMMENT ON COLUMN growth_log.sign_in_days IS '签到天数';
318
COMMENT ON COLUMN growth_log.create_time IS '创建时间';
319
COMMENT ON COLUMN growth_log.invite_pro IS '邀请的用户';
320

321
-- ----------------------------
322
-- Table structure for honor
323
-- ----------------------------
324
DROP TABLE IF EXISTS honor;
325
CREATE TABLE honor (
326
	id char(32) NOT NULL,
327
	year char(4),
328
	name text NOT NULL,
329
	professor_id char(32) NOT NULL,
330
	descp text
331
);
332
COMMENT ON TABLE honor IS '获得奖项';
333
COMMENT ON COLUMN honor.year IS '获奖年份';
334
COMMENT ON COLUMN honor.name IS '获奖名称';
335
COMMENT ON COLUMN honor.professor_id IS '用户ID';
336
COMMENT ON COLUMN honor.descp IS '详细描述';
337

338
-- ----------------------------
339
-- Table structure for image
340
-- ----------------------------
341
DROP TABLE IF EXISTS image;
342
CREATE TABLE image (
343
	image_id char(32) NOT NULL,
344
	image_src varchar(255) NOT NULL,
345
	resource_id char(32) NOT NULL
346
);
347
COMMENT ON TABLE image IS '资源图片表';
348
COMMENT ON COLUMN image.image_id IS '图片ID';
349
COMMENT ON COLUMN image.image_src IS '图片路径';
350
COMMENT ON COLUMN image.resource_id IS '资源ID';
351

352

353
-- ----------------------------
354
-- Table structure for leave_word
355
-- ----------------------------
356
DROP TABLE IF EXISTS leave_word;
357
CREATE TABLE leave_word (
358
	id char(32) NOT NULL,
359
	content text NOT NULL,
360
	sender char(32) NOT NULL,
361
	article_id char(32) NOT NULL,
362
	order_key int8 NOT NULL,
363
	create_time char(14) NOT NULL
364
);
365
COMMENT ON TABLE leave_word IS '文章留言表';
366
COMMENT ON COLUMN leave_word.content IS '留言内容';
367
COMMENT ON COLUMN leave_word.sender IS '留言人ID';
368
COMMENT ON COLUMN leave_word.article_id IS '文章ID';
369
COMMENT ON COLUMN leave_word.order_key IS '排序字段';
370
COMMENT ON COLUMN leave_word.create_time IS '留言时间';
371

372
-- ----------------------------
373
-- Table structure for luser
374
-- ----------------------------
375
DROP TABLE IF EXISTS luser;
376
CREATE TABLE luser (
377
	id char(32) NOT NULL,
378
	email varchar(50),
379
	mobile_phone char(11),
380
	passwd char(32) NOT NULL,
381
	user_type char(1) NOT NULL,
382
	create_time char(14),
383
	invite_code varchar(32),
384
	send_mail_status int2 DEFAULT 0,
385
	inviter_id char(32),
386
	active_time char(14)
387
);
388
COMMENT ON TABLE luser IS '个人用户表';
389
COMMENT ON COLUMN luser.id IS '个人用户ID';
390
COMMENT ON COLUMN luser.email IS '注册邮箱';
391
COMMENT ON COLUMN luser.mobile_phone IS '注册手机';
392
COMMENT ON COLUMN luser.passwd IS '密码';
393
COMMENT ON COLUMN luser.user_type IS '用户类型(0-个人用户,1-企业用户)';
394
COMMENT ON COLUMN luser.create_time IS '创建时间';
395
COMMENT ON COLUMN luser.invite_code IS '邀请码';
396
COMMENT ON COLUMN luser.send_mail_status IS '是否发送邀请邮件(0-未发送,1-已发送)';
397
COMMENT ON COLUMN luser.inviter_id IS '邀请人ID';
398
COMMENT ON COLUMN luser.active_time IS '激活时间';
399

400
-- ----------------------------
401
-- Table structure for messages
402
-- ----------------------------
403
DROP TABLE IF EXISTS messages;
404
CREATE TABLE messages (
405
	message_id char(32) NOT NULL,
406
	operation_id char(32) NOT NULL,
407
	professor_id char(32) NOT NULL,
408
	leave_word text,
409
	create_time char(14) NOT NULL
410
);
411
COMMENT ON TABLE messages IS '交易留言信息(目前没用)';
412
COMMENT ON COLUMN messages.message_id IS '信息ID';
413
COMMENT ON COLUMN messages.operation_id IS '交易ID';
414
COMMENT ON COLUMN messages.professor_id IS '留言用户ID';
415
COMMENT ON COLUMN messages.leave_word IS '留言内容';
416
COMMENT ON COLUMN messages.create_time IS '创建时间';
417

418
-- ----------------------------
419
-- Table structure for operate_service_file
420
-- ----------------------------
421
DROP TABLE IF EXISTS operate_service_file;
422
CREATE TABLE operate_service_file (
423
	service_file_id char(32) NOT NULL,
424
	service_log_id char(32) NOT NULL,
425
	file_src varchar(255) NOT NULL,
426
	file_name varchar(255) NOT NULL
427
);
428
COMMENT ON TABLE operate_service_file IS '服务记录附件表';
429
COMMENT ON COLUMN operate_service_file.service_file_id IS '服务附件ID';
430
COMMENT ON COLUMN operate_service_file.service_log_id IS '服务记录ID';
431
COMMENT ON COLUMN operate_service_file.file_src IS '文件路径';
432
COMMENT ON COLUMN operate_service_file.file_name IS '文件名称';
433

434
-- ----------------------------
435
-- Table structure for operate_service_log
436
-- ----------------------------
437
DROP TABLE IF EXISTS operate_service_log;
438
CREATE TABLE operate_service_log (
439
	service_log_id char(32) NOT NULL,
440
	service_user char(32) NOT NULL,
441
	servant varchar(255),
442
	service_content varchar(255),
443
	create_time char(14) NOT NULL
444
);
445
COMMENT ON TABLE operate_service_log IS '后台服务记录表';
446
COMMENT ON COLUMN operate_service_log.service_log_id IS '服务记录ID';
447
COMMENT ON COLUMN operate_service_log.service_user IS '服务用户';
448
COMMENT ON COLUMN operate_service_log.servant IS '服务者';
449
COMMENT ON COLUMN operate_service_log.service_content IS '服务内容';
450
COMMENT ON COLUMN operate_service_log.create_time IS '服务时间';
451

452
-- ----------------------------
453
-- Table structure for operation
454
-- ----------------------------
455
DROP TABLE IF EXISTS operation;
456
CREATE TABLE operation (
457
	operation_id char(32) NOT NULL,
458
	operation_status int2 NOT NULL,
459
	demand_id char(32) NOT NULL,
460
	detail_demand text,
461
	deliver_time char(8),
462
	resource_id char(32) NOT NULL,
463
	deal_price numeric(24,2),
464
	deal_time char(14),
465
	pay_method varchar(255),
466
	reply_notes varchar(255),
467
	create_time char(14) NOT NULL,
468
	applysquare varchar(255)
469
);
470
COMMENT ON TABLE operation IS '资源交易表(目前没用)';
471
COMMENT ON COLUMN operation.operation_id IS '交易ID';
472
COMMENT ON COLUMN operation.operation_status IS '交易状态';
473
COMMENT ON COLUMN operation.demand_id IS '需求方ID(需要资源的用户ID)';
474
COMMENT ON COLUMN operation.detail_demand IS '详细需求';
475
COMMENT ON COLUMN operation.deliver_time IS '交付时间';
476
COMMENT ON COLUMN operation.resource_id IS '资源ID';
477
COMMENT ON COLUMN operation.deal_price IS '成交价格';
478
COMMENT ON COLUMN operation.deal_time IS '成交时间';
479
COMMENT ON COLUMN operation.pay_method IS '支付方式';
480
COMMENT ON COLUMN operation.reply_notes IS '回复备注';
481
COMMENT ON COLUMN operation.create_time IS '创建时间';
482
COMMENT ON COLUMN operation.applysquare IS '申请方';
483

484
-- ----------------------------
485
-- Table structure for operation_status
486
-- ----------------------------
487
DROP TABLE IF EXISTS operation_status;
488
CREATE TABLE operation_status (
489
	status_id int2 NOT NULL,
490
	status_name varchar(255) NOT NULL
491
);
492
COMMENT ON TABLE operation_status IS '交易状态(目前没用)';
493
COMMENT ON COLUMN operation_status.status_id IS '交易状态ID';
494
COMMENT ON COLUMN operation_status.status_name IS '交易状态名称';
495

496
-- ----------------------------
497
-- Table structure for org_res_staff
498
-- ----------------------------
499
DROP TABLE IF EXISTS org_res_staff;
500
CREATE TABLE org_res_staff (
501
	resource_id char(32) NOT NULL,
502
	professor_id char(32) NOT NULL,
503
	create_time char(14) NOT NULL
504
);
505
COMMENT ON TABLE org_res_staff IS '企业资源负责人';
506
COMMENT ON COLUMN org_res_staff.resource_id IS '资源ID';
507
COMMENT ON COLUMN org_res_staff.professor_id IS '用户ID';
508
COMMENT ON COLUMN org_res_staff.create_time IS '创建时间';
509

510
-- ----------------------------
511
-- Table structure for org_retrieve
512
-- ----------------------------
513
DROP TABLE IF EXISTS org_retrieve;
514
CREATE TABLE org_retrieve (
515
	id char(32) NOT NULL,
516
	name varchar(255),
517
	org_id char(32),
518
	email varchar(50),
519
	passwd char(32),
520
	solve_status varchar(2) NOT NULL,
521
	create_time char(14) NOT NULL
522
);
523
COMMENT ON TABLE org_retrieve IS '企业账号找回申请表';
524
COMMENT ON COLUMN org_retrieve.name IS '企业名称';
525
COMMENT ON COLUMN org_retrieve.org_id IS '企业ID';
526
COMMENT ON COLUMN org_retrieve.email IS '企业邮箱';
527
COMMENT ON COLUMN org_retrieve.passwd IS '密码';
528
COMMENT ON COLUMN org_retrieve.solve_status IS '解决状态(-1-认证失败,1-待处理,2-处理中,3-认证通过)';
529
COMMENT ON COLUMN org_retrieve.create_time IS '创建时间';
530

531
-- ----------------------------
532
-- Table structure for org_retrieve_img
533
-- ----------------------------
534
DROP TABLE IF EXISTS org_retrieve_img;
535
CREATE TABLE org_retrieve_img (
536
	id char(32) NOT NULL,
537
	org_retrieve_id char(32) NOT NULL,
538
	src varchar(255) NOT NULL
539
);
540
COMMENT ON TABLE org_retrieve_img IS '企业账号找回申请图片表';
541
COMMENT ON COLUMN org_retrieve_img.org_retrieve_id IS '企业账号找回申请ID';
542
COMMENT ON COLUMN org_retrieve_img.src IS '图片路径';
543

544
-- ----------------------------
545
-- Table structure for org_subject
546
-- ----------------------------
547
DROP TABLE IF EXISTS org_subject;
548
CREATE TABLE org_subject (
549
	organization_id char(32) NOT NULL,
550
	subject_id int2 NOT NULL
551
);
552

553
-- ----------------------------
554
-- Table structure for org_user
555
-- ----------------------------
556
DROP TABLE IF EXISTS org_user;
557
CREATE TABLE org_user (
558
	id char(32) NOT NULL,
559
	email varchar(50),
560
	passwd char(32) NOT NULL,
561
	user_type char(1),
562
	inviter_id char(32),
563
	create_time char(14) NOT NULL
564
);
565
COMMENT ON TABLE org_user IS '企业用户表';
566
COMMENT ON COLUMN org_user.id IS '企业用户ID';
567
COMMENT ON COLUMN org_user.email IS '注册邮箱';
568
COMMENT ON COLUMN org_user.passwd IS '密码';
569
COMMENT ON COLUMN org_user.user_type IS '用户类型(0-个人用户,1-企业用户)';
570
COMMENT ON COLUMN org_user.inviter_id IS '邀请人ID(目前没用)';
571
COMMENT ON COLUMN org_user.create_time IS '创建时间';
572

573
-- ----------------------------
574
-- Table structure for organization
575
-- ----------------------------
576
DROP TABLE IF EXISTS organization;
577
CREATE TABLE organization (
578
	org_attr varchar(32),
579
	id char(32) NOT NULL,
580
	name varchar(100) COLLATE zh_CN NOT NULL,
581
	org_type varchar(32),
582
	create_time char(14) NOT NULL,
583
	modify_time char(14) NOT NULL,
584
	descp text,
585
	org_url varchar(255),
586
	found_time char(8),
587
	province varchar(255),
588
	city varchar(255),
589
	subject text,
590
	industry text,
591
	org_size char(1),
592
	qualification text,
593
	is_join char(1),
594
	auth_status varchar(2),
595
	for_short varchar(20)
596
);
597
COMMENT ON TABLE organization IS '企业信息表';
598
COMMENT ON COLUMN organization.org_attr IS '字段类型待修改,逗号分隔,多个属性';
599
COMMENT ON COLUMN organization.name IS '企业名称';
600
COMMENT ON COLUMN organization.org_type IS '企业类型(2-上市企业,3-国有企业,4-合资企业,5-私人企业,6-外资企业,7-初创企业)';
601
COMMENT ON COLUMN organization.create_time IS '创建时间';
602
COMMENT ON COLUMN organization.modify_time IS '修改时间';
603
COMMENT ON COLUMN organization.descp IS '企业简介';
604
COMMENT ON COLUMN organization.org_url IS '企业官网';
605
COMMENT ON COLUMN organization.found_time IS '创立时间';
606
COMMENT ON COLUMN organization.province IS '所在省份';
607
COMMENT ON COLUMN organization.city IS '所在城市';
608
COMMENT ON COLUMN organization.subject IS '学术领域';
609
COMMENT ON COLUMN organization.industry IS '应用行业';
610
COMMENT ON COLUMN organization.org_size IS '企业规模(1:50人以内,2:50-100人,3:100-200人,4:200-500人,5:500-1000人,6:1000人以上)';
611
COMMENT ON COLUMN organization.qualification IS '企业资质';
612
COMMENT ON COLUMN organization.is_join IS '是否入驻(0-未入驻,1-已入驻)';
613
COMMENT ON COLUMN organization.auth_status IS '企业认证状态(-1-认证失败,0-未认证,1-待认证,2-认证中,3-已认证)';
614
COMMENT ON COLUMN organization.for_short IS '企业简称';
615

616
-- ----------------------------
617
-- Table structure for paper
618
-- ----------------------------
619
DROP TABLE IF EXISTS paper;
620
CREATE TABLE paper (
621
	professor_id char(32) NOT NULL,
622
	id char(32) NOT NULL,
623
	year char(4),
624
	name text NOT NULL,
625
	url text,
626
	descp text
627
);
628
COMMENT ON TABLE paper IS '专家发表的书刊杂志记录表';
629
COMMENT ON COLUMN paper.professor_id IS '用户ID';
630
COMMENT ON COLUMN paper.year IS '年份';
631
COMMENT ON COLUMN paper.name IS '书刊杂志名';
632
COMMENT ON COLUMN paper.url IS '链接';
633
COMMENT ON COLUMN paper.descp IS '详细描述';
634

635
-- ----------------------------
636
-- Table structure for part_time_job
637
-- ----------------------------
638
DROP TABLE IF EXISTS part_time_job;
639
CREATE TABLE part_time_job (
640
	id char(32) NOT NULL,
641
	start_month char(6),
642
	stop_month char(6),
643
	professor_id char(32) NOT NULL,
644
	company varchar(255) NOT NULL,
645
	title varchar(255) NOT NULL,
646
	descp text,
647
	department varchar(255)
648
);
649
COMMENT ON TABLE part_time_job IS '工作经历表';
650
COMMENT ON COLUMN part_time_job.start_month IS '入职时间(年月)';
651
COMMENT ON COLUMN part_time_job.stop_month IS '离职时间(年月)';
652
COMMENT ON COLUMN part_time_job.professor_id IS '用户ID';
653
COMMENT ON COLUMN part_time_job.company IS '所在公司';
654
COMMENT ON COLUMN part_time_job.title IS '职务';
655
COMMENT ON COLUMN part_time_job.descp IS '详细描述';
656
COMMENT ON COLUMN part_time_job.department IS '所在部门';
657

658
-- ----------------------------
659
-- Table structure for patent
660
-- ----------------------------
661
DROP TABLE IF EXISTS patent;
662
CREATE TABLE patent (
663
	id char(32) NOT NULL,
664
	year char(4),
665
	name text NOT NULL,
666
	professor_id char(32) NOT NULL,
667
	url varchar(255),
668
	descp text
669
);
670
COMMENT ON TABLE patent IS '专利表';
671
COMMENT ON COLUMN patent.year IS '年份';
672
COMMENT ON COLUMN patent.name IS '专利名';
673
COMMENT ON COLUMN patent.professor_id IS '用户ID';
674
COMMENT ON COLUMN patent.url IS '链接';
675
COMMENT ON COLUMN patent.descp IS '详细描述';
676

677
-- ----------------------------
678
-- Table structure for pay_history
679
-- ----------------------------
680
DROP TABLE IF EXISTS pay_history;
681
CREATE TABLE pay_history (
682
	pay_history_id char(32) NOT NULL,
683
	operation_id char(32) NOT NULL,
684
	paid_money numeric(24,2),
685
	create_time char(14) NOT NULL,
686
	remark text,
687
	isonline int2,
688
	return_money numeric(24,2),
689
	pay_type int2,
690
	pay_status int2,
691
	professor_id char(32) NOT NULL
692
);
693
COMMENT ON TABLE pay_history IS '支付历史记录(暂时没用)';
694

695
-- ----------------------------
696
-- Table structure for professor
697
-- ----------------------------
698
DROP TABLE IF EXISTS professor;
699
CREATE TABLE professor (
700
	office text,
701
	subject text,
702
	industry text,
703
	department varchar(255),
704
	org_id char(32),
705
	title varchar(255),
706
	id char(32) NOT NULL,
707
	name varchar(255) NOT NULL,
708
	descp text,
709
	create_time char(14) NOT NULL,
710
	modify_time char(14) NOT NULL,
711
	address varchar(255),
712
	star_level numeric(4,2) DEFAULT 0 NOT NULL,
713
	consult_count int2 DEFAULT 0 NOT NULL,
714
	province varchar(255),
715
	star_avg numeric(4,2) DEFAULT 0 NOT NULL,
716
	authentication int2,
717
	auth_type int2 DEFAULT 0 NOT NULL,
718
	auth_status int2 DEFAULT 0 NOT NULL,
719
	phone varchar(20),
720
	email varchar(50),
721
	sort_first int2 DEFAULT 0 NOT NULL,
722
	auth_status_expert int2 DEFAULT 0,
723
	org_auth char(1),
724
	score_value int4,
725
	growth_value int4,
726
	score_percent varchar(10),
727
	id_card char(18),
728
	cuser_id char(32),
729
	professor_state int2 DEFAULT 0 NOT NULL
730
);
731
COMMENT ON TABLE professor IS '个人用户信息表';
732
COMMENT ON COLUMN professor.office IS '职位';
733
COMMENT ON COLUMN professor.subject IS '学术领域';
734
COMMENT ON COLUMN professor.industry IS '应用行业';
735
COMMENT ON COLUMN professor.department IS '所属部门';
736
COMMENT ON COLUMN professor.org_id IS '所属企业ID';
737
COMMENT ON COLUMN professor.title IS '职称';
738
COMMENT ON COLUMN professor.id IS '用户ID';
739
COMMENT ON COLUMN professor.name IS '姓名';
740
COMMENT ON COLUMN professor.descp IS '个人简介';
741
COMMENT ON COLUMN professor.create_time IS '创建时间';
742
COMMENT ON COLUMN professor.modify_time IS '修改时间';
743
COMMENT ON COLUMN professor.address IS '所在城市';
744
COMMENT ON COLUMN professor.star_level IS '星级';
745
COMMENT ON COLUMN professor.consult_count IS '接受的咨询次数(完成状态)';
746
COMMENT ON COLUMN professor.province IS '所在省份';
747
COMMENT ON COLUMN professor.star_avg IS '平均星级';
748
COMMENT ON COLUMN professor.authentication IS '用户身份(0-普通用户,1-科研工作者,2-企业高管,3-在校生,4-技术人员,5-HR/猎头,6-销售人员,7-投资方,8-咨询顾问)';
749
COMMENT ON COLUMN professor.auth_type IS '用户类型(0-普通用户,1-专家用户)';
750
COMMENT ON COLUMN professor.auth_status IS '实名认证状态(-1-认证失败,0-未认证,1-待认证,2-认证中,3-已认证)';
751
COMMENT ON COLUMN professor.phone IS '联系电话';
752
COMMENT ON COLUMN professor.email IS '联系邮箱';
753
COMMENT ON COLUMN professor.sort_first IS '第一排序字段(运营人员可修改)';
754
COMMENT ON COLUMN professor.auth_status_expert IS '专家认证状态(-1-认证失败,0-未认证,1-待认证,2-认证中,3-已认证)';
755
COMMENT ON COLUMN professor.org_auth IS '企业认证状态(0-未认证,1-已认证)';
756
COMMENT ON COLUMN professor.score_value IS '积分值';
757
COMMENT ON COLUMN professor.growth_value IS '成长值';
758
COMMENT ON COLUMN professor.score_percent IS '积分超过的用户百分比';
759
COMMENT ON COLUMN professor.id_card IS '身份证号';
760
COMMENT ON COLUMN professor.cuser_id IS '录入员id(运营人员id)';
761
COMMENT ON COLUMN professor.professor_state IS '专家录入审核状态(0=审核通过2=未审核1=审核失败)';
762

763
-- ----------------------------
764
-- Table structure for professor_edu_bg
765
-- ----------------------------
766
DROP TABLE IF EXISTS professor_edu_bg;
767
CREATE TABLE professor_edu_bg (
768
	id char(32) NOT NULL,
769
	year char(4),
770
	student char(1) NOT NULL,
771
	degree varchar(255),
772
	professor_id char(32) NOT NULL,
773
	school varchar(255) NOT NULL,
774
	college varchar(255),
775
	major varchar(255),
776
	descp text
777
);
778
COMMENT ON TABLE professor_edu_bg IS '用户教育背景';
779
COMMENT ON COLUMN professor_edu_bg.year IS '年份';
780

781
-- ----------------------------
782
-- Table structure for project
783
-- ----------------------------
784
DROP TABLE IF EXISTS project;
785
CREATE TABLE project (
786
	id char(32) NOT NULL,
787
	start_month char(6),
788
	stop_month char(6),
789
	professor_id char(32) NOT NULL,
790
	name text NOT NULL,
791
	descp text
792
);
793
COMMENT ON TABLE project IS '项目经验表';
794

795
-- ----------------------------
796
-- Table structure for research_area
797
-- ----------------------------
798
DROP TABLE IF EXISTS research_area;
799
CREATE TABLE research_area (
800
	sort_num int4 NOT NULL,
801
	descp text,
802
	count int4 NOT NULL,
803
	professor_id char(32) NOT NULL,
804
	caption varchar(255) NOT NULL
805
);
806
COMMENT ON TABLE research_area IS '研究方向表';
807
COMMENT ON COLUMN research_area.count IS '被赞次数';
808
COMMENT ON COLUMN research_area.professor_id IS '用户ID';
809
COMMENT ON COLUMN research_area.caption IS '研究方向';
810

811
-- ----------------------------
812
-- Table structure for research_area_log
813
-- ----------------------------
814
DROP TABLE IF EXISTS research_area_log;
815
CREATE TABLE research_area_log (
816
	oprete_professor_id char(32) NOT NULL,
817
	create_time char(14) NOT NULL,
818
	professor_id char(32) NOT NULL,
819
	caption varchar(255) NOT NULL
820
);
821
COMMENT ON TABLE research_area_log IS '研究方向点赞记录表';
822
COMMENT ON COLUMN research_area_log.oprete_professor_id IS '点赞用户ID';
823
COMMENT ON COLUMN research_area_log.create_time IS '点赞时间';
824
COMMENT ON COLUMN research_area_log.professor_id IS '被赞用户ID';
825
COMMENT ON COLUMN research_area_log.caption IS '被赞的研究方向';
826

827
-- ----------------------------
828
-- Table structure for resource
829
-- ----------------------------
830
DROP TABLE IF EXISTS resource;
831
CREATE TABLE resource (
832
	resource_id char(32) NOT NULL,
833
	resource_name varchar(255) COLLATE zh_CN NOT NULL,
834
	supported_services varchar(255) NOT NULL,
835
	descp text,
836
	professor_id char(32) NOT NULL,
837
	ascription varchar(255),
838
	create_time char(14) NOT NULL,
839
	modify_time char(14) NOT NULL,
840
	hope_pay_method varchar(255),
841
	cooperation_notes text,
842
	subject text,
843
	industry text
844
);
845
COMMENT ON TABLE resource IS '资源表';
846
COMMENT ON COLUMN resource.resource_id IS '资源ID';
847
COMMENT ON COLUMN resource.resource_name IS '资源名称';
848
COMMENT ON COLUMN resource.supported_services IS '应用用途';
849
COMMENT ON COLUMN resource.descp IS '详细描述';
850
COMMENT ON COLUMN resource.professor_id IS '专家id';
851
COMMENT ON COLUMN resource.ascription IS '暂时没有用(所属人)';
852
COMMENT ON COLUMN resource.create_time IS '创建时间';
853
COMMENT ON COLUMN resource.modify_time IS '修改时间';
854
COMMENT ON COLUMN resource.hope_pay_method IS '期望付款方式(暂时没有用)';
855
COMMENT ON COLUMN resource.cooperation_notes IS '合作备注';
856
COMMENT ON COLUMN resource.subject IS '关键词';
857
COMMENT ON COLUMN resource.industry IS '暂时没有用(应用行业)';
858
COMMENT ON COLUMN resource.page_views IS '浏览量';
859
COMMENT ON COLUMN resource.comp IS '所在单位';
860
COMMENT ON COLUMN resource.resource_type IS '资源类型(1-个人资源,2-企业资源)';
861

862
-- ----------------------------
863
-- Table structure for resource_tmp
864
-- ----------------------------
865
DROP TABLE IF EXISTS resource_tmp;
866
CREATE TABLE resource_tmp (
867
	id varchar(255) NOT NULL,
868
	name text NOT NULL,
869
	domain text,
870
	comp text,
871
	spec text,
872
	img text,
873
	parameter text,
874
	major_func text,
875
	cost float8,
876
	enabled_time text,
877
	communication text,
878
	org_name text,
879
	corporation text,
880
	linkman text,
881
	tel text,
882
	email text,
883
	addr text,
884
	zip_code text,
885
	create_time char(14) NOT NULL,
886
	modify_time char(14) NOT NULL
887
);
888
COMMENT ON COLUMN resource_tmp.name IS '资源名称(resource_name)';
889
COMMENT ON COLUMN resource_tmp.domain IS '关键词(subject)';
890
COMMENT ON COLUMN resource_tmp.comp IS '所在单位(comp)';
891
COMMENT ON COLUMN resource_tmp.spec IS '厂商及型号规格(spec)';
892
COMMENT ON COLUMN resource_tmp.img IS '图片路径';
893
COMMENT ON COLUMN resource_tmp.parameter IS '性能参数(paremeter)';
894
COMMENT ON COLUMN resource_tmp.major_func IS '应用用途(supported_services、desc)';
895
COMMENT ON COLUMN resource_tmp.cost IS '仪器原值(万元)';
896
COMMENT ON COLUMN resource_tmp.enabled_time IS '启用时间';
897
COMMENT ON COLUMN resource_tmp.communication IS '联系方式';
898
COMMENT ON COLUMN resource_tmp.org_name IS '机构名称';
899
COMMENT ON COLUMN resource_tmp.corporation IS '负责人';
900
COMMENT ON COLUMN resource_tmp.linkman IS '联系人 ';
901
COMMENT ON COLUMN resource_tmp.tel IS '电话';
902
COMMENT ON COLUMN resource_tmp.email IS '邮箱';
903
COMMENT ON COLUMN resource_tmp.addr IS '地址';
904
COMMENT ON COLUMN resource_tmp.zip_code IS '邮编';
905

906
-- ----------------------------
907
-- Table structure for resource_tmp_log
908
-- ----------------------------
909
DROP TABLE IF EXISTS resource_tmp_log;
910
CREATE TABLE resource_tmp_log (
911
	owner_id char(32) NOT NULL,
912
	resource_id char(32) NOT NULL,
913
	resource_tmp_id char(32) NOT NULL,
914
	create_time char(14) NOT NULL
915
);
916
COMMENT ON TABLE resource_tmp_log IS '资源导入记录表';
917
COMMENT ON COLUMN resource_tmp_log.owner_id IS '操作的用户ID(个人或企业)';
918
COMMENT ON COLUMN resource_tmp_log.resource_id IS '资源ID';
919
COMMENT ON COLUMN resource_tmp_log.resource_tmp_id IS '临时资源ID';
920
COMMENT ON COLUMN resource_tmp_log.create_time IS '导入时间';
921

922
-- ----------------------------
923
-- Table structure for tidings
924
-- ----------------------------
925
DROP TABLE IF EXISTS tidings;
926
CREATE TABLE tidings (
927
	tidings_id char(32) NOT NULL,
928
	tidings_contant text NOT NULL,
929
	sender_id char(32) NOT NULL,
930
	consult_id char(32) NOT NULL,
931
	create_time char(14) NOT NULL,
932
	read_status int2 NOT NULL
933
);
934
COMMENT ON COLUMN tidings.tidings_id IS '咨询消息ID';
935
COMMENT ON COLUMN tidings.tidings_contant IS '消息内容';
936
COMMENT ON COLUMN tidings.sender_id IS '发送者ID';
937
COMMENT ON COLUMN tidings.consult_id IS '咨询ID';
938
COMMENT ON COLUMN tidings.create_time IS '创建时间';
939
COMMENT ON COLUMN tidings.read_status IS '查看状态(0-未查看,1-已查看)';
940

941
-- ----------------------------
942
-- Table structure for user_open_id
943
-- ----------------------------
944
DROP TABLE IF EXISTS user_open_id;
945
CREATE TABLE user_open_id (
946
	userid char(32) NOT NULL,
947
	oauth_type text NOT NULL,
948
	openid text NOT NULL,
949
	create_time char(14) NOT NULL,
950
	modify_time char(14) NOT NULL
951
);
952

953
-- ----------------------------
954
-- Table structure for watch
955
-- ----------------------------
956
DROP TABLE IF EXISTS watch;
957
CREATE TABLE watch (
958
	professor_id char(32) NOT NULL,
959
	watch_object char(32) NOT NULL,
960
	create_time char(14) NOT NULL,
961
	watch_type int2 NOT NULL
962
);
963
COMMENT ON TABLE watch IS '关注表';
964
COMMENT ON COLUMN watch.professor_id IS '专家ID';
965
COMMENT ON COLUMN watch.watch_object IS '关注对象ID';
966
COMMENT ON COLUMN watch.create_time IS '关注时间';
967
COMMENT ON COLUMN watch.watch_type IS '关注类型(专家-1,资源-2,3-文章)';
968

969
ALTER TABLE accessory ADD PRIMARY KEY (accessory_id);
970

971
-- ----------------------------
972
-- Primary Key structure for table article
973
-- ----------------------------
974
ALTER TABLE article ADD PRIMARY KEY (article_id);
975

976
-- ----------------------------
977
-- Primary Key structure for table article_agree
978
-- ----------------------------
979
ALTER TABLE article_agree ADD PRIMARY KEY (operate_id, article_id);
980

981

982

983
-- ----------------------------
984
-- Primary Key structure for table assess
985
-- ----------------------------
986
ALTER TABLE assess ADD PRIMARY KEY (assess_id);
987

988
-- ----------------------------
989
-- Primary Key structure for table auth_apply
990
-- ----------------------------
991
ALTER TABLE auth_apply ADD PRIMARY KEY (auth_apply_id);
992

993
-- ----------------------------
994
-- Primary Key structure for table auth_image
995
-- ----------------------------
996
ALTER TABLE auth_image ADD PRIMARY KEY (auth_image_id);
997

998
-- ----------------------------
999
-- Primary Key structure for table complain
1000
-- ----------------------------
1001
ALTER TABLE complain ADD PRIMARY KEY (complain_id);
1002

1003
-- ----------------------------
1004
-- Primary Key structure for table consult
1005
-- ----------------------------
1006
ALTER TABLE consult ADD PRIMARY KEY (consult_id);
1007

1008
-- ----------------------------
1009
-- Primary Key structure for table consult_reject
1010
-- ----------------------------
1011
ALTER TABLE consult_reject ADD PRIMARY KEY (reject_id);
1012

1013
-- ----------------------------
1014
-- Uniques structure for table data_dict
1015
-- ----------------------------
1016
ALTER TABLE data_dict ADD UNIQUE (dict_code, caption);
1017

1018
-- ----------------------------
1019
-- Primary Key structure for table data_dict
1020
-- ----------------------------
1021
ALTER TABLE data_dict ADD PRIMARY KEY (code, dict_code);
1022

1023
-- ----------------------------
1024
-- Primary Key structure for table demand
1025
-- ----------------------------
1026
ALTER TABLE demand ADD PRIMARY KEY (demand_id);
1027

1028
-- ----------------------------
1029
-- Primary Key structure for table demand_sub_or_indus
1030
-- ----------------------------
1031
ALTER TABLE demand_sub_or_indus ADD PRIMARY KEY (id);
1032

1033
-- ----------------------------
1034
-- Primary Key structure for table dict_city
1035
-- ----------------------------
1036
ALTER TABLE dict_city ADD PRIMARY KEY (dict_code);
1037

1038
-- ----------------------------
1039
-- Primary Key structure for table dict_meta
1040
-- ----------------------------
1041
ALTER TABLE dict_meta ADD PRIMARY KEY (code);
1042

1043
-- ----------------------------
1044
-- Primary Key structure for table growth_log
1045
-- ----------------------------
1046
ALTER TABLE growth_log ADD PRIMARY KEY (id);
1047

1048
-- ----------------------------
1049
-- Primary Key structure for table honor
1050
-- ----------------------------
1051
ALTER TABLE honor ADD PRIMARY KEY (id);
1052

1053
-- ----------------------------
1054
-- Primary Key structure for table image
1055
-- ----------------------------
1056
ALTER TABLE image ADD PRIMARY KEY (image_id);
1057

1058
-- ----------------------------
1059
-- Primary Key structure for table leave_word
1060
-- ----------------------------
1061
ALTER TABLE leave_word ADD PRIMARY KEY (id);
1062

1063
-- ----------------------------
1064
-- Uniques structure for table luser
1065
-- ----------------------------
1066
ALTER TABLE luser ADD UNIQUE (email);
1067
ALTER TABLE luser ADD UNIQUE (mobile_phone);
1068

1069
-- ----------------------------
1070
-- Primary Key structure for table luser
1071
-- ----------------------------
1072
ALTER TABLE luser ADD PRIMARY KEY (id);
1073

1074
-- ----------------------------
1075
-- Primary Key structure for table messages
1076
-- ----------------------------
1077
ALTER TABLE messages ADD PRIMARY KEY (message_id);
1078

1079
-- ----------------------------
1080
-- Primary Key structure for table operate_service_file
1081
-- ----------------------------
1082
ALTER TABLE operate_service_file ADD PRIMARY KEY (service_file_id);
1083

1084
-- ----------------------------
1085
-- Primary Key structure for table operate_service_log
1086
-- ----------------------------
1087
ALTER TABLE operate_service_log ADD PRIMARY KEY (service_log_id);
1088

1089
-- ----------------------------
1090
-- Primary Key structure for table operation
1091
-- ----------------------------
1092
ALTER TABLE operation ADD PRIMARY KEY (operation_id);
1093

1094
-- ----------------------------
1095
-- Primary Key structure for table operation_status
1096
-- ----------------------------
1097
ALTER TABLE operation_status ADD PRIMARY KEY (status_id);
1098

1099
-- ----------------------------
1100
-- Uniques structure for table org_res_staff
1101
-- ----------------------------
1102
ALTER TABLE org_res_staff ADD UNIQUE (resource_id, professor_id);
1103

1104
-- ----------------------------
1105
-- Primary Key structure for table org_retrieve
1106
-- ----------------------------
1107
ALTER TABLE org_retrieve ADD PRIMARY KEY (id);
1108

1109
-- ----------------------------
1110
-- Primary Key structure for table org_retrieve_img
1111
-- ----------------------------
1112
ALTER TABLE org_retrieve_img ADD PRIMARY KEY (id);
1113

1114
-- ----------------------------
1115
-- Primary Key structure for table org_subject
1116
-- ----------------------------
1117
ALTER TABLE org_subject ADD PRIMARY KEY (organization_id, subject_id);
1118

1119
-- ----------------------------
1120
-- Uniques structure for table org_user
1121
-- ----------------------------
1122
ALTER TABLE org_user ADD UNIQUE (email);
1123

1124
-- ----------------------------
1125
-- Primary Key structure for table org_user
1126
-- ----------------------------
1127
ALTER TABLE org_user ADD PRIMARY KEY (id);
1128

1129
-- ----------------------------
1130
-- Indexes structure for table organization
1131
-- ----------------------------
1132
CREATE UNIQUE INDEX organization_name_key ON organization USING btree (name COLLATE zh_CN);
1133
CREATE UNIQUE INDEX organization_name_key1 ON organization USING btree (name COLLATE zh_CN);
1134
CREATE UNIQUE INDEX organization_name_key2 ON organization USING btree (name COLLATE zh_CN);
1135
CREATE UNIQUE INDEX organization_name_key3 ON organization USING btree (name COLLATE zh_CN);
1136

1137
-- ----------------------------
1138
-- Uniques structure for table organization
1139
-- ----------------------------
1140
ALTER TABLE organization ADD UNIQUE (name);
1141

1142
-- ----------------------------
1143
-- Primary Key structure for table organization
1144
-- ----------------------------
1145
ALTER TABLE organization ADD PRIMARY KEY (id);
1146

1147
-- ----------------------------
1148
-- Primary Key structure for table paper
1149
-- ----------------------------
1150
ALTER TABLE paper ADD PRIMARY KEY (id);
1151

1152
-- ----------------------------
1153
-- Primary Key structure for table part_time_job
1154
-- ----------------------------
1155
ALTER TABLE part_time_job ADD PRIMARY KEY (id);
1156

1157
-- ----------------------------
1158
-- Primary Key structure for table patent
1159
-- ----------------------------
1160
ALTER TABLE patent ADD PRIMARY KEY (id);
1161

1162
-- ----------------------------
1163
-- Primary Key structure for table pay_history
1164
-- ----------------------------
1165
ALTER TABLE pay_history ADD PRIMARY KEY (pay_history_id);
1166

1167
-- ----------------------------
1168
-- Primary Key structure for table professor
1169
-- ----------------------------
1170
ALTER TABLE professor ADD PRIMARY KEY (id);
1171

1172
-- ----------------------------
1173
-- Primary Key structure for table professor_edu_bg
1174
-- ----------------------------
1175
ALTER TABLE professor_edu_bg ADD PRIMARY KEY (id);
1176

1177
-- ----------------------------
1178
-- Primary Key structure for table project
1179
-- ----------------------------
1180
ALTER TABLE project ADD PRIMARY KEY (id);
1181

1182
-- ----------------------------
1183
-- Primary Key structure for table research_area
1184
-- ----------------------------
1185
ALTER TABLE research_area ADD PRIMARY KEY (professor_id, caption);
1186

1187
-- ----------------------------
1188
-- Primary Key structure for table resource
1189
-- ----------------------------
1190
ALTER TABLE resource ADD PRIMARY KEY (resource_id);
1191

1192
-- ----------------------------
1193
-- Primary Key structure for table resource_tmp
1194
-- ----------------------------
1195
ALTER TABLE resource_tmp ADD PRIMARY KEY (id);
1196

1197
-- ----------------------------
1198
-- Uniques structure for table resource_tmp_log
1199
-- ----------------------------
1200
ALTER TABLE resource_tmp_log ADD UNIQUE (resource_id, resource_tmp_id);
1201

1202
-- ----------------------------
1203
-- Primary Key structure for table tidings
1204
-- ----------------------------
1205
ALTER TABLE tidings ADD PRIMARY KEY (tidings_id);
1206

1207
-- ----------------------------
1208
-- Uniques structure for table user_open_id
1209
-- ----------------------------
1210
ALTER TABLE user_open_id ADD UNIQUE (userid, oauth_type);
1211
ALTER TABLE user_open_id ADD UNIQUE (oauth_type, openid);
1212

1213
-- ----------------------------
1214
-- Primary Key structure for table user_open_id
1215
-- ----------------------------
1216
ALTER TABLE user_open_id ADD PRIMARY KEY (oauth_type, openid, userid);
1217

1218
-- ----------------------------
1219
-- Uniques structure for table watch
1220
-- ----------------------------
1221
ALTER TABLE watch ADD UNIQUE (professor_id, watch_object, watch_type);
1222

1223
-- ----------------------------
1224
-- Primary Key structure for table watch
1225
-- ----------------------------
1226
ALTER TABLE watch ADD PRIMARY KEY (professor_id, watch_object);
1227

1228

1229
/*
1230
 * modify 20170607
1231
 * 
1232
 * 
1233
 * 
1234
 */
1235

1236

1237
ALTER TABLE resource ADD COLUMN org_name VARCHAR (255);
1238

1239
ALTER TABLE resource ADD COLUMN spec VARCHAR (255);
1240

1241
COMMENT ON COLUMN resource.spec IS '厂商及型号规格';
1242

1243
ALTER TABLE resource ADD COLUMN PARAMETER TEXT;
1244

1245
COMMENT ON COLUMN resource. PARAMETER IS '性能参数';
1246

1247
ALTER TABLE resource ADD COLUMN publish_time CHAR (14);
1248

1249
COMMENT ON COLUMN resource.publish_time IS '发布时间';
1250

1251
ALTER TABLE resource ADD COLUMN status CHAR (1);
1252

1253
COMMENT ON COLUMN resource.status IS '资源状态(0-草稿,1-发布,3-删除,4-关闭)';
1254

1255
ALTER TABLE image ADD COLUMN sort INTEGER NULL;
1256

1257
UPDATE image SET sort = 1;
1258

1259
ALTER TABLE image ALTER COLUMN sort SET NOT NULL;
1260

1261
UPDATE image SET image_src = REPLACE (	image_src,	'/kexiu/www/html/images/resource','201704');
1262

1263
ALTER TABLE resource ADD COLUMN page_views INTEGER;
1264

1265
COMMENT ON COLUMN resource.page_views IS '浏览量';
1266

1267
UPDATE resource SET page_views = 0, status = '1', publish_time = modify_time;
1268

1269
ALTER TABLE resource ADD COLUMN comp VARCHAR (255);
1270

1271
COMMENT ON COLUMN resource.comp IS '所在单位';
1272

1273
ALTER TABLE resource ADD COLUMN resource_type CHAR (1);
1274

1275
COMMENT ON COLUMN resource.resource_type IS '资源类型(1-个人资源,2-企业资源)';
1276

1277
ALTER TABLE resource ALTER COLUMN professor_id DROP NOT NULL;
1278

1279
ALTER TABLE resource ADD COLUMN org_id CHAR (32);
1280

1281
CREATE TABLE ORG_RES_STAFF (
1282
	RESOURCE_ID CHAR (32) NOT NULL,
1283
	PROFESSOR_ID CHAR (32) NOT NULL,
1284
	CREATE_TIME CHAR (14) NOT NULL
1285
);
1286

1287
ALTER TABLE ORG_RES_STAFF ADD UNIQUE (RESOURCE_ID, PROFESSOR_ID);
1288

1289
CREATE TABLE RESOURCE_TMP_LOG (
1290
	OWNER_ID CHAR (32) NOT NULL,
1291
	RESOURCE_ID CHAR (32) NOT NULL,
1292
	RESOURCE_TMP_ID CHAR (32) NOT NULL,
1293
	CREATE_TIME CHAR (14) NOT NULL
1294
);
1295

1296
ALTER TABLE RESOURCE_TMP_LOG ADD UNIQUE (
1297
	RESOURCE_ID,
1298
	RESOURCE_TMP_ID
1299
);
1300

1301
ALTER TABLE article ADD COLUMN page_views INT4;
1302

1303
COMMENT ON COLUMN article.page_views IS '浏览量';
1304

1305
ALTER TABLE article ADD COLUMN status CHAR (1);
1306

1307
COMMENT ON COLUMN article.status IS '文章状态(0-草稿,1-发布,2-删除,3关闭)';
1308

1309
ALTER TABLE article ADD COLUMN publish_time CHAR(14);
1310

1311
COMMENT ON COLUMN article.publish_time IS '文章发布时间';
1312

1313
UPDATE article SET page_views = 0,status = '1',publish_time = modify_time;
1314

1315
-- ----------------------------
1316
-- Table structure for article_pro
1317
-- ----------------------------
1318
DROP TABLE IF EXISTS article_pro;
1319
CREATE TABLE article_pro (
1320
	article_id char(32) NOT NULL,
1321
	professor_id char(32) NOT NULL,
1322
	create_time char(14) NOT NULL
1323
);
1324
COMMENT ON TABLE article_pro IS '文章相关专家';
1325
COMMENT ON COLUMN article_pro.article_id IS '文章ID';
1326
COMMENT ON COLUMN article_pro.professor_id IS '用户ID';
1327
COMMENT ON COLUMN article_pro.create_time IS '创建时间';
1328

1329
DROP TABLE IF EXISTS article_res;
1330
CREATE TABLE article_res (
1331
	article_id char(32) NOT NULL,
1332
	resource_id char(32) NOT NULL,
1333
	create_time char(14) NOT NULL
1334
);
1335
COMMENT ON TABLE article_res IS '文章相关资源';
1336
COMMENT ON COLUMN article_res.article_id IS '文章ID';
1337
COMMENT ON COLUMN article_res.resource_id IS '资源ID';
1338
COMMENT ON COLUMN article_res.create_time IS '创建时间';
1339

1340
-- ----------------------------
1341
-- Uniques structure for table article_res
1342
-- ----------------------------
1343
ALTER TABLE article_res ADD PRIMARY KEY (article_id, resource_id);
1344
-- ----------------------------
1345
-- Uniques structure for table article_pro
1346
-- ----------------------------
1347
ALTER TABLE article_pro ADD PRIMARY KEY (article_id, professor_id);
1348