|
|
@@ -0,0 +1,211 @@
|
|
|
+whenever sqlerror exit sql.sqlcode rollback
|
|
|
+set serveroutput on
|
|
|
+alter session set container=ORCLPDB;
|
|
|
+
|
|
|
+prompt ===== 星级班配置版本与月结指标明细 =====
|
|
|
+
|
|
|
+declare
|
|
|
+ v_count number;
|
|
|
+ v_pzid number;
|
|
|
+
|
|
|
+ procedure add_column(
|
|
|
+ p_table varchar2,
|
|
|
+ p_column varchar2,
|
|
|
+ p_definition varchar2
|
|
|
+ ) is
|
|
|
+ begin
|
|
|
+ select count(*) into v_count
|
|
|
+ from all_tab_columns
|
|
|
+ where owner='C##DC'
|
|
|
+ and table_name=p_table and column_name=p_column;
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate 'alter table C##DC.' || p_table
|
|
|
+ || ' add ' || p_column || ' ' || p_definition;
|
|
|
+ end if;
|
|
|
+ end;
|
|
|
+begin
|
|
|
+ add_column('XJB_JD', 'PZID', 'number');
|
|
|
+
|
|
|
+ select count(*) into v_count from all_tables
|
|
|
+ where owner='C##DC' and table_name='XJB_PZ';
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate '
|
|
|
+ create table C##DC.XJB_PZ(
|
|
|
+ PZID number primary key,
|
|
|
+ PZBB varchar2(32) not null,
|
|
|
+ MC varchar2(100) not null,
|
|
|
+ KSRQ date not null,
|
|
|
+ JSRQ date,
|
|
|
+ JLZTM number not null,
|
|
|
+ SM varchar2(500),
|
|
|
+ CJSJ date not null
|
|
|
+ )';
|
|
|
+ execute immediate
|
|
|
+ 'create unique index C##DC.UX_XJB_PZ_BB on C##DC.XJB_PZ(PZBB)';
|
|
|
+ end if;
|
|
|
+
|
|
|
+ select count(*) into v_count from all_tables
|
|
|
+ where owner='C##DC' and table_name='XJB_PZMX';
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate '
|
|
|
+ create table C##DC.XJB_PZMX(
|
|
|
+ PZMXID number primary key,
|
|
|
+ PZID number not null,
|
|
|
+ XMLB varchar2(20) not null,
|
|
|
+ XMBM varchar2(32) not null,
|
|
|
+ XMMC varchar2(100) not null,
|
|
|
+ ZBZ number(12,4),
|
|
|
+ SM varchar2(500),
|
|
|
+ CJSJ date not null
|
|
|
+ )';
|
|
|
+ execute immediate
|
|
|
+ 'create unique index C##DC.UX_XJB_PZMX_BM on C##DC.XJB_PZMX(PZID,XMLB,XMBM)';
|
|
|
+ end if;
|
|
|
+
|
|
|
+ select count(*) into v_count from all_tables
|
|
|
+ where owner='C##DC' and table_name='XJB_JGMX';
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate '
|
|
|
+ create table C##DC.XJB_JGMX(
|
|
|
+ JGMXID number primary key,
|
|
|
+ XJB_JDID number not null,
|
|
|
+ XJB_JGID number not null,
|
|
|
+ BJID number not null,
|
|
|
+ NDY varchar2(7) not null,
|
|
|
+ XMBM varchar2(32) not null,
|
|
|
+ XMMC varchar2(100) not null,
|
|
|
+ YSZ number(12,4),
|
|
|
+ QZ number(8,4),
|
|
|
+ DF number(12,4),
|
|
|
+ LYLX varchar2(32),
|
|
|
+ SM varchar2(1000),
|
|
|
+ SX number not null,
|
|
|
+ CJRYID number,
|
|
|
+ CJBM_ID number,
|
|
|
+ JLSJ date not null
|
|
|
+ )';
|
|
|
+ execute immediate
|
|
|
+ 'create index C##DC.IX_XJB_JGMX_JD on C##DC.XJB_JGMX(XJB_JDID,BJID,SX)';
|
|
|
+ execute immediate
|
|
|
+ 'create unique index C##DC.UX_XJB_JGMX_ITEM on C##DC.XJB_JGMX(XJB_JGID,XMBM)';
|
|
|
+ end if;
|
|
|
+
|
|
|
+ select count(*) into v_count from all_sequences
|
|
|
+ where sequence_owner='C##DC' and sequence_name='XJB_PZID';
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate
|
|
|
+ 'create sequence C##DC.XJB_PZID start with 1 increment by 1 nocache';
|
|
|
+ end if;
|
|
|
+ select count(*) into v_count from all_sequences
|
|
|
+ where sequence_owner='C##DC' and sequence_name='XJB_PZMXID';
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate
|
|
|
+ 'create sequence C##DC.XJB_PZMXID start with 1 increment by 1 nocache';
|
|
|
+ end if;
|
|
|
+ select count(*) into v_count from all_sequences
|
|
|
+ where sequence_owner='C##DC' and sequence_name='XJB_JGMXID';
|
|
|
+ if v_count=0 then
|
|
|
+ execute immediate
|
|
|
+ 'create sequence C##DC.XJB_JGMXID start with 1 increment by 1 nocache';
|
|
|
+ end if;
|
|
|
+end;
|
|
|
+/
|
|
|
+
|
|
|
+declare
|
|
|
+ v_count number;
|
|
|
+ v_pzid number;
|
|
|
+begin
|
|
|
+ select count(*) into v_count from C##DC.XJB_PZ
|
|
|
+ where PZBB='SC-2024-10-V1';
|
|
|
+ if v_count=0 then
|
|
|
+ select C##DC.XJB_PZID.nextval into v_pzid from dual;
|
|
|
+ insert into C##DC.XJB_PZ(
|
|
|
+ PZID,PZBB,MC,KSRQ,JSRQ,JLZTM,SM,CJSJ
|
|
|
+ ) values(
|
|
|
+ v_pzid,'SC-2024-10-V1','星级班评分口径2024-10版',
|
|
|
+ date '2024-10-01',null,51,
|
|
|
+ '第三方公式版本B:考勤15%、风纪20%、清洁18%、升旗14%、宿舍20%、课堂5%;团体封顶3;总增分封顶8。',
|
|
|
+ sysdate
|
|
|
+ );
|
|
|
+ else
|
|
|
+ select PZID into v_pzid from C##DC.XJB_PZ
|
|
|
+ where PZBB='SC-2024-10-V1';
|
|
|
+ end if;
|
|
|
+
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'WEIGHT','DORM','宿舍评分',0.2000,
|
|
|
+ '常规项权重',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='WEIGHT' and XMBM='DORM');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'WEIGHT','CLASSROOM','课堂考核',0.0500,
|
|
|
+ '常规项权重',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='WEIGHT' and XMBM='CLASSROOM');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'WEIGHT','FLAG','升旗礼',0.1400,
|
|
|
+ '常规项权重',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='WEIGHT' and XMBM='FLAG');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'WEIGHT','CLEANING','清洁卫生',0.1800,
|
|
|
+ '常规项权重',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='WEIGHT' and XMBM='CLEANING');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'WEIGHT','DISCIPLINE','风纪仪容',0.2000,
|
|
|
+ '常规项权重',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='WEIGHT' and XMBM='DISCIPLINE');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'WEIGHT','ATTENDANCE','考勤',0.1500,
|
|
|
+ '常规项权重',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='WEIGHT' and XMBM='ATTENDANCE');
|
|
|
+
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'CAP','TEAM_BONUS','学生团体增分封顶',3,
|
|
|
+ '先封顶团体,再与其他增分合并',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='CAP' and XMBM='TEAM_BONUS');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'CAP','TOTAL_BONUS','总增分封顶',8,
|
|
|
+ '最终增分封顶',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='CAP' and XMBM='TOTAL_BONUS');
|
|
|
+
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'THRESHOLD','FIVE_MIN','五星级下限',90,
|
|
|
+ '第三方口径为大于90',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='THRESHOLD' and XMBM='FIVE_MIN');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'THRESHOLD','FOUR_MIN','四星级下限',80,
|
|
|
+ '第三方口径为大于80',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='THRESHOLD' and XMBM='FOUR_MIN');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'THRESHOLD','THREE_MIN','三星级下限',75,
|
|
|
+ '第三方口径为大于75',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='THRESHOLD' and XMBM='THREE_MIN');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'THRESHOLD','TWO_MIN','二星级下限',65,
|
|
|
+ '第三方口径为大于65',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='THRESHOLD' and XMBM='TWO_MIN');
|
|
|
+ insert into C##DC.XJB_PZMX(PZMXID,PZID,XMLB,XMBM,XMMC,ZBZ,SM,CJSJ)
|
|
|
+ select C##DC.XJB_PZMXID.nextval,v_pzid,'THRESHOLD','ONE_MIN','一星级下限',55,
|
|
|
+ '第三方口径为大于55',sysdate from dual
|
|
|
+ where not exists (select 1 from C##DC.XJB_PZMX
|
|
|
+ where PZID=v_pzid and XMLB='THRESHOLD' and XMBM='ONE_MIN');
|
|
|
+
|
|
|
+ commit;
|
|
|
+end;
|
|
|
+/
|
|
|
+
|
|
|
+select PZID,PZBB,MC,KSRQ,JSRQ,JLZTM from C##DC.XJB_PZ;
|
|
|
+select XMLB,count(*) CNT from C##DC.XJB_PZMX
|
|
|
+ where PZID=(select PZID from C##DC.XJB_PZ where PZBB='SC-2024-10-V1')
|
|
|
+ group by XMLB order by XMLB;
|
|
|
+exit;
|