Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-opsdoc
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit aa1d0bc2
authored
May 16, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
数据迁移sql
1 parent
4a972830
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
8 deletions
1.7.0_五月/1.7.0数据库SQL脚本.sql
1.7.0_五月/二押警情迁移.sql
1.7.0_五月/超速报警迁移.sql
1.7.0_五月/1.7.0数据库SQL脚本.sql
View file @
aa1d0bc
...
@@ -146,11 +146,3 @@ create table t_role_biz_data_permission
...
@@ -146,11 +146,3 @@ create table t_role_biz_data_permission
alter
table
t_vehicle
add
column
settle_flag
tinyint
(
2
)
default
0
comment
'车辆结清标识'
after
validate_info
;
alter
table
t_vehicle
add
column
settle_flag
tinyint
(
2
)
default
0
comment
'车辆结清标识'
after
validate_info
;
-- 超速报警老数据迁移更新vd_id和创建人
update
t_device_speeding
tds
INNER
JOIN
t_vehicle_device
tvd
on
tvd
.
sn
=
tds
.
sn
LEFT
JOIN
t_vehicle
tv
on
tv
.
id
=
tvd
.
vehicle_id
SET
tds
.
vd_id
=
tvd
.
id
,
tds
.
created_by
=
tv
.
created_by
where
tvd
.
del_flag
=
0
and
tvd
.
bind_status
=
1
\ No newline at end of file
\ No newline at end of file
1.7.0_五月/二押警情迁移.sql
0 → 100644
View file @
aa1d0bc
-- 二押警情
create
table
d_alarm_second_data_copy
(
id
int
auto_increment
comment
'id'
primary
key
,
sn
varchar
(
32
)
null
comment
'设备号'
,
type
varchar
(
32
)
null
comment
'二押区域规则类型(二押地停留)'
,
name
varchar
(
32
)
null
comment
'二押区域规则名称(二押地停留)'
,
alarm_time
datetime
null
comment
'二押区域报警时间'
,
alarm_address
varchar
(
128
)
null
comment
'二押区域报警位置'
,
leave_time
datetime
null
comment
'离开二押区域时间(当前还未动身的数据不记录到数据库)'
,
stay_time
int
(
8
)
null
comment
'二押区域停留时长'
,
lng
varchar
(
20
)
null
comment
'二押区域停留经度'
,
lat
varchar
(
20
)
null
comment
'二押区域停留纬度'
,
event_time
datetime
null
comment
'事件时间,写入事件'
,
del_flag
tinyint
(
2
)
null
comment
'删除标识 1 是最新插入 2 历史数据'
,
unique_flag
varchar
(
64
)
null
comment
'唯一标识 设备号加上报警时间'
,
create_time
datetime
null
comment
'创建时间'
,
update_time
datetime
null
comment
'更新时间'
,
key
idx_get_flag
(
del_flag
,
unique_flag
)
comment
'唯一标识查询索引'
,
key
idx_sn
(
sn
,
del_flag
)
comment
'设备号索引'
)
comment
'二押kafka数据表'
charset
=
utf8mb4
;
INSERT
INTO
d_alarm_second_data_copy
(
id
,
sn
,
type
,
name
,
alarm_time
,
alarm_address
,
leave_time
,
stay_time
,
lng
,
lat
,
event_time
,
del_flag
,
unique_flag
,
create_time
,
update_time
)
select
id
,
sn
,
type
,
name
,
alarm_time
,
alarm_address
,
leave_time
,
stay_time
,
lng
,
lat
,
event_time
,
del_flag
,
unique_flag
,
create_time
,
update_time
from
d_alarm_second_data
dasd
inner
join
t_nes_device
tnd
on
dasd
.
sn
=
tnd
.
sn
;
-- 老数据迁移写入
use
neshield
;
INSERT
INTO
t_alarm_second_data
(
sn
,
type
,
name
,
alarm_time
,
alarm_address
,
leave_time
,
stay_time
,
lng
,
lat
,
event_time
,
del_flag
,
unique_flag
,
created_date
,
updated_date
)
select
sn
,
type
,
name
,
alarm_time
,
alarm_address
,
leave_time
,
stay_time
,
lng
,
lat
,
event_time
,
del_flag
,
unique_flag
,
CURRENT_TIMESTAMP
,
CURRENT_TIMESTAMP
from
d_alarm_second_data_copy
dasdc
where
dasdc
.
del_flag
=
1
;
use
neshield
;
INSERT
INTO
t_alarm_second_data
(
sn
,
type
,
name
,
alarm_time
,
alarm_address
,
leave_time
,
stay_time
,
lng
,
lat
,
event_time
,
del_flag
,
unique_flag
,
created_date
,
updated_date
,
del_flag
)
select
sn
,
type
,
name
,
alarm_time
,
alarm_address
,
leave_time
,
stay_time
,
lng
,
lat
,
event_time
,
del_flag
,
unique_flag
,
CURRENT_TIMESTAMP
,
CURRENT_TIMESTAMP
,
-
1
from
d_alarm_second_data_copy
dasdc
where
dasdc
.
del_flag
=
2
;
-- 老数据迁移更新vd_id和创建人
update
t_alarm_second_data
tasd
INNER
JOIN
t_vehicle_device
tvd
on
tvd
.
sn
=
tasd
.
sn
LEFT
JOIN
t_vehicle
tv
on
tv
.
id
=
tvd
.
vehicle_id
SET
tasd
.
vd_id
=
tvd
.
id
,
tasd
.
created_by
=
tv
.
created_by
where
tvd
.
del_flag
=
0
and
tvd
.
bind_status
=
1
;
use
newgps
;
create
table
d_alarm_second_data_near_rel_copy
(
id
int
auto_increment
comment
'id'
primary
key
,
second_data_id
int
null
comment
'二押kafka数据表 `d_alarm_second_data`的id'
,
near_second_id
int
null
comment
'300米二手车行id'
)
comment
'二押kafka和二手车关系表'
charset
=
utf8mb4
;
INSERT
INTO
d_alarm_second_data_near_rel_copy
(
id
,
second_data_id
,
near_second_id
)
select
id
,
second_data_id
,
near_second_id
from
d_alarm_second_data_near_rel
dasdnr
inner
join
d_alarm_second_data
dasd
on
dasdnr
.
second_data_id
=
dasd
.
id
;
-- 老数据迁移写入
use
neshield
;
INSERT
INTO
t_alarm_second_data_near_rel
(
second_data_id
,
near_second_id
,
created_date
,
updated_date
)
select
second_data_id
,
near_second_id
,
CURRENT_TIMESTAMP
,
CURRENT_TIMESTAMP
from
d_alarm_second_data_near_rel_copy
dasdnrc
;
-- 超速报警老数据迁移更新vd_id和创建人
update
t_alarm_second_data_near_rel
tasdnr
INNER
JOIN
t_alarm_second_data
tasd
on
tasd
.
id
=
tasdnr
.
second_data_id
SET
tasdnr
.
created_by
=
tasdnr
.
created_by
where
tasdnr
.
del_flag
=
0
;
\ No newline at end of file
\ No newline at end of file
1.7.0_五月/超速报警迁移.sql
0 → 100644
View file @
aa1d0bc
use
newgps
;
create
table
eshield_device_overspeed_copy
(
id
int
auto_increment
primary
key
,
sn
varchar
(
64
)
null
comment
'设备号'
,
beginTime
datetime
null
comment
'超速开始时间'
,
endTime
datetime
null
comment
'超速结束时间'
,
duration
int
null
comment
'超速时长,以秒为单位'
,
averageSpeed
double
null
comment
'超速平均速度,单位km/h'
,
updateTime
datetime
null
comment
'记录最后更新时间'
,
KEY
`sn`
(
`sn`
)
)
comment
'设备昨天超速记录表'
;
INSERT
INTO
eshield_device_overspeed_copy
(
id
,
sn
,
beginTime
,
endTime
,
duration
,
averageSpeed
,
updateTime
)
select
id
,
sn
,
beginTime
,
endTime
,
duration
,
averageSpeed
,
updateTime
from
eshield_device_overspeed
edo
inner
join
t_nes_device
tnd
on
edo
.
sn
=
tnd
.
sn
;
-- 超速报警老数据迁移写入
use
neshield
;
INSERT
INTO
t_device_speeding
(
sn
,
begin_time
,
end_time
,
duration
,
created_date
,
updated_date
)
select
sn
,
beginTime
,
endTime
,
duration
,
CURRENT_TIMESTAMP
,
CURRENT_TIMESTAMP
from
eshield_device_overspeed_copy
;
-- 超速报警老数据迁移更新vd_id和创建人
update
t_device_speeding
tds
INNER
JOIN
t_vehicle_device
tvd
on
tvd
.
sn
=
tds
.
sn
LEFT
JOIN
t_vehicle
tv
on
tv
.
id
=
tvd
.
vehicle_id
SET
tds
.
vd_id
=
tvd
.
id
,
tds
.
created_by
=
tv
.
created_by
where
tvd
.
del_flag
=
0
and
tvd
.
bind_status
=
1
;
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment