|
|
@@ -1,5 +1,6 @@
|
|
|
-- PC 值班人员拖放候选视图(增加专业、班级列)。
|
|
|
--- 候选范围:有效团体负责人 + 有效普通成员 + 有效职务成员。
|
|
|
+-- 候选范围:有效学生团体负责人 + 有效学生普通成员 + 有效学生职务成员。
|
|
|
+-- 候选对象仅保留学生(RY.RYLBM=1100),显示为“姓名(班级)”。
|
|
|
-- 专业、班级取当前有效班级成员关系 BJCY -> BJ -> ZY。
|
|
|
|
|
|
create or replace view xygz_tt_member_v as
|
|
|
@@ -15,6 +16,7 @@ with member_source as (
|
|
|
and (tt.ksrq is null or tt.ksrq <= trunc(sysdate))
|
|
|
and (tt.jsrq is null or tt.jsrq >= trunc(sysdate))
|
|
|
and ry.jlztm in (22, 25, 51)
|
|
|
+ and ry.rylbm = 1100
|
|
|
and nvl(ry.sfyzry, 0) = 0
|
|
|
union all
|
|
|
select cy.ttid,
|
|
|
@@ -32,6 +34,7 @@ with member_source as (
|
|
|
and (cy.ksrq is null or cy.ksrq <= trunc(sysdate))
|
|
|
and (cy.jsrq is null or cy.jsrq >= trunc(sysdate))
|
|
|
and ry.jlztm in (22, 25, 51)
|
|
|
+ and ry.rylbm = 1100
|
|
|
and nvl(ry.sfyzry, 0) = 0
|
|
|
union all
|
|
|
select wcy.ttid,
|
|
|
@@ -49,23 +52,42 @@ with member_source as (
|
|
|
and (wcy.ksrq is null or wcy.ksrq <= trunc(sysdate))
|
|
|
and (wcy.jsrq is null or wcy.jsrq >= trunc(sysdate))
|
|
|
and ry.jlztm in (22, 25, 51)
|
|
|
+ and ry.rylbm = 1100
|
|
|
and nvl(ry.sfyzry, 0) = 0
|
|
|
+),
|
|
|
+member_role as (
|
|
|
+ select ms.ttid,
|
|
|
+ ms.ryid,
|
|
|
+ max(ms.xm) xm,
|
|
|
+ max(ms.ryh) ryh,
|
|
|
+ listagg(ms.ryyt, '/') within group (order by ms.ryyt) ryyt
|
|
|
+ from member_source ms
|
|
|
+ group by ms.ttid, ms.ryid
|
|
|
+),
|
|
|
+member_class as (
|
|
|
+ select bc.ryid,
|
|
|
+ max(bc.bjid) bjid,
|
|
|
+ max(bj.mc) bjmc,
|
|
|
+ max(zy.zyid) zyid,
|
|
|
+ max(zy.mc) zymc
|
|
|
+ from bjcy bc
|
|
|
+ left join bj on bj.bjid = bc.bjid
|
|
|
+ left join zy on zy.zyid = bj.zyid
|
|
|
+ where bc.jlztm in (22, 25, 51)
|
|
|
+ and nvl(bc.sfby, 0) = 0
|
|
|
+ group by bc.ryid
|
|
|
)
|
|
|
-select ms.ttid,
|
|
|
- ms.ryid,
|
|
|
- max(ms.xm) xm,
|
|
|
- max(ms.ryh) ryh,
|
|
|
- max(ms.xm || case when ms.ryh is null then '' else '(' || ms.ryh || ')' end) xmmc,
|
|
|
- listagg(ms.ryyt, '/') within group (order by ms.ryyt) ryyt,
|
|
|
- max(bc.bjid) bjid,
|
|
|
- max(bj.mc) bjmc,
|
|
|
- max(zy.zyid) zyid,
|
|
|
- max(zy.mc) zymc,
|
|
|
+select mr.ttid,
|
|
|
+ mr.ryid,
|
|
|
+ mr.xm,
|
|
|
+ mr.ryh,
|
|
|
+ mr.xm || case when mc.bjmc is null or trim(mc.bjmc) is null
|
|
|
+ then '' else '(' || mc.bjmc || ')' end xmmc,
|
|
|
+ mr.ryyt,
|
|
|
+ mc.bjid,
|
|
|
+ mc.bjmc,
|
|
|
+ mc.zyid,
|
|
|
+ mc.zymc,
|
|
|
51 jlztm
|
|
|
- from member_source ms
|
|
|
- left join bjcy bc on bc.ryid = ms.ryid
|
|
|
- and bc.jlztm in (22, 25, 51)
|
|
|
- and nvl(bc.sfby, 0) = 0
|
|
|
- left join bj on bj.bjid = bc.bjid
|
|
|
- left join zy on zy.zyid = bj.zyid
|
|
|
- group by ms.ttid, ms.ryid;
|
|
|
+ from member_role mr
|
|
|
+ left join member_class mc on mc.ryid = mr.ryid;
|