1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
| CREATE OR REPLACE TRIGGER "SYNC_DEPT_COPY"
| before insert or update or delete on pldept
| for each row
| /*************************************************************
| author: liucq
| create time: 2015.06.01
| description: Ôʼ²¿ÃÅ±í£¨pldept£©ÉϵÄǰÖô¥·¢Æ÷£¬
| µ±²¿ÃÅ±í·¢ÉúÌí¼Ó¡¢Ð޸ġ¢É¾³ýÊý¾Ýʱ£¬
| ͬ²½¸üе½Ó벿ÃŶÔÓ¦µÄÒµÎñÀàÐÍ Èº×é(organization)±í
| logic rules:
| last modifyer: 2017.06.07
| last modify time: 2017.06.07
| change history:
| 2017.06.07 xchao Ìí¼Ó×¢ÊÍ
| *************************************************************/
| declare
| deptcount number;
| parentorg varchar2(100):='';
| begin
| if :new.plparentuid is null or length(:new.plparentuid) = 0 then
| parentorg := 'root';
| else
| parentorg := :new.plparentuid;
| end if;
|
| if inserting then
| insert into platformbtm_organization
| values
| (:new.PLUID,
| get_uuid,
| get_uuid,
| 'organization',
| '1',
| '1',
| '1',
| '1',
| :new.plcreateuser,
| :new.plcreatetime,
| :new.plcreateuser,
| :new.plcreatetime,
| '',
| '',
| '1',
| '',
| '1',
| '',
| 'OrganizationtLC',
| 'Exist',
| :new.plcreatetime,
| :new.plnum,
| :new.plname,
| :new.pldesc,
| :new.plcreateuser,
| :new.plcreateuser,
| :new.plcreatetime,
| '',
| '',
| '',
| parentorg
| );
| end if;
| if updating then
| select count(*) into deptcount from platformbtm_organization dept where dept.oid = :old.pluid;
| if deptcount = 0 then
| insert into platformbtm_organization
| values
| (:new.PLUID,
| get_uuid,
| get_uuid,
| 'organization',
| '1',
| '1',
| '1',
| '1',
| :new.plcreateuser,
| :new.plcreatetime,
| :new.plcreateuser,
| :new.plcreatetime,
| '',
| '',
| '1',
| '',
| '1',
| '',
| 'OrganizationtLC',
| 'Exist',
| :new.plcreatetime,
| :new.plnum,
| :new.plname,
| :new.pldesc,
| :new.plcreateuser,
| :new.plcreateuser,
| :new.plcreatetime,
| '',
| '',
| '',
| parentorg
| );
| else
| update platformbtm_organization dept
| set dept.id = :new.plnum,
| dept.name = :new.plname,
| dept.description = :new.pldesc,
| dept.lastmodifier = :new.plupdateuser,
| dept.lastmodifytime = :new.plupdatetime,
| dept.ts = :new.plupdatetime
| where dept.oid = :old.pluid;
| end if;
| end if;
| if deleting then
| delete from platformbtm_organization dept
| where dept.oid = :old.pluid;
| end if;
| end;
| /
|
|