ludc
2025-01-16 5203081b68e3a8dc139d1807b2f8774e4a00a82a
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
CREATE OR REPLACE TRIGGER "SYNC_USEDEPT_INITIALIZE_COPY"
  before insert or update or delete on platformlt_deptperson
/*************************************************************
author: liucq
create time: 2015.06.01
description: Á´½ÓÀàÐÍ ²¿ÃÅÈËÔ±£¨deptperson£©ÉϵÄǰÖô¥·¢Æ÷
             
 
logic rules: ½öÖ´Ðгõʼ»¯£¨Á´½ÓÀàÐÍ platformlt_deptuser ±íÖÐûÓÐÊý¾Ýʱ²ÅÖ´ÐгõʼÊý¾Ý²åÈ룩
             ÈËÔ± £¨person£© ÓжÔÓ¦µÄ Óû§£¨user£© ´æÔÚʱ£¬
             Ôò½« ²¿ÃÅÓëÈËÔ±µÄÁ´½Ó¹ØÏµ£¨deptperson£© ¸´ÖÆÒ»Ìõµ½ ²¿ÃÅÓëÓû§µÄÁ´½Ó¹ØÏµ £¨deptuser£©ÖÐ
last modifyer: 2017.06.07
last modify time: 2017.06.07
change history:
       2017.06.07 xchao Ìí¼Ó×¢ÊÍ
*************************************************************/
declare
  orgTabCount number;
  orgCount number;
begin
  select count(*) into orgTabCount from user_tables where lower(table_name) = 'platformlt_deptuser';
  if orgTabCount = 0 then
    return;
  else
    select count(*) into orgCount from platformlt_deptuser;
    if orgCount != 0 then
      return;
    else
        insert into platformlt_deptuser (
          OID,
          CREATOR,
          CREATETIME,
          LASTMODIFIER,
          LASTMODIFYTIME,
          F_OID,
          F_REVISIONOID,
          F_NAMEOID,
          F_BTWNAME,
          T_OID,
          T_REVISIONOID,
          T_NAMEOID,
          T_BTWNAME,
          TS,
          ISPARTTIME,
          REFPOST
       )
       select get_uuid, '', '', '', '', dp.f_oid, dp.f_revisionoid, dp.f_nameoid, dp.f_btwname, u.oid, u.revisionoid, u.nameoid, u.btmname, '', dp.isparttime, dp.refpost
       from platformlt_deptperson dp, platformbtm_person p,  platformbtm_user u where dp.t_oid = p.oid and p.id = u.id;
     end if;
   end if;
end;
/