from(
SELECT se.test_set_id,ca.serial_id, se.test_set_name,se.task_name, se.build_tab, ca.test_case_no,ca.test_case_name, se.responsibility ,se.participant ,se.begin_date, se.end_date,se.test_environment_name,
ca.version_id,ca.is_latest, ca.ca_level, para1.param_text do_status, decode(instr(to_char(do.do_date, 'yyyy-mm-dd'),'1900-01-01'), 0,do.do_date,'') do_date, ca.serial_number, decode(ca.estimate_test_do_time,-1,'',ca.estimate_test_do_time) estimate_test_do_time,decode(do.grand_total_do_time,0,'',do.grand_total_do_time) grand_total_do_time, do.test_do_desc,do.excuteuser
FROM OT_TEST_DO do
left join ot_parameter para1 on do.status = para1.param_value and para1.param_name = 'TestDoStatus'
inner join (select se.serial_id test_set_id, se.test_set_name,pms.task_name, se.responsibility ,
se.participant ,se.begin_date , se.end_date ,
en.test_environment_name,
(select ta.build_tab
from (select f.serial_id, f.fold_name as build_tab, f.parent_id
from ot_test_folder f where f.enabled_flag = 1 and f.test_object_id = {#TEST_OBJECT_ID#} and f.org_id = {#ORG_ID#}
union
select t.serial_id, t.build_tab, -1 as parent_id
from OT_TEST_BUILD_TAB t where t.enabled_flag = 1 and t.test_object_id = {#TEST_OBJECT_ID#} and t.org_id = {#ORG_ID#}
) ta
where ta.parent_id = -1
start with ta.serial_id = se.PARENT_OBJECT_ID
connect by ta.serial_id = prior ta.parent_id) as build_tab
from OT_TEST_SET se
left join
(select spr.test_set_id, wmsys.wm_concat(pmt.task_name) as task_name
from ot_test_set_pms_relation spr
inner join ot_pms_task pmt on spr.pms_task_id = pmt.serial_id
where spr.test_object_id = {#TEST_OBJECT_ID#} and spr.enabled_flag = 1 and spr.org_id = {#ORG_ID#}
and pmt.test_object_id = {#TEST_OBJECT_ID#} and pmt.enabled_flag = 1 and pmt.org_id = {#ORG_ID#}
{$ and pmt.task_name like {?30?} escape '/' $}
group by spr.test_set_id) pms on se.serial_id = pms.test_set_id
left join ot_test_environment en on se.test_environment_id = en.serial_id
where
se.test_object_id = {#TEST_OBJECT_ID#}
and se.org_id = {#ORG_ID#}
and se.enabled_flag = 1
{$ and pms.task_name like {?30?} escape '/' $}
{$ and se.test_set_name like {?1?} escape '/' $}
{$ and se.responsibility like {?4?}escape '/' $}
{$ and se.participant like {?5?} escape '/'$}
{$ and se.begin_date >= {?6_s?} $} {$ and se.begin_date<= {?6_e?} $}
{$ and se.end_date >= {?7_s?} $} {$ and se.end_date<= {?7_e?} $}
{$ and en.serial_id = {?20?} $}
) se on do.test_set_id = se.test_set_id {$ and se.build_tab like {?3?} escape '/' $}
inner join (select cas.serial_id, cas.test_case_no,cas.test_case_name,cas.version_id,
case when cas.enabled_flag <> 1 then 'N/A' when cas.is_latest = 0 then '否' else '是' end is_latest, para.param_text ca_level, cas.estimate_test_do_time,
(select wmsys.wm_concat(serial_number)
from OT_EC_CHANGE ec
where ec.test_case_id = cas.serial_id
) serial_number
from OT_TEST_CASE cas
left join ot_parameter para on cas.test_case_level = para.param_value and para.param_name = 'TestCaseLevel'
where
cas.test_object_id = {#TEST_OBJECT_ID#}
and cas.org_id = {#ORG_ID#}
{$ and cas.test_case_no like {?10?} escape '/' $}
{$ and cas.test_case_name like {?11?} escape '/' $}
{$ and cas.test_case_level = {?22?} $}
) ca on do.test_case_id = ca.serial_id
WHERE
do.ENABLED_FLAG = 1
AND do.test_object_id = {#TEST_OBJECT_ID#}
AND do.org_id = {#ORG_ID#}
{$ and do.status = {?23?} $}
{$ and do.do_date >= {?24_s?} $} {$ and do.do_date <= {?24_e?} +1 $}
{$ and ca.serial_number like {?25?} escape '/' $}
)
Oracle树形结构查询
最新推荐文章于 2021-01-18 21:46:58 发布