| | |
| | | ----------------------------------------------------------------------------------------------------- 0.GUID生成函数 |
| | | ----------------------------------------------------------------------------------------------------- a.查询表结构 |
| | | select * from pg_tables; |
| | | |
| | | select c.relname as "表名", cast(obj_description(c.oid) as varchar) as "表名描述", |
| | | a.attnum as "序号", a.attname as "列名", |
| | | concat_ws('', t.typname, SUBSTRING(format_type(a.atttypid, a.atttypmod) from '\(.*\)')) as "字段类型", |
| | | d.description as "备注" |
| | | from pg_attribute a |
| | | left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum |
| | | left join pg_class c on a.attrelid = c.oid |
| | | left join pg_type t on a.atttypid = t.oid |
| | | where a.attnum >= 0 and c.relname like 'sys_%' and obj_description(c.oid) is not null and relnamespace=20582 |
| | | order by c.relname desc, a.attnum asc; |
| | | ----------------------------------------------------------------------------------------------------- b.GUID生成函数 |
| | | CREATE or REPLACE FUNCTION new_guid() |
| | | RETURNS "pg_catalog"."varchar" AS $BODY$ |
| | | DECLARE |
| | |
| | | comment on column lf.sys_meta.resolution is '分辨率'; |
| | | comment on column lf.sys_meta.gather is '采集日期'; |
| | | comment on column lf.sys_meta.descr is '描述'; |
| | | comment on column lf.sys_meta.guid is 'GUID'; |
| | | comment on column lf.sys_meta.guid is '文件ID'; |
| | | comment on column lf.sys_meta.create_user is '创建人ID'; |
| | | comment on column lf.sys_meta.create_time is '创建时间'; |
| | | comment on column lf.sys_meta.update_user is '更新人ID'; |
| | |
| | | comment on column lf.sys_meta_file.id is '主键ID'; |
| | | comment on column lf.sys_meta_file.metaid is '元数据ID'; |
| | | comment on column lf.sys_meta_file.name is '文件名'; |
| | | comment on column lf.sys_meta_file.guid is 'GUID'; |
| | | comment on column lf.sys_meta_file.guid is '文件ID'; |
| | | comment on column lf.sys_meta_file.path is '存储路径'; |
| | | comment on column lf.sys_meta_file.fileid is '父文件ID,0-没有'; |
| | | comment on column lf.sys_meta_file.create_user is '创建人ID'; |
| | |
| | | comment on column lf.sys_attach.id is '主键ID'; |
| | | comment on column lf.sys_attach.name is '文件名'; |
| | | comment on column lf.sys_attach.tab is '表名,如:public.data_dir'; |
| | | comment on column lf.sys_attach.guid is 'GUID'; |
| | | comment on column lf.sys_attach.guid is '文件ID'; |
| | | comment on column lf.sys_attach.path is '存储路径'; |
| | | comment on column lf.sys_attach.create_user is '创建人ID'; |
| | | comment on column lf.sys_attach.create_time is '创建时间'; |
| | |
| | | comment on column lf.sys_dict.update_time is '更新时间'; |
| | | comment on column lf.sys_dict.bak is '备注'; |
| | | |
| | | /* update lf.sys_dict set create_user=1,create_time=now() where 1=1; |
| | | update lf.sys_dict set bak=null where bak=' '; |
| | | |
| | | select * from pg_tables; |
| | | select c.relname as "表名", cast(obj_description(c.oid) as varchar) as "表名描述", |
| | | a.attnum as "序号", a.attname as "列名", |
| | | concat_ws('', t.typname, SUBSTRING(format_type(a.atttypid, a.atttypmod) from '\(.*\)')) as "字段类型", |
| | | d.description as "备注" |
| | | from pg_attribute a |
| | | left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum |
| | | left join pg_class c on a.attrelid = c.oid |
| | | left join pg_type t on a.atttypid = t.oid |
| | | where a.attnum >= 0 and c.relname like 'sys_%' and obj_description(c.oid) is not null and relnamespace=20582 |
| | | order by c.relname desc, a.attnum asc; */ |
| | | /* alter sequence lf.sys_dict_id_seq restart with 300; |
| | | update lf.sys_dict set create_user=1,create_time=now() where 1=1; |
| | | update lf.sys_dict set bak=null where bak=' '; */ |
| | | |
| | | select * from lf.sys_dict order by id; |
| | | ----------------------------------------------------------------------------------------------------- 21.样式表 |
| | |
| | | --insert into lf.sys_style (name,type,precision,descr) values ('line.edp','edp','1:1000','管道中心线样式文件'); |
| | | |
| | | select * from lf.sys_style; |
| | | ----------------------------------------------------------------------------------------------------- 22.专题图出图表 |
| | | -- DROP TABLE IF EXISTS lf.sys_drawing; |
| | | |
| | | ----------------------------------------------------------------------------------------------------- 23.下载记录表 |
| | | ----------------------------------------------------------------------------------------------------- 22.下载记录表 |
| | | -- DROP TABLE IF EXISTS lf.sys_download; |
| | | create table lf.sys_download( |
| | | id serial primary key, |
| | | name varchar(50), |
| | | type smallint default 1, |
| | | depid integer default 1, |
| | | dcount integer default 0, |
| | | pwd varchar(200), |
| | | url varchar(512), |
| | | descr varchar(256), |
| | | guid varchar(40) default new_guid(), |
| | | create_user integer default 1, |
| | | create_time timestamp(6) without time zone default now(), |
| | | download_user integer, |
| | | download_time timestamp(6) without time zone, |
| | | geo geometry default null, |
| | | bak varchar(1024) |
| | | CONSTRAINT enforce_dims_geom CHECK (st_ndims(geo) = 2), |
| | | CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geo) = 'POLYGON'::text OR geo IS NULL), |
| | | CONSTRAINT enforce_srid_geom CHECK (st_srid(geo) = 4490) |
| | | ); |
| | | create index index_sys_download_geo on lf.sys_download using gist (geo); |
| | | |
| | | ----------------------------------------------------------------------------------------------------- 24.消息通知表 |
| | | comment on table lf.sys_download is '下载记录表'; |
| | | comment on column lf.sys_download.id is '主键ID'; |
| | | comment on column lf.sys_download.name is '名称'; |
| | | comment on column lf.sys_download.type is '类型:1-下载数据,2-下载专题图'; |
| | | comment on column lf.sys_download.depid is '单位ID'; |
| | | comment on column lf.sys_download.dcount is '下载次数'; |
| | | comment on column lf.sys_download.pwd is 'MD5'; |
| | | comment on column lf.sys_download.url is '下载地址'; |
| | | comment on column lf.sys_download.descr is '描述'; |
| | | comment on column lf.sys_download.guid is '文件ID'; |
| | | comment on column lf.sys_download.create_user is '创建人ID'; |
| | | comment on column lf.sys_download.create_time is '创建时间'; |
| | | comment on column lf.sys_download.download_user is '下载人ID'; |
| | | comment on column lf.sys_download.download_time is '下载时间'; |
| | | comment on column lf.sys_download.geo is '空间'; |
| | | comment on column lf.sys_download.bak is '备注'; |
| | | |
| | | select * from lf.sys_download; |
| | | ----------------------------------------------------------------------------------------------------- 23.消息通知表 |
| | | -- DROP TABLE IF EXISTS lf.sys_msg; |
| | | |
| | | ----------------------------------------------------------------------------------------------------- 25.参数设置表 |
| | | ----------------------------------------------------------------------------------------------------- 24.参数设置表 |
| | | -- DROP TABLE IF EXISTS lf.sys_args; |
| | | create table lf.sys_args( |
| | | id serial primary key, |