数据库查询和处理语句

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

目录

数据库查询和处理语句(八) (2)

1、批量复制分公司的一些门户 (2)

2、文档查询中的修改区间是否可以调整? (2)

3、把所有已经归档的流程,归档人未查看的批量置为已查看的SQL语句 (3)

4、批量修改流程的属性的语句 (3)

5、著者文档数量的脚本 (3)

6、个人文档脚本 (4)

7、流程超时人员检索SQL (4)

数据库查询和处理语句(八)

本期为您提供在维护ecology系统的过程中,一些常用的数据库查询和处理语句。

重点提醒:操作之前,请千万备份数据库!!!!!

1、批量复制分公司的一些门户

注:44是要被复制的子公司的名字。1是不需要复制的公司的名字。

Insert into extendHpWebCustom(templateid,subCompanyId,pagetemplateid,menuid,menustyleid,defaultshow,leftmenuid)

select b.templateid,a.id,b.pagetemplateid,b.menuid,b.menustyleid,b.defaultshow,b.leftmenuid from HrmSubCompany a,extendHpWebCustom b where a.id not in(select x.subCompanyId from extendHpWebCustom x) and b.subCompanyId=44 ----根据情况修改

go

Insert into SystemTemplate(templateName,companyId,topBgColor,toolbarBgColor,leftbarBgColor,leftbarFontColor,menubarBgColor,menubtnB gColor,menubtnBgColorActive,menubtnBgColorHover,menubtnFontColor,menubtnBorderColorActive,menubtnBorderColorHover,te mplateTitle,isOpen,extendtempletid,extendtempletvalueid)

select

templateName,a.id,topBgColor,toolbarBgColor,leftbarBgColor,leftMenuFontColor,menubarBgColor,menubtnBgColor,menubtnBgCol orActive,menubtnBgColorHover,menubtnFontColor,menubtnBorderColorActive,menubtnBorderColorHover,templateTitle,isOpen,ext endtempletid,extendtempletvalueid from HrmSubCompany a,SystemTemplate b where a.id<>1 and a.id not in(select panyId from SystemTemplate x) and panyId=44 ----根据情况修改

go

update extendHpWebCustom set templateid=SystemTemplate.id

from SystemTemplate

where extendHpWebCustom.subCompanyId=panyId

and extendHpWebCustom.subCompanyId<>1 ----根据情况修改

go

update SystemTemplate set extendtempletvalueid=id

where id<>1----根据情况修改

2、文档查询中的修改区间是否可以调整?

查询ecology目录下有一个叫:docdateduring的文档。

如果你想默认显示近三年的,只要将date2during=36便可以了。

设置完成后要重启下Resin服务

3、把所有已经归档的流程,归档人未查看的批量置为已查看的SQL语句

--注:需要调整语句最后的参数@userid(人力资源id,表Hrmresource.id)

-----查询语句

select * from workflow_currentoperator where

exists (select 1 from workflow_requestbase where

workflow_requestbase.currentnodeid=workflow_currentoperator.nodeid and currentnodetype=3 and workflow_currentoperator.viewtype=0 and workflow_erid=@userid)

-----修改语句

update workflow_currentoperator set viewtype=-2 where

exists (select 1 from workflow_requestbase where

workflow_requestbase.currentnodeid=workflow_currentoperator.nodeid and currentnodetype=3 and workflow_currentoperator.viewtype=0 and workflow_erid=@userid)

4、批量修改流程的属性的语句

update workflow_base set orderbytype='2' ,defaultName=0,ShowDelButtonByReject='1',candelacc='1'

update workflow_flownode set toexcel='1'

orderbytype char(1) null 流程审批意见显示顺序

1:倒序;2:正序

defaultName int NULL 是否默认说明

0:否

1:是

ShowDelButtonByReject char(1) null 退回创建节点是否可删

1:是;0或其它:否

candelacc char(1) Null 是否允许删除附件

1:允许其它:不允许

5、著者文档数量的脚本

select t1.ownerid, avg(t3.departmentid) AS docdepartmentid,

count(t1.id) AS resultcount from DocDetail t1, (SELECT sourceid,MAX(sharelevel)

AS sharelevel from ShareinnerDoc where((type=1 and content=1) or

(type=4 and content in (12,22,32,42,52,62,72,82,92,102,112,122,132,142,152,162,172,182,192,202,212,222,252) and seclevel<=30) or (type=5 and content=1 and seclevel<=30)

) GROUP BY sourceid ) t2,HrmResource t3 where (ishistory is null or ishistory

= 0) and usertype>0 and t1.maincategory in (select id from DocMainCategory) and

t1.docstatus in ('1','2','5') and (isreply='' or isreply is null)

and maincategory!=0 and subcategory!=0 and seccategory!=0 and t1.id=t2.sourceid

and t1.ownerid=t3.id group by ownerid order by ownerid

相关文档
最新文档