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 3684e5dd
authored
Apr 28, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
生产环境需要执行的SQL
1 parent
603f7e12
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
161 additions
and
0 deletions
1.6.0_四月/1.6.0数据库SQL脚本release.sql
1.6.0_四月/1.6.0数据库SQL脚本release.sql
0 → 100644
View file @
3684e5d
CREATE
TABLE
`t_alarm_electric_fence`
(
id
INT
(
11
)
NOT
NULL
AUTO_INCREMENT
,
sn
VARCHAR
(
20
)
DEFAULT
NULL
COMMENT
'设备号'
,
svc_system_id
INT
(
11
)
DEFAULT
NULL
COMMENT
'子系统标识'
,
fence_id
INT
(
11
)
DEFAULT
NULL
COMMENT
'电子栅栏ID'
,
fence_type
TINYINT
(
2
)
DEFAULT
NULL
COMMENT
'电子栅栏类型 1驶入,2驶出,3:驶入驶出报警'
,
trigger_type
INT
(
11
)
DEFAULT
NULL
COMMENT
'触发类型 1驶入,2驶出'
,
loc_info_type
INT
(
11
)
DEFAULT
NULL
COMMENT
'位置类型 1gps,2基站'
,
lng
VARCHAR
(
15
)
DEFAULT
NULL
COMMENT
'经度'
,
lat
VARCHAR
(
15
)
DEFAULT
NULL
COMMENT
'纬度'
,
address
VARCHAR
(
100
)
DEFAULT
NULL
COMMENT
'报警地址'
,
speed
VARCHAR
(
10
)
DEFAULT
NULL
COMMENT
'速度'
,
direction
VARCHAR
(
10
)
DEFAULT
NULL
COMMENT
'方向'
,
alarm_time
DATETIME
DEFAULT
NULL
COMMENT
'报警开始时间'
,
end_time
DATETIME
DEFAULT
NULL
COMMENT
'报警结束时间'
,
alt
VARCHAR
(
10
)
DEFAULT
NULL
COMMENT
'海拔'
,
alarm_range
VARCHAR
(
100
)
DEFAULT
NULL
COMMENT
'围栏预警时间段'
,
vd_id
INT
(
11
)
DEFAULT
NULL
COMMENT
'车辆设备关系表id'
,
del_flag
TINYINT
(
2
)
DEFAULT
0
COMMENT
'是否删除 0=正常 -1=删除 报警可见性,非报警时间段不可见;0可见, -1不可见'
,
created_date
DATETIME
DEFAULT
NULL
COMMENT
'创建时间|入库时间'
,
created_by
INT
(
11
)
DEFAULT
NULL
COMMENT
'创建人用户id'
,
updated_date
DATETIME
DEFAULT
NULL
COMMENT
'更新时间'
,
updated_by
INT
(
11
)
DEFAULT
NULL
COMMENT
'更新人用户id'
,
PRIMARY
KEY
(
`id`
),
KEY
`sn_index`
(
`sn`
),
KEY
`fence_id_index`
(
`fence_id`
),
KEY
`vd_id_index`
(
`vd_id`
)
)
ENGINE
=
INNODB
AUTO_INCREMENT
=
1
DEFAULT
CHARSET
=
utf8
COMMENT
=
'新e盾|围栏报警数据表'
;
-- 设备电量表
create
table
t_device_power
(
id
int
(
11
)
auto_increment
comment
'电量主键ID'
primary
key
,
sn
varchar
(
32
)
null
comment
'设备序列号'
,
vd_id
int
(
11
)
default
0
null
comment
'车辆、设备关系id'
,
alarm_time
datetime
null
comment
'电量上传时间'
,
soc
int
(
20
)
null
comment
'设备剩余电量'
,
del_flag
tinyint
default
0
null
comment
'是否删除 0=正常 -1=删除'
,
created_date
datetime
null
comment
'创建时间|入库时间'
,
created_by
int
(
11
)
null
comment
'创建人用户id'
,
updated_date
datetime
null
comment
'更新时间'
,
updated_by
int
(
11
)
null
comment
'更新人用户id'
)
comment
'新e盾|设备电量表'
;
ALTER
TABLE
`t_device_power`
ADD
INDEX
idx_sn
(
`sn`
);
ALTER
TABLE
`t_device_power`
ADD
INDEX
idx_vd_id
(
`vd_id`
);
ALTER
TABLE
`t_device_power`
ADD
INDEX
idx_soc
(
`soc`
);
CREATE
TABLE
`t_zhongli_neshield_vehicle`
(
`id`
INT
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`vehicle_id`
INT
(
11
)
DEFAULT
NULL
COMMENT
'设备绑定ID'
,
`ref_vehicle_id`
INT
(
11
)
DEFAULT
NULL
COMMENT
'旧系统车辆ID'
,
`vin`
VARCHAR
(
32
)
DEFAULT
NULL
COMMENT
'车架号'
,
`partner_order_no`
VARCHAR
(
32
)
DEFAULT
NULL
COMMENT
'第三方工单ID'
,
`shop_name`
VARCHAR
(
256
)
DEFAULT
NULL
COMMENT
'店面名称'
,
`service_provider`
VARCHAR
(
256
)
DEFAULT
NULL
COMMENT
'安装省份'
,
`simple_level`
VARCHAR
(
256
)
DEFAULT
NULL
COMMENT
'简称'
,
`province`
VARCHAR
(
32
)
DEFAULT
NULL
COMMENT
'省份'
,
`account`
VARCHAR
(
32
)
DEFAULT
NULL
COMMENT
'帐号'
,
`remarks`
VARCHAR
(
512
)
DEFAULT
NULL
COMMENT
'备注'
,
`del_flag`
INT
(
2
)
DEFAULT
NULL
COMMENT
'删除状态'
,
`created_date`
DATETIME
DEFAULT
NULL
COMMENT
'创建时间'
,
`created_by`
INT
(
11
)
DEFAULT
NULL
COMMENT
'创建人'
,
`updated_date`
DATETIME
DEFAULT
NULL
COMMENT
'更新时间'
,
`updated_by`
INT
(
11
)
DEFAULT
NULL
COMMENT
'更新人'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
INNODB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'仲利新E盾数据归属'
;
CREATE
TABLE
`t_zhongli_carservice_info`
(
`id`
INT
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`order_no`
VARCHAR
(
64
)
DEFAULT
NULL
,
`service_name`
VARCHAR
(
256
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
INNODB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'仲利新E盾包活干对应服务商信息'
;
-- 设备里程概览信息表
create
table
t_device_journey_overview
(
id
int
(
11
)
auto_increment
comment
'里程主键ID'
primary
key
,
sn
varchar
(
32
)
null
comment
'设备序列号'
,
vd_id
int
(
11
)
default
0
null
comment
'车辆、设备关系id'
,
total_journey_count
int
(
11
)
null
comment
'总行驶次数'
,
distance
int
(
11
)
null
comment
'总里程m'
,
del_flag
tinyint
default
0
null
comment
'是否删除 0=正常 -1=删除'
,
created_date
datetime
null
comment
'创建时间|入库时间'
,
created_by
int
(
11
)
null
comment
'创建人用户id'
,
updated_date
datetime
null
comment
'更新时间'
,
updated_by
int
(
11
)
null
comment
'更新人用户id'
)
comment
'新e盾|里程概览信息表'
;
ALTER
TABLE
`t_device_journey_overview`
ADD
INDEX
idx_sn
(
`sn`
);
ALTER
TABLE
`t_device_journey_overview`
ADD
INDEX
idx_vd_id
(
`vd_id`
);
-- 短信模板
alter
table
t_message_template
change
type
send_type
varchar
(
255
)
null
comment
'消息类型:短信SMS、邮件MAIL、公众号WXMP、小程序WXMA'
;
alter
table
t_message_log
change
type
send_type
varchar
(
255
)
null
comment
'消息类型:短信SMS、邮件MAIL、公众号WXMP、小程序WXMA'
;
alter
table
t_message_template
add
type
int
default
1
null
comment
'消息类型:根据send_type具体来看 短信类型:1:通知短信;2验证码短信'
after
send_type
;
alter
table
t_message_template
add
source
varchar
(
64
)
null
comment
'短信发送通道'
after
send_type
;
INSERT
INTO
t_message_template
(
template
,
subject
,
content
,
send_type
,
source
,
type
,
enable_status
,
del_flag
,
created_date
,
created_by
)
VALUES
(
'SMS_TEMPLATE_ORDER_FINISHED'
,
null
,
'【嘀嘀虎】您好,您的服务订单 {0}(车主:{1}),已完成,上门时间:{2}。广联赛讯'
,
'SMS'
,
'eshield_workOrder_warm'
,
1
,
1
,
0
,
sysdate
(),
1
);
INSERT
INTO
t_message_template
(
template
,
subject
,
content
,
send_type
,
source
,
type
,
enable_status
,
del_flag
,
created_date
,
created_by
)
VALUES
(
'SMS_TEMPLATE_ENTER_FENCE'
,
null
,
'【广联赛讯】尊敬的{0}先生/女士,(车牌{1})车辆于(时间{2})发生出(围栏名称{3})围栏报警,请您留意具体车辆。'
,
'SMS'
,
'neshield_fence_warn'
,
1
,
1
,
0
,
sysdate
(),
1
);
INSERT
INTO
t_message_template
(
template
,
subject
,
content
,
send_type
,
source
,
type
,
enable_status
,
del_flag
,
created_date
,
created_by
)
VALUES
(
'SMS_TEMPLATE_LEAVE_FENCE'
,
null
,
'【广联赛讯】尊敬的{0}先生/女士,(车牌{1})车辆于(时间{2})发生出(围栏名称{3})围栏报警,请您留意具体车辆。'
,
'SMS'
,
'neshield_fence_warn'
,
1
,
1
,
0
,
sysdate
(),
1
);
INSERT
INTO
t_message_template
(
template
,
subject
,
content
,
send_type
,
source
,
type
,
enable_status
,
del_flag
,
created_date
,
created_by
)
VALUES
(
'SMS_TEMPLATE_ENTER_LEAVE_FENCE'
,
null
,
'【广联赛讯】尊敬的{0}先生/女士,(车牌{1})车辆于(时间{2})发生进出(围栏名称{3})围栏报警,请您留意具体车辆。'
,
'SMS'
,
'neshield_fence_warn'
,
1
,
1
,
0
,
sysdate
(),
1
);
INSERT
INTO
t_dict_data
(
dict_sort
,
dict_label
,
dict_value
,
dict_type
,
is_default
,
enable_status
,
remark
,
del_flag
,
created_by
,
created_date
)
VALUES
(
1
,
'batchLinkFenceSns'
,
'https://wx.glsx.com.cn/upload/salesexcel/批量导入关联设备模板.xlsx'
,
'excelTemplate'
,
'N'
,
1
,
'批量导入关联设备excel模板'
,
0
,
1
,
sysdate
());
alter
table
t_electric_fence
modify
fence_name
varchar
(
256
)
null
comment
'栅栏名称'
;
alter
table
t_vehicle
modify
engine
varchar
(
52
)
null
comment
'发动机'
;
alter
table
t_workorder_vehicle
modify
engine_no
varchar
(
52
)
null
comment
'发动机号'
;
update
t_message_template
set
content
=
'【广联赛讯】尊敬的{0}先生/女士,{1}车辆于{2}发生出{3}围栏报警,请您留意具体车辆。'
where
template
=
'SMS_TEMPLATE_ENTER_FENCE'
;
update
t_message_template
set
content
=
'【广联赛讯】尊敬的{0}先生/女士,{1}车辆于{2}发生出{3}围栏报警,请您留意具体车辆。'
where
template
=
'SMS_TEMPLATE_LEAVE_FENCE'
;
update
t_message_template
set
content
=
'【广联赛讯】尊敬的{0}先生/女士,{1}车辆于{2}发生进出{3}围栏报警,请您留意具体车辆。'
where
template
=
'SMS_TEMPLATE_ENTER_LEAVE_FENCE'
;
-- #基础数据创建帐号
ALTER
TABLE
`t_zhongli_department`
ADD
COLUMN
user_account
VARCHAR
(
50
)
DEFAULT
NULL
COMMENT
'用户名'
;
ALTER
TABLE
`t_zhongli_department`
ADD
COLUMN
user_id
INT
(
11
)
DEFAULT
NULL
COMMENT
'用户ID'
;
ALTER
TABLE
`t_zhongli_department`
ADD
COLUMN
department_id
INT
(
11
)
DEFAULT
NULL
COMMENT
'组织ID'
;
alter
table
t_electric_fence_sns
add
vd_id
int
null
comment
'车辆设备绑定关系'
after
sn
;
alter
table
t_electric_fence_sns_copy
add
vd_id
int
null
comment
'车辆设备绑定关系'
after
sn
;
alter
table
t_electric_fence_sns_copy
add
index
idx_sn
(
sn
);
-- 更新围栏设备vdid
update
t_electric_fence_sns_copy
tefs
,
t_vehicle_device
tvd
,
t_vehicle
tv
set
tefs
.
vd_id
=
tvd
.
id
where
tvd
.
sn
=
tefs
.
sn
and
tv
.
id
=
tvd
.
vehicle_id
;
update
t_electric_fence_sns
tefs
,
t_vehicle_device
tvd
,
t_vehicle
tv
set
tefs
.
vd_id
=
tvd
.
id
where
tvd
.
sn
=
tefs
.
sn
and
tv
.
id
=
tvd
.
vehicle_id
;
-- 数据导入操作完成后才能执行
ALTER
TABLE
`t_device_journey`
ADD
INDEX
idx_begin_time
(
`begin_time`
);
-- 数据导入操作完成后才能执行
-- 里程初始化
INSERT
INTO
t_device_journey_overview
(
sn
,
vd_id
,
total_journey_count
,
distance
,
created_by
,
created_date
,
updated_date
)
select
sn
,
vd_id
,
count
(
1
),
sum
(
mileage
),
created_by
,
created_date
,
updated_date
from
t_device_journey
where
vd_id
is
not
null
group
by
sn
,
vd_id
;
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