


CREATE TABLE cas_config (
                            id SERIAL,
                            group_name varchar(255) DEFAULT NULL,
                            source_key varchar(255) DEFAULT NULL,
                            source_value text,
                            PRIMARY KEY (id)
)  ;

CREATE TABLE cas_service_detail (
                                    id SERIAL,
                                    group_id int DEFAULT NULL,
                                    logo text,
                                    product_code varchar(255) DEFAULT NULL,
                                    sequence int DEFAULT NULL,
                                    service_code varchar(255) DEFAULT NULL,
                                    service_name varchar(255) DEFAULT NULL,
                                    url varchar(255) DEFAULT NULL,
                                    visible boolean NOT NULL,
                                    endpoints varchar(255) DEFAULT NULL,
                                    service_version varchar(255) DEFAULT NULL,
                                    submenu_logo text,
                                    PRIMARY KEY (id),
                                    CONSTRAINT idx_uq_servce_code UNIQUE (service_code),
                                    CONSTRAINT idx_uq_servce_name UNIQUE (service_name),
                                    CONSTRAINT idx_uq_product_code UNIQUE  (product_code)
)  ;

 

CREATE TABLE cas_service_group (
                                   id SERIAL,
                                   group_name varchar(255) DEFAULT NULL,
                                   logo text,
                                   visible boolean NOT NULL,
                                   PRIMARY KEY (id),
                                   CONSTRAINT idx_uq_group_name UNIQUE  (group_name)
)  ;


CREATE TABLE resource (
                          id BIGSERIAL ,
                          gmt_create timestamp(0) NOT NULL ,
                          gmt_modify timestamp(0) NOT NULL ,
                          resource_type varchar(64)  NOT NULL ,
                          resource_id varchar(64)  NOT NULL ,
                          resource_name varchar(64)  NOT NULL ,
                          description varchar(256)  DEFAULT NULL ,
                          parent_resource_id varchar(64) DEFAULT NULL ,
                          app_code varchar(64)  NOT NULL ,
                          ext_attrs varchar(4096)  DEFAULT NULL,
                          PRIMARY KEY (id),
                          CONSTRAINT IDX_APP_RESOUCE_TYPE_ID UNIQUE  (app_code,resource_type,resource_id)
)  ;



CREATE TABLE role (
                      id BIGSERIAL,
                      gmt_create timestamp(0) NOT NULL ,
                      gmt_modify timestamp(0) NOT NULL ,
                      name varchar(64)  DEFAULT NULL ,
                      description varchar(64)  DEFAULT NULL ,
                      app_code varchar(128) DEFAULT NULL ,
                      ext_attrs varchar(4096)  DEFAULT NULL ,
                      PRIMARY KEY (id)
)  ;



CREATE TABLE role_resource (
                               id BIGSERIAL ,
                               gmt_create timestamp(0) NOT NULL ,
                               gmt_modify timestamp(0) NOT NULL ,
                               role_id bigint NOT NULL ,
                               resource_type varchar(64)  NOT NULL ,
                               resource_id varchar(64) NOT NULL ,
                               resource_name varchar(64) NOT NULL ,
                               operation varchar(64)  DEFAULT NULL ,
                               app_code varchar(64) NOT NULL ,
                               ext_attrs varchar(4096) DEFAULT NULL ,
                               PRIMARY KEY (id)
)  ;



CREATE TABLE user_resource (
                               id BIGSERIAL ,
                               gmt_create timestamp(0) NOT NULL ,
                               gmt_modify timestamp(0) NOT NULL ,
                               user_id bigint NOT NULL ,
                               resource_type varchar(64)  NOT NULL ,
                               resource_id varchar(64) NOT NULL ,
                               resource_name varchar(64) NOT NULL ,
                               operation varchar(64)  DEFAULT NULL ,
                               app_code varchar(64) NOT NULL ,
                               ext_attrs varchar(4096) DEFAULT NULL ,
                               PRIMARY KEY (id),
                               CONSTRAINT IDX_USER_RESOURCE UNIQUE  (app_code,user_id,resource_type,resource_id,operation)
)  ;



CREATE TABLE user_role (
                           id BIGSERIAL ,
                           gmt_create timestamp(0) NOT NULL ,
                           gmt_modify timestamp(0) NOT NULL ,
                           user_id bigint NOT NULL ,
                           role_id bigint NOT NULL ,
                           app_code varchar(64)  NOT NULL ,
                           ext_attrs varchar(4096)  DEFAULT NULL ,
                           PRIMARY KEY (id),
                           CONSTRAINT IDX_APP_USER_ROLE UNIQUE  (app_code,user_id,role_id)
)   ;


INSERT INTO cas_config VALUES (1540,'login_config','name','上海慧程'),(1541,'login_config','owe','慧程官网'),(1542,'login_config','community','needle社区'),(1543,'login_config','copyright','© Copyright 2016 - 2020 Shanghai H VISIONS Technology Co., Ltd.'),(1544,'login_config','index_bigLogo','data:image/png;base64,[BLOB]'),(1545,'login_config','index_bgPic','data:image/png;base64,[BLOB]'),(1546,'login_config','index_pic','data:image/png;base64,[BLOB]
[BLOB]'),(1547,'login_config','index_logo','data:image/png;base64,[BLOB]'),(1548,'login_config','content','公司介绍'),(1549,'login_config','show','true'),(1550,'theme_config','@primary-color','#24A1C8'),(1551,'theme_config','@ne-primary-bg-color','rgba(36,161,200,0.15)'),(1552,'theme_config','@ne-layout-secondary-menu-bg-color','rgba(36,161,200,0.15)'),(1553,'theme_config','@link-color','#24A1C8'),(1554,'theme_config','@input-hover-border-color','#24A1C8'),(1555,'theme_config','@ne-layout-menu-logo-color','#009bbf'),(1556,'theme_config','@ne-layout-header-background','#def1f7'),(1557,'locale_config','locale_switch','true');



INSERT INTO cas_service_detail VALUES (1,1,'data:image/svg+xml;base64,[BLOB]','H02B201',10,'hiper-matrix','边缘节点系统','http://10.60.16.29:9030/', 1, NULL,'1.0.0','data:image/png;base64,[BLOB]'),(36,21,'data:image/png;base64,[BLOB]','CAS',0,'CAS','统一登录','http://10.60.16.29:8060/console', 1,NULL,'2.1.0','data:image/png;base64,[BLOB]');



INSERT INTO cas_service_group VALUES (1,'HiperMARIX物联网平台','data:image/png;base64,[BLOB]', 1),(21,'HIperM3基础服务','data:image/svg+xml;base64,[BLOB]',1);