wangwei 7 years ago
parent
commit
8fb7159548
1 changed files with 22 additions and 5 deletions
  1. 22 5
      sql/云平台2.0升级-数据割接-基础信息.sql

+ 22 - 5
sql/云平台2.0升级-数据割接-基础信息.sql

@@ -1,15 +1,32 @@
---删除ecs_core_user的scope,type,update_time,create_time字段
+SELECT count(1) from  ecs_core_user; --545086
+SELECT count(1) from  ecs_core_student; --543198
 update ecs_core_user t set t.type='COMMON' where t.type='NOT_STUDENT';
 
 update ecs_core_org t set t.type='QMTH' where t.type='PRINT_QMTH';
 update ecs_core_org t set t.type='PRINTER' where t.type='PRINT_SUPPLIER';
 update ecs_core_org t set t.parent_id=null ,t.root_id=t.id where t.parent_id=0;
 
---删除ecs_exam_student,ecs_core_user_role的外键 user_id
-DELETE  from ecs_core_user where type='STUDENT'; 
+update  ecs_core_student t set t.password=(SELECT x.password from ecs_core_user x where x.id=t.user_id);
+
+--删除ecs_core_student,ecs_core_user_role的外键 user_id
+DELETE  from ecs_core_user where type='STUDENT'; -- 543199
+
+--删除ecs_core_user的scope,type,update_time,create_time字段
+
+--导入角色
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (1, '2018-06-08 13:15:50', '2018-06-08 13:15:48', 'SUPER_ADMIN', '超级管理员');
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (2, '2018-06-08 13:16:10', '2018-06-08 13:16:14', 'LC_USER', '学习中心用户');
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (3, '2018-06-08 13:17:35', '2018-06-08 13:17:38', 'MARKING_ADMIN', '阅卷管理员');
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (4, '2018-06-08 13:19:13', '2018-06-08 13:19:17', 'QUESTION_ADMIN', '题库管理员');
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (5, '2018-06-08 13:20:05', '2018-06-08 13:20:08', 'OE_ADMIN', '网考管理员');
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (6, '2018-06-08 13:15:50', '2018-06-08 13:15:48', 'ORG_ADMIN', '机构管理员');
+INSERT INTO `ec_b_role`(`id`, `creation_time`, `update_time`, `code`, `name`) VALUES (7, '2018-06-08 13:15:50', '2018-06-08 13:15:48', 'MARKER', '评卷员');
+
 
 --角色割接
 insert into ec_b_user_role_relation(user_id,role_id,role_code)   
-SELECT DISTINCT  X.user_id,Y.id,Y.code from ecs_core_user_role X, ec_b_role Y where x.role_code=Y.code;
+SELECT DISTINCT  X.user_id,Y.id,Y.code from ecs_core_user_role X, ec_b_role Y 
+where x.role_code=Y.code and X.user_id is not null;
+
+SELECT * from ecs_exam t  where t.org_id=t.root_org_id;
 
---删除ecs_exam表中的org_id的非空约束