Commit d192fe3e authored by litengwei's avatar litengwei

巡检BUG

parent 4ef1c69b
......@@ -474,21 +474,22 @@
DROP PROCEDURE IF EXISTS `updatePlanTask`;
</createProcedure>
</changeSet>
<changeSet author="gaodongdong" id="1610421278000-21-230419" runAlways="true">
<changeSet author="gaodongdong" id="1610421278000-21-230915" runAlways="true">
<createProcedure procedureName="updatePlanTask" >
CREATE PROCEDURE `updatePlanTask`(IN `planTaskId` BIGINT,IN `pointId` BIGINT,IN `planTaskDetailId` BIGINT,IN `executorId` BIGINT)
CREATE DEFINER=`root`@`%` PROCEDURE `updatePlanTask`(IN `planTaskId` BIGINT,IN `pointId` BIGINT,IN `planTaskDetailId` BIGINT,IN `executorId` BIGINT)
BEGIN
declare num int ;
declare orgCode VARCHAR(50) ;
declare currentTaskNum int ;
declare pointNum int ;
update p_plan_task_detail set is_finish = 1 where id=planTaskDetailId;
select finish_num, org_code from p_plan_task where id = planTaskId into num, orgCode;
select finish_num, org_code, point_num from p_plan_task where id = planTaskId into num, orgCode, pointNum;
select count(1) into currentTaskNum from p_plan_task_detail where task_no = planTaskId and is_finish in(0,2);
UPDATE p_plan_task_detail SET executor_id = executorId,executor_date = current_timestamp where id = planTaskDetailId;
if currentTaskNum > 0 THEN
update p_plan_task set finish_num = (num + 1) where id = planTaskId;
update p_plan_task set finish_num = (num + 1) where id = planTaskId and pointNum > num;
ELSE
update p_plan_task set finish_num = (num + 1), finish_status = 2 where id = planTaskId;
update p_plan_task set finish_num = (num + 1), finish_status = 2 where id = planTaskId and pointNum > num;
end if;
if executorId > 0 then
call planTaskStatistics(executorId, null, orgCode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment