Commit 4bd692c6 authored by KeYong's avatar KeYong

修改消防资源四大值班与巡查视图

parent 801aca76
......@@ -6026,4 +6026,30 @@ SELECT
FROM
`v_fire_fighter` `fighter`
GROUP BY
`fighter`.`department_name`;
\ No newline at end of file
`fighter`.`department_name`;
-- 今日值班与巡查人员
DROP VIEW IF EXISTS `v_duty_check_person`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_duty_check_person` AS
SELECT
ddd.`duty_name` AS `personName`,
au.`MOBILE` AS `userPhone`,
'值班员' AS `postName`
FROM
`d_duty_details` ddd
LEFT JOIN b_privilege_agency_user au ON au.USER_ID = ddd.user_id
WHERE
ddd.`duty_date` = curdate()
GROUP BY
ddd.`user_id` UNION ALL
SELECT
au.`REAL_NAME` AS `personName`,
au.`MOBILE` AS `userPhone`,
'巡查员' AS `postName`
FROM
`p_plan_task` ppt
LEFT JOIN b_privilege_agency_user au ON FIND_IN_SET(au.USER_ID, ppt.user_id) > 0
WHERE
DATEDIFF(begin_time,CURRENT_DATE) <= 0 AND DATEDIFF(end_time,CURRENT_DATE) >= 0
GROUP BY
au.USER_ID;
\ No newline at end of file
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