create or replace procedure
department_insert_test _users(testuser in
varchar2,iCount in number)
is
i int; --parent
department stru_id BPM
p_stru_id varchar2(30);
p_organ_id varchar2(30);
p_stru_path varchar2(20);
account varchar2(20);
var_organ_name varchar2(20);
var_organ_id varchar2(20);
var_stru_id varchar2(20);
var_stru_path varchar2(1000);
begin --insert
bpm department
p_stru_id :='Sp_stru_id00113';
p_organ_id :='Op_organ_id0113';
p_stru_path :='1#'
|| p_stru_id; delete from
test_stru where STRU_ID=p_stru_id; delete
from test_organ where organ_id=p_organ_id;
commit; insert into TEST_ORGAN
(ORGAN_ID, ORGAN_CODE, ORGAN_NAME, SHORT_NAME, ORGAN_TYPE,
WORKPLACE_ID, BEGIN_DATE, END_DATE, SCN, IN_USE)
values (p_organ_id, '999902',
'BPM部门',
'BPM部门',
'2', '1',
'20080904',
'99991231',
50, '1');
insert into TEST_STRU (STRU_ID, ORGAN_ID,
ORGAN_ALIAS, STRU_TYPE, PARENT_ID, PRINCIPAL_ID,
CORPORATION_ID, STRU_LEVEL, STRU_PATH, STRU_ORDER,
GLOBAL_ORDER, BEGIN_DATE, END_DATE, SCN, IS_LEAF,
IN_USE, DEPARTMENT_ID, PERMISSION_STRU_ID) values
(p_stru_id, p_organ_id, 'BPM部门',
'00', '1',
null, '1',
2, p_stru_path,
400, 1,
'20080904',
'99991231',
54, '0',
'1', '1',
'1');
commit; for i in 1..iCount
loop
--insert organ
,
stru
var_organ_name :='BPM员工'
|| to_char(i);
var_organ_id :='vorgan_id'
|| to_char(i);
var_stru_id :='vstru_id'
|| to_char(i);
var_stru_path :=p_stru_path ||'#'||
var_stru_id;
insert into TEST_ORGAN (ORGAN_ID,
ORGAN_CODE, ORGAN_NAME, SHORT_NAME, ORGAN_TYPE,
WORKPLACE_ID, BEGIN_DATE, END_DATE, SCN, IN_USE)
values (var_organ_id, var_organ_id, var_organ_name,
var_organ_name, '8',
'1',
'20080904',
'99991231',
57, '1');
insert into TEST_STRU (STRU_ID,
ORGAN_ID, ORGAN_ALIAS, STRU_TYPE, PARENT_ID, PRINCIPAL_ID,
CORPORATION_ID, STRU_LEVEL, STRU_PATH, STRU_ORDER,
GLOBAL_ORDER, BEGIN_DATE, END_DATE, SCN, IS_LEAF,
IN_USE, DEPARTMENT_ID, PERMISSION_STRU_ID)
values (var_stru_id, var_organ_id, var_organ_name,
'00',
p_organ_id, null, '1',
3, var_stru_path,
200,
1, '20080904',
'99991231',
58, '1',
'1',
p_organ_id,
'1');
--insert user
account := testuser || to_char(i);
insert into TEST_USERS (USER_ID,
EXTERNAL_USER, USER_NAME, PASSWORD, ACCOUNT_STATUS,
SECURITY_LEVEL, MAX_SESSIONS, IS_SYS, IS_CPUBLIC,
CREATE_TIME, LOCK_TIME, EXPIRED_TIME, PSWD_UPT_TIME,
PSWD_TIME, CORPORATION_ID, DEPARTMENT_ID, EMPLOYEE_ID,
E_MAIL, MSN, QQ, MOBILE, CHAR_1, CHAR_2, NUM_1,
NUM_2, PERMISSION_STRU_ID)
values (account, '01',
var_organ_name, '
99c6b157085564b43b85711360ec6166', '11',
0, -1,
'0',
'0',
'20080904 16:12:57',
null, '99991231
23:59:59', '20080904
16:12:57', '20081103
16:12:57', '1',
p_stru_id, var_stru_id, null, null,
null, null, null, null,
0, 0,
'1');
insert into TEST_USER_DATAREF (REF_ID,
USER_ID, RES_VALUE, DATA_RES_TYPE, IS_DEFAULT,
IN_USE, STRU_ID, STRU_TYPE, DATE_BEGIN, DATE_END,
IS_WRITABLE)
values (account, account, '1',
'permitOrgT',
'1',
'1',
null, null, '20000101',
'99991231',
'1');
insert into TEST_USER_PROXY (USER_ID,
PROXY_USER_ID)
values ('CPUBLIC',
account);
insert into TEST_USER_PROXY (USER_ID,
PROXY_USER_ID)
values ('GPUBLIC',
account);
insert into TEST_USER_ROLE (USER_ID,
GRANTED_ROLE, ADMIN_OPTION, DEFAULT_ROLE)
values (account, 'GPUBLIC',
'1',
'1');
insert into TEST_USER_ROLE (USER_ID,
GRANTED_ROLE, ADMIN_OPTION, DEFAULT_ROLE)
values (account, 'SYSADMIN',
'1',
'1');
insert into TEST_USER_ROLE (USER_ID,
GRANTED_ROLE, ADMIN_OPTION, DEFAULT_ROLE)
values (account,
'WORKFLOWADMIN', '1',
'1');
insert into TEST_USER_ROLE (USER_ID,
GRANTED_ROLE, ADMIN_OPTION, DEFAULT_ROLE)
values (account,
'WORKFLOWCOMUSER', '1',
'1');
insert into TEST_STRU_TYPE_REF (USER_ID,
STRU_TYPE, STRU_ID, ORGAN_NAME)
values (account, '00',
'1',
'State Grid');
end loop;
commit;
end department_insert_test_users; |