| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- set define off
- set echo on
- whenever sqlerror exit sql.sqlcode
- alter session set container=ORCLPDB;
- alter session set current_schema=C##DC;
- declare
- v_count number;
- v_xh number;
- v_fwc clob;
- v_obj json_object_t;
- v_arr json_array_t;
- v_out clob;
- v_found boolean;
- type t_gw is table of number;
- type t_names is table of varchar2(100);
- v_gws t_gw := t_gw(1015544, 1015545, 1015546);
- 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 GRJJ
- where GRJJMBID = 10563
- and JLZTM = 51;
- if v_count = 0 then
- raise_application_error(-20001, '未找到有效的团委手机快捷入口模板 10563');
- end if;
- select count(*) into v_count
- from GW
- where GWID in (1015544, 1015545, 1015546)
- and FWC is not null;
- if v_count <> 3 then
- raise_application_error(-20002, '团委岗位或岗位权限不完整');
- end if;
- select count(*) into v_count
- from GRJJ
- where GRJJMBID = 10563
- and DXM = 'fjyrjc';
- if v_count = 0 then
- select nvl(max(XH), 0) + 1
- into v_xh
- from GRJJ
- where GRJJMBID = 10563;
- insert into GRJJ(
- GRJJMBID, XH, MC, BJM, TBM, DXM, FWM, GNM, JLZTM, FWSBLBM
- ) values(
- 10563, v_xh, '风纪仪容检查', 'mp_objList',
- 'icon-obj-xxwjjl', 'fjyrjc', 'fjyrjc_cx', 'search', 51, 51
- );
- end if;
- for g in 1 .. v_gws.count loop
- select FWC into v_fwc
- from GW
- where GWID = v_gws(g)
- 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 GW set FWC = v_out where GWID = v_gws(g);
- end loop;
- commit;
- dbms_output.put_line('FJYRJC_MOBILE_ENTRY_PROD_OK');
- end;
- /
- exit
|