alter table b_resource
    add location_type varchar(10);

comment
on column b_resource.location_type is '位置类型（水上和陆上）';

INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark)
VALUES (22, '资源位置类型', 'zhdd_location_type', '0', 'admin', '2021-09-28 15:55:09', 'admin', '2021-09-28 15:55:09', null);

INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (144, 0, '水上', '1', 'zhdd_location_type', null,
        'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);
INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (145, 0, '陆上', '2', 'zhdd_location_type', null,
        'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);

alter table b_incident
    add conclusion varchar(1000);

comment
on column b_incident.conclusion is '归档总结';

alter table b_incident
    add conclusion_file varchar(3000);

comment
on column b_incident.conclusion_file is '归档附件';

-- 2021-12-15
ALTER TABLE "public"."sys_dept"
    ADD COLUMN "other_id" varchar(64);

COMMENT
ON COLUMN "public"."sys_dept"."other_id" IS '其他系统编号';

ALTER TABLE "public"."sys_user"
    ADD COLUMN "other_id" varchar(64);

COMMENT
ON COLUMN "public"."sys_user"."other_id" IS '其他系统编号';


-- 2021-12-23 update
alter table sys_user alter column user_id type varchar(36) using user_id::varchar(36);
alter table sys_user
    alter column user_id drop default;
drop sequence sys_user_user_id_seq;
alter table sys_user alter column dept_id type varchar(36) using dept_id::varchar(36);
alter table sys_dept alter column dept_id type varchar(36) using dept_id::varchar(36);
alter table sys_dept
    alter column dept_id drop default;
drop sequence sys_dept_dept_id_seq;
alter table sys_dept alter column parent_id type varchar(36) using parent_id::varchar(36);
alter table sys_user_role alter column user_id type varchar(36) using user_id::varchar(36);
alter table sys_user_role alter column role_id type varchar(36) using role_id::varchar(36);
alter table sys_role alter column role_id type varchar(36) using role_id::varchar(36);
alter table sys_role
    alter column role_id drop default;
alter table sys_menu alter column menu_id type varchar(36) using menu_id::varchar(36);
alter table sys_menu
    alter column menu_id drop default;
alter table sys_user
    add org_id varchar(32);
comment
on column sys_user.org_id is '组织机构id';
alter table sys_user
    add superior varchar(50);

comment
on column sys_user.superior is '直属上级';

alter table sys_dept
    add code varchar(50);

comment
on column sys_dept.code is '代码';

alter table sys_dept
    add description varchar;

comment
on column sys_dept.description is '描述';

alter table sys_dept
    add "dept_short_name" varchar(100);

comment
on column sys_dept."dept_short_name" is '部门简称';

alter table sys_dept
    add "org_id" varchar(32);

comment
on column sys_dept."org_id" is '组织id';

alter table sys_user
    add id_number varchar(30);

comment
on column sys_user.id_number is '身份证';

alter table sys_user alter column phonenumber type varchar(20) using phonenumber::varchar(20);

-- 2022-1-5新增
INSERT INTO public.sys_dict_type (dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time)
VALUES (23, '语音指令', 'zhdd_voice', '0', 'admin', '2021-09-28 15:55:09', 'admin', '2021-09-28 15:55:09');

INSERT INTO public.sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (146, 0, '应急专家', '4', 'zhdd_resource', null, 'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);
INSERT INTO public.sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (147, 0, '地图放大', 'mapZoomIn', 'zhdd_voice', null, 'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);
INSERT INTO public.sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (148, 0, '地图缩写', 'mapZoomOut', 'zhdd_voice', null, 'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);
INSERT INTO public.sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (149, 0, '打开单兵设备图层', 'singleDeviceLayer', 'zhdd_voice', null, 'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);
INSERT INTO public.sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (150, 0, '打开视频设备图层', 'videoDeviceLayer', 'zhdd_voice', null, 'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);
INSERT INTO public.sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
VALUES (151, 0, '打开应急事件图层', 'incidentLayer', 'zhdd_voice', null, 'default', 'N', '0', 'admin', '2021-09-28 15:57:23', 'admin', '2021-09-28 15:57:23', null);

alter table b_incident_process
    alter column status set default 0;

-- 以上已同步
-- 2022-1-13
alter table b_incident_task
    add expr_json text;

create table b_chemical_data
(
    id          varchar(36),
    name        varchar(36),
    content     text,
    create_time timestamp(0),
    create_by   varchar(64),
    update_by   varchar(64),
    update_time timestamp(0),
    del_flag    char default '0'
);
comment
on table b_chemical_data is '危化品信息';
comment
on column b_chemical_data.id is 'id';
comment
on column b_chemical_data.name is '中文名称';
comment
on column b_chemical_data.content is '内容';

alter table b_incident_process
    add incident_status smallint;

comment
on column b_incident_process.incident_status is '时间处置过程当前状态';

INSERT INTO public.sys_config (config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark)
VALUES (12, '大华组织id', 'dh.device.orgId', 'S4NbecfYB1DFLAIM9FFHQ8', 'N', 'admin', '2021-09-16 03:32:56', '', null, '用于获取设备树');

alter table b_resource_detail alter column num type numeric(8,3) using num::numeric(8,3);

alter table b_resource_detail
    add available_num numeric(8, 3);

comment
on column b_resource_detail.available_num is '可用数量';

alter table b_resource
    add dept_id varchar(36);

comment
on column b_resource.dept_id is '部门id';


alter table sys_dept
    add flag int;

comment
on column sys_dept.flag is '0机构；1部门';

alter table sys_dept drop column other_id;

alter table sys_dept drop column code;

alter table sys_dept drop column description;

alter table sys_dept drop column dept_short_name;

alter table sys_dept drop column org_id;

alter table sys_role_menu alter column role_id type varchar(36) using role_id::varchar(36);

alter table sys_role_menu alter column menu_id type varchar(36) using menu_id::varchar(36);

alter table b_incident_task
    add "send_flag" varchar(10);

comment
on column b_incident_task."send_flag" is '消息发送类型';

update b_incident_task
set send_flag = 1
where 1 = 1;

-- 以上已同步









