This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nms-nmsweb/sql/sqlupdate(20130618-20130621).sql

53 lines
2.0 KiB
MySQL
Raw Normal View History

2018-09-27 16:21:05 +08:00
-- 任务结果4 触发器更新
CREATE OR REPLACE TRIGGER BEFORE_UPDATE_MISSION_RESULT_4
BEFORE UPDATE ON "MISSION_RESULT_TABLE4"
REFERENCING OLD AS o NEW AS n FOR EACH ROW
DECLARE
--
--length_rda number := lengthb(nvl(:o.result_desc,'')||nvl(:n.result_desc,''));
BEGIN
-- 思路整理:
-- result_4 存在两种业务
-- 1、有效任务执行流程
-- 程序中将任务结果状态初始化为3 中间结果为40、50、60、70、80、81
-- 最终结果为0成功或1失败 结果不再变更
-- 2、撤销任务执行流程
-- 程序将任意结果变更为5 中间结果为6已下发
-- 最终结果为7撤销完成 结果不再变更
-- 整理 根据旧信息状态区别两种业务 对5、6、7 结果指定处理;其他结果为另一业务
-- 5可覆盖除了7以外的任意结果
-- 结果变更实现
if updating('result') THEN
-- 业务撤销任务执行流程 7为最终结果
if (:n.result in (5,6,7)) then
if (:o.result = 7) then
:n.result := :o.result;
end if;
else
-- 业务有效任务执行流程 撤销任务的状态不可更改
if (:o.result in (5,6,7)) then
:n.result := :o.result;
else
-- 01
if (:n.result <> -1 and ((:o.result = 0) or (:o.result = 1) or (:n.result is null))) then
:n.result := :o.result;
end if;
end if;
end if;
end if;
--
if updating('result_desc') then
:n.result_desc := nvl(:o.result_desc,'')||nvl(:n.result_desc,'');
end if;
--
if updating('file_info') THEN
if (:o.file_info is not NULL AND :n.file_info IS NOT NULL) then
:n.file_info := nvl(:o.file_info,'')||'@@@'||nvl(:n.file_info,'');
end if;
end if;
END;