Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
b441dd09
Commit
b441dd09
authored
Jan 11, 2022
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新业务库视图脚本
parent
f86d2e4e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
141 additions
and
22 deletions
+141
-22
view_all.sql
...stem-equip/src/main/resources/changelog/init/view_all.sql
+141
-22
No files found.
amos-boot-system-equip/src/main/resources/changelog/init/view_all.sql
View file @
b441dd09
...
...
@@ -632,23 +632,18 @@ ORDER BY
-- ----------------------------
DROP
VIEW
IF
EXISTS
`v_equip_alarm_today_statistics`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_equip_alarm_today_statistics`
AS
SELECT
count
(
`confirm_type`
)
AS
`confirmed`
,
(
count
(
1
)
-
count
(
`clean_time`
)
)
AS
`unCleaned`
,
(
count
(
1
)
-
count
(
`confirm_type`
)
)
AS
`pending`
FROM
`wl_equipment_specific_alarm_log`
WHERE
(
cast
(
now
()
AS
date
)
=
cast
(
`create_date`
AS
date
)
);
`wl_equipment_specific_alarm_log`
;
-- ----------------------------
-- View structure for v_equip_fire_control_water
...
...
@@ -674,10 +669,8 @@ SELECT
`sal`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sal`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sal`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
sal
.
equipment_specific_name
,
sal
.
equipment_specific_index_name
)
AS
alamReason
,
IF
(
`sal`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sal`
.
`iot_code`
AS
`iotCode`
,
date_format
(
`sal`
.
`create_date`
,
...
...
@@ -5794,27 +5787,153 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_equip
-- 火灾报警系统4小告警列表前60
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_alarm`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_alarm`
AS
select
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
`sa`
.
`equipment_specific_name`
,
`sa`
.
`equipment_specific_index_name`
)
AS
`alamReason`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
from
(
`wl_equipment_specific_alarm_log`
`sa`
left
join
`wl_equipment_specific`
`ec`
on
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
where
find_in_set
(
'029026401813010000000016'
,
`sa`
.
`system_codes`
)
order
by
`sa`
.
`create_date`
desc
limit
60
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_alarm`
AS
SELECT
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
IF
(
`sa`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
FROM
(
`wl_equipment_specific_alarm_log`
`sa`
LEFT
JOIN
`wl_equipment_specific`
`ec`
ON
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
WHERE
find_in_set
(
'029026401813010000000016'
,
`sa`
.
`system_codes`
)
ORDER
BY
`sa`
.
`create_date`
DESC
LIMIT
60
;
-- CAFS系统4小告警列表前60
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_cafs`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_cafs`
AS
select
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
`sa`
.
`equipment_specific_name`
,
`sa`
.
`equipment_specific_index_name`
)
AS
`alamReason`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
from
(
`wl_equipment_specific_alarm_log`
`sa`
left
join
`wl_equipment_specific`
`ec`
on
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
where
find_in_set
(
'029026401813010000000023'
,
`sa`
.
`system_codes`
)
order
by
`sa`
.
`create_date`
desc
limit
60
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_cafs`
AS
SELECT
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
IF
(
`sa`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
FROM
(
`wl_equipment_specific_alarm_log`
`sa`
LEFT
JOIN
`wl_equipment_specific`
`ec`
ON
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
WHERE
find_in_set
(
'029026401813010000000023'
,
`sa`
.
`system_codes`
)
ORDER
BY
`sa`
.
`create_date`
DESC
LIMIT
60
;
-- 预混泡沫灭火系统4小告警列表前60
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_foam`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_foam`
AS
select
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
`sa`
.
`equipment_specific_name`
,
`sa`
.
`equipment_specific_index_name`
)
AS
`alamReason`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
from
(
`wl_equipment_specific_alarm_log`
`sa`
left
join
`wl_equipment_specific`
`ec`
on
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
where
find_in_set
(
'029026401813010000000054'
,
`sa`
.
`system_codes`
)
order
by
`sa`
.
`create_date`
desc
limit
60
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_foam`
AS
SELECT
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
IF
(
`sa`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
FROM
(
`wl_equipment_specific_alarm_log`
`sa`
LEFT
JOIN
`wl_equipment_specific`
`ec`
ON
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
WHERE
find_in_set
(
'029026401813010000000054'
,
`sa`
.
`system_codes`
)
ORDER
BY
`sa`
.
`create_date`
DESC
LIMIT
60
;
-- 细水雾涡扇炮系统4小告警列表前60
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_foam_mist`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_foam_mist`
AS
select
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
`sa`
.
`equipment_specific_name`
,
`sa`
.
`equipment_specific_index_name`
)
AS
`alamReason`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
from
(
`wl_equipment_specific_alarm_log`
`sa`
left
join
`wl_equipment_specific`
`ec`
on
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
where
find_in_set
(
'011023306003010000000082'
,
`sa`
.
`system_codes`
)
order
by
`sa`
.
`create_date`
desc
limit
60
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_foam_mist`
AS
SELECT
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
IF
(
`sa`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
FROM
(
`wl_equipment_specific_alarm_log`
`sa`
LEFT
JOIN
`wl_equipment_specific`
`ec`
ON
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
WHERE
find_in_set
(
'011023306003010000000082'
,
`sa`
.
`system_codes`
)
ORDER
BY
`sa`
.
`create_date`
DESC
LIMIT
60
;
-- 排油系统4小告警列表前60
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_ONL`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_onl`
AS
select
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
`sa`
.
`equipment_specific_name`
,
`sa`
.
`equipment_specific_index_name`
)
AS
`alamReason`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
from
(
`wl_equipment_specific_alarm_log`
`sa`
left
join
`wl_equipment_specific`
`ec`
on
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
where
find_in_set
(
'029026401813010000000030'
,
`sa`
.
`system_codes`
)
order
by
`sa`
.
`create_date`
desc
limit
60
;
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_onl`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_onl`
AS
SELECT
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
IF
(
`sa`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
FROM
(
`wl_equipment_specific_alarm_log`
`sa`
LEFT
JOIN
`wl_equipment_specific`
`ec`
ON
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
WHERE
find_in_set
(
'029026401813010000000030'
,
`sa`
.
`system_codes`
)
ORDER
BY
`sa`
.
`create_date`
DESC
LIMIT
60
;
-- 消防给水系统4小告警列表前60
DROP
VIEW
IF
EXISTS
`v_fire_equip_alarm_60list_water`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_water`
AS
select
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
concat
(
`sa`
.
`equipment_specific_name`
,
`sa`
.
`equipment_specific_index_name`
)
AS
`alamReason`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
from
(
`wl_equipment_specific_alarm_log`
`sa`
left
join
`wl_equipment_specific`
`ec`
on
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
where
find_in_set
(
'029026401813010000000047'
,
`sa`
.
`system_codes`
)
order
by
`sa`
.
`create_date`
desc
limit
60
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_fire_equip_alarm_60list_water`
AS
SELECT
`sa`
.
`id`
AS
`id`
,
`ec`
.
`code`
AS
`mRid`
,
`sa`
.
`equipment_specific_name`
AS
`specificName`
,
`sa`
.
`equipment_specific_index_key`
AS
`indexKey`
,
`sa`
.
`equipment_specific_index_name`
AS
`indexName`
,
`sa`
.
`equipment_specific_id`
AS
`specificId`
,
IF
(
`sa`
.
`clean_time`
IS
NOT
NULL
,
'已消除'
,
'未消除'
)
`cleanStatus`
,
`sa`
.
`iot_code`
AS
`iotCode`
,
`sa`
.
`create_date`
AS
`createDate`
FROM
(
`wl_equipment_specific_alarm_log`
`sa`
LEFT
JOIN
`wl_equipment_specific`
`ec`
ON
((
`sa`
.
`equipment_specific_id`
=
`ec`
.
`id`
)))
WHERE
find_in_set
(
'029026401813010000000047'
,
`sa`
.
`system_codes`
)
ORDER
BY
`sa`
.
`create_date`
DESC
LIMIT
60
;
-- 消防人员视图
DROP
VIEW
IF
EXISTS
`v_fire_fighter`
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment