wangwei 6 سال پیش
والد
کامیت
f2ac10cd2e
2فایلهای تغییر یافته به همراه0 افزوده شده و 94 حذف شده
  1. 0 34
      sql/云平台2.0升级-数据割接-基础信息.sql
  2. 0 60
      sql/考生导入-存储过程.sql

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

@@ -1,34 +0,0 @@
-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;
-
-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 and X.user_id is not null;
-
-SELECT * from ecs_exam t  where t.org_id=t.root_org_id;
-
-
-

+ 0 - 60
sql/考生导入-存储过程.sql

@@ -1,60 +0,0 @@
-CREATE DEFINER = CURRENT_USER PROCEDURE `import_exam_students`(IN `batch_id` bigint)
-BEGIN
-	declare total BIGINT(20);
-	declare count BIGINT(20);
-	declare id BIGINT(20);
-	declare course_id_temp BIGINT(20);
-	declare course_id BIGINT(20);
-	declare course_code varchar(255); 
-	declare identity_number varchar(255); 
-	declare student_code varchar(255);
-	declare org_id_temp BIGINT(20);
-	declare org_id BIGINT(20);
-	declare org_code varchar(255);
- 	declare	root_org_id  BIGINT(20);
-	
-	DECLARE cursor_temp CURSOR FOR  
-	select t.id,t.course_id,t.org_id,t.course_code,t.student_code,t.identity_number,t.org_code,t.root_org_id 
-	from ec_e_exam_student_tmp t 
-	where t.batch_id= batch_id;
-	
-  set count = 0;
-	select count(1) into total 	from ec_e_exam_student_tmp t 	where t.batch_id= batch_id;
-	
-	open cursor_temp;
-	
-	read_loop: LOOP
-		set count = count+1;
-		FETCH cursor_temp INTO id,course_id,org_id,course_code,student_code,identity_number,org_code,root_org_id;
-		
-    SELECT		id,course_id,org_id,course_code,student_code,identity_number,org_code,root_org_id;
-		
-		IF course_id is null THEN
-			SELECT x.id into course_id_temp from ecs_core_course x where x.code= course_code and x.enable=true and x.org_id=root_org_id;
-			IF course_id_temp is not null THEN
-				 update ec_e_exam_student_tmp x set x.course_id=course_id_temp 
-				 where  x.course_id is null and x.course_code=course_code and x.root_org_id=root_org_id and  x.batch_id= batch_id;
-			END IF;
-			set course_id_temp=null;
-		END IF;
-		
-		IF org_id is null THEN
-			SELECT x.id into org_id_temp from ecs_core_org x where x.code= org_code and x.root_id=root_org_id;
-			IF org_id_temp is not null THEN
-				 update ec_e_exam_student_tmp x set x.org_id=org_id_temp 
-				 where  x.org_id is null and x.org_code=org_code and x.root_org_id=root_org_id and  x.batch_id= batch_id;
-			END IF;
-			set org_id_temp=null;
-		END IF;
-		
-		commit;
-		
-		IF total = count THEN
-			LEAVE read_loop;
-		END IF;
-		
-	END LOOP;
- 	
-    close cursor_temp;
-	
-END