光缆专业-数据库操作

本课目的:   学习光缆专业的一些数据库操作,以及资源在数据库中的关联关系。

本课要求:   理解掌握光缆专业的一些数据库操作,能在数据库中完成各项任务。  

主要内容:

 

1、各个光缆资源的res_type_id,和信息查询

--光缆 (700)
select * from opt_optical a where a.delete_state='0';
--光缆段(701)
select * from opt_optical_sect b where b.delete_state='0';
--光缆纤芯(702)
select c.opt_sect_id as 光缆段,c.big_sequence as 缆序* from opt_pair c where c.delete_state='0';
--光交接箱(703)
select * from opt_connect_box d  wheere d.delete_state='0';
--光分纤箱(704)
select * from opt_jnt_box e where e.delete_state='0';
--光接头盒(705)
select * from opt_tie_in f where f.delete_state='0';
--纤芯连接(706)
select g.opt_road_id as 所属光路,g.link_no as 纤芯连接编号,g.begin_term_id as 起始端子, g.end_term_id as 终止端子 from opt_pair_link g where g.delete_state='0';
--光路由节点(715)
select j.ept_type_id as 路由节点类型,j.relate_res_type_id as 节点上级路由类型, j.ept_id as 路由ID, j.sequence as 路由序号 from opt_pair_router j where j.delete_state='0'
--局向光纤(731)
select h.pair_no_desc as 局向编码,h.pair_no as 纤芯序号,h.optic_id as 所属光缆, h.a_term,h.z_term,h.a_device_id,h.z_device_id from opt_logic_opt_pair h where h.delete_state='0'
--逻辑纤芯路由(734)
select k.pair_id as 纤芯ID,k.root_type_id as  ,k.root_id from opt_logic_pair_route  k where k.delete_state='0'

 

2、根据光路查询光路路由

-- 根据光路查询光路路由
select r.*
from opt_road      d,  --光路
opt_pair_link    l,    --纤芯连接表
opt_pair_router   r     --光路由节点
where l.opt_road_id=d.opt_road_id
and r.link_id=l.link_id
and d.opt_road_id='000110080000000000736147'
and d.delete_state='0'
and l.delete_state='0'
and r.delete_state='0';

 

3、根据光路找到该光路所经过的光缆资源

--根据光路找到该光路所经过的光缆资源
select pr.root_id,p.pair_no_desc,p.pair_id
  from opt_road             d,
       opt_pair_link        l,
       opt_pair_router      r,
       opt_logic_opt_pair   p,
       opt_logic_pair_route pr
 where l.opt_road_id = d.opt_road_id
   and r.link_id = l.link_id
   and p.pair_id = r.ept_id
   and pr.pair_id = p.pair_id
   --and pr.root_type_id = 701
   and d.opt_road_id = '000110080000000000736147'
   and d.delete_state='0'
   and l.delete_state='0'
   and r.delete_state='0'and p.delete_state='0'  and pr.delete_state='0'

 

posted @ 2017-09-08 17:15  滚雪球俱乐部  阅读(368)  评论(0)    收藏  举报