本文已参与「新人创作礼」活动,一起开启掘金创作之路。
涉及流程管理相关的SQL语句(二)
查询流程已删除,但是消息未删除的数据
select * from ECOLOGY_MESSAGE_INFO_READ
where targetid
in (select requestid from workflow_requestbase_dellog)
查询人员B在某个时间端内,审批过的流程,可以区分开是B自己的流程审批,还是A代理给B审批的流程
select distinct
t2.requestname as 流程标题,
t2.requestid,
t2.requestmark as 单号,
t2.createdate as 申请日期,
t2.createtime as 申请时间,
(select nodename from workflow_nodebase where id = t.nodeid) as 节点名称,
case t.agenttype
when '2' then
(select lastname from hrmresource where t.agentorbyagentid = id) + '->' +
(select lastname from hrmresource where t.userid = id)
when '0' then
(select lastname from hrmresource where t.userid = id)
else
(select lastname from hrmresource where t.userid = id) + '->' +
(select lastname from hrmresource where t.agentorbyagentid = id)
end as 节点名审核人,
t.operatedate +' '+ t.operatetime as 节点提交日期时间
from workflow_currentoperator t, workflow_requestbase t2
where t.requestid = t2.requestid
and t2.createdate >= '2018-08-01'
and t2.createdate <= '2019-02-28'
and userid = 21
order by t2.requestid desc
导出有效流程的所有节点
select workflowname,nodename
from workflow_base a,workflow_flownode b,workflow_nodebase c
where b.workflowid =a.id and c.id=b.nodeid and a.isvalid=1
order by workflowname,c.id asc
查询一个流程在某个节点的所有流程
--select t.logtype,t.* from workflow_requestlog t where requestid = '186406';
select wbase.workflowname as "流程名称",reqbase.requestid as "请求编号",
nodename.nodename as "节点名称",reqbase.status as "当前请求状态",
log.operatedate as "操作日期",log.operatetime as "操作时间",hrm.lastname
as "操作人", log.remark as "签字意见",wnode.nodeid as "节点ID"
from workflow_flownode wnode
left join workflow_nodebase nodename on wnode.nodeid=nodename.id
left join workflow_base wbase on wbase.id=wnode.workflowid
left join workflow_requestbase reqbase on reqbase.workflowid=wnode.workflowid
left join workflow_requestlog log on log.nodeid=wnode.nodeid
and reqbase.requestid=log.requestid
left join hrmresource hrm on log.operator=hrm.id
where wbase.id= '1380' AND wnode.nodeid = '3441' order by wnode.nodeorder,log.operatedate,log.operatetime;
查询某个人审批的流程列表
select g.subcompanyname '申请人公司名称',k.departmentname '申请人部门',h.lastname '申请人',
a.createdate '申请日期',b.receivedate + ' ' + b.receivetime '单据到达日期',
b.operatedate + ' ' + b.operatetime '单据处理日期',
f.typename '流程类型',e.workflowname '流程名称',a.requestname '流程单据名称',
c.lastname '处理人员',l.jobtitlename '岗位',m.nodename '节点名称',
case when b.isremark = 0 then '未操作' when b. isremark= 2 then '已操作' when b. isremark= 4 then '归档'
when b. isremark= 1 then '转发' when b. isremark= 8 then '抄送' else '其他' end '操作类型',
a.requestid '流程请求ID'
from workflow_requestbase a,
workflow_currentoperator b,
HrmResource c,
HrmDepartment d,
workflow_base e,
workflow_type f,
HrmSubCompany g,
HrmResource h,
HrmDepartment k,
workflow_nodebase m,
hrmjobtitles l
where a.requestid = b.requestid
and c.seclevel >= 80
and b.receivedate >= '2020-01-01'
and b.receivedate <= '2020-04-21' */
and b.userid = c.id
and e.id = a.workflowid
and f.id = e.workflowtype
and d.id = c.departmentid
and g.id = h.subcompanyid1
and a.creater = h.id
and h.departmentid = k.id
and c.jobtitle = l.id
and m.id=b.nodeid
and c.loginid in('ly')
order by c.lastname,b.receivedate
如何更改一个历史已发生的流程单行文本框--浮点数字段的精度
--查询某条流程对应数据库表名:\
select b.tablename from workflow_bill b ,workflow_base s,workflow_requestbase t where t.requestid='12' and t.workflowid = s.id and b.id=s.formid
go
--查询数据库表浮点数对应的字段\
select fds,* from formtable_main_30
go
--查询工作流单据字段表\
select * from workflow_billfield where billid = -30
go
--修改浮点数对应工作流单据表的字段类型\
update workflow_billfield set fielddbtype = 'decimal(15,2)' where id = 6804\
go
--修改浮点数历史数据\
alter table formtable_main_30 alter column fds decimal(15,2)\
go
--建议先备份,将fds中的字段备份到 fds_bak 这个字段里\
alter table formtable_main_30 add fds_bak decimal(15,4)\
go\
update formtable_main_30 set fds_bak = fds\
go