1.对于要将不同的表,不同的字段抽取出来再前台进行展示,以前我的做法是,创建一张新表里面包含展示用的字段,创建一个拦截器,每当需要对这几张原始表有修改操作时,便会同步更新这张新表,前台就用新表进行展示。今天学到一个新的做法,通过创建一个视图,把所能在其他表里查询到的东西综合成一个视图,前台只需要展示该视图即可。以前很少使用视图,思维被局限了。 这算是这连续大半个月的小项目的最大的收获了吧。
create or replace view complex(refid,title,xianju,type) as
select hlhjy.id refid,hlhjy.hlhjyname title ,hlhjycollect.xianju xianju,hlhjy.type type from
hlhjy,hlhjycollect where hlhjy.hlhjyname=hlhjycollect.hlhjyname
union
select resproject.guid refid,resproject.title title,resproject.qtdep xianju,resproject.type from resproject
union
select mzshhinfo.id refid,mzshhinfo.jybt title,mzshhinfo.bm xianju,mzshhinfo.type type from mzshhinfo
union
select zgjyinfo.id refid,zgjyinfo.jybt title,zgjyinfo.bm xianju,zgjyinfo.type type from zgjyinfo
利用dual表给视图增添默认值列:
create or replace view tzzl(type,name,refid) as (select d.type,xm.tzmc,xm.guid from PPC_XMSBTZ xm,(select '项目申报通知' type from dual) d
)
union
(select d.type,xm.tzmc,xm.guid from PPC_WZSBTZS xm,(select '项目申报通知' type from dual) d
)
2. 工作中经常会遇到tomcat起不起来,提示端口被占用,解决方法:
1. 命令行中输入:netstat -ano 查看进程及端口相关情况
2. 找到对应占用端口的进程pid, 用 ntsd -c q -p pid 终止该进程。