--Sql Server
update ECOLOGY_MESSAGE_INFO
set bizstate = 1
where messageid in (select a.id
from (select b.messageid as id
from workflow_currentoperator a,
ECOLOGY_MESSAGE_INFO b
where a.userid = b.userid
and a.islasttimes = 1
and b.MODULEID = 2
and a.isremark in(2,4)
and b.bizstate != 1
and a.requestid = b.targetid
and b.messagetype in(20,21,23,22)) a)
GO
update ECOLOGY_MESSAGE_INFO_READ
set bizstate = 1
where messageid in (select a.id
from (select b.messageid as id
from workflow_currentoperator a,
ECOLOGY_MESSAGE_INFO_READ b
where a.userid = b.userid
and a.islasttimes = 1
and b.MODULEID = 2
and a.isremark in(2,4)
and b.bizstate != 1
and a.requestid = b.targetid
and b.messagetype in(20,21,23,22)) a)
GO
--根据流程操作者处理状态,更新消息的状态,请在非高峰期执行,要注意执行结果,语句是否都执行成功,各自更新了多少条数据等等