| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- set define off
- set echo on
- whenever sqlerror exit sql.sqlcode
- alter session set container=ORCLPDB;
- alter session set current_schema=PMS_TEST;
- declare
- v_count number;
- v_xh number;
- v_grjjid number;
- v_fwc clob;
- v_obj json_object_t;
- v_arr json_array_t;
- v_out clob;
- v_found boolean;
- type t_names is table of varchar2(100);
- v_names t_names := t_names('fjyrjc','fjyrjc_ck','fjyrjc_lr');
- procedure add_service(p_name varchar2) is
- begin
- v_found := false;
- for i in 0 .. v_arr.get_size - 1 loop
- if v_arr.get_string(i) = p_name then
- v_found := true;
- exit;
- end if;
- end loop;
- if not v_found then
- v_arr.append(p_name);
- end if;
- end;
- begin
- select count(*) into v_count
- from RY
- where RYID=111157142 and RYH='cssg1' and GWID=1015504 and JLZTM=51;
- if v_count <> 1 then
- raise_application_error(-20001,'cssg1 人员、账号或宿管岗位关系不完整');
- end if;
- select count(*) into v_count
- from GRJJ where YYRYID=111157142;
- if v_count = 0 then
- raise_application_error(-20002,'cssg1 当前没有个人快捷入口,禁止退化为共享模板授权');
- end if;
- select count(*) into v_count
- from QZ q join QZCY qc on qc.QZID=q.QZID
- where q.QZID=5001141 and q.JLZTM=51
- and qc.RYID=111157142 and qc.JLZTM=51;
- if v_count < 1 then
- raise_application_error(-20003,'cssg1 专属权限群组或成员关系不完整');
- end if;
- select count(*) into v_count
- from GRJJ where YYRYID=111157142 and DXM='fjyrjc';
- if v_count = 0 then
- select nvl(max(XH),0)+1 into v_xh
- from GRJJ where YYRYID=111157142;
- insert into GRJJ(
- YYRYID,XH,MC,BJM,TBM,DXM,FWM,GNM,JLZTM,FWSBLBM
- ) values(
- 111157142,v_xh,'风纪仪容检查','mp_objList','icon-obj-xxwjjl',
- 'fjyrjc','fjyrjc_cx','search',51,51
- ) returning GRJJID into v_grjjid;
- insert into PMS_FJYRJC_CSSG1_CREATED_20261119(GRJJID,QZID,QZCYID,CREATED_AT)
- select v_grjjid,5001141,qc.QZCYID,systimestamp
- from QZCY qc where qc.QZID=5001141 and qc.RYID=111157142;
- end if;
- select FWC into v_fwc from QZ where QZID=5001141 for update;
- v_obj := json_object_t.parse(v_fwc);
- v_arr := v_obj.get_array('bjpj');
- if v_arr is null then
- v_arr := json_array_t();
- end if;
- for n in 1 .. v_names.count loop
- add_service(v_names(n));
- end loop;
- v_obj.put('bjpj',v_arr);
- v_out := v_obj.stringify;
- update QZ set FWC=v_out where QZID=5001141;
- commit;
- dbms_output.put_line('FJYRJC_CSSG1_TEST_OK');
- end;
- /
- exit
|