9.2.5.3. geodata 地理数据表

## 字段

列名 | 类型 | 是否非空 | 默认值 | 备注 |
———- | ————– | ——– | —- | ————————- |
id | int | not null | null | 自增ID |
name | varchar(30) | not null | “” | 数据名称 |
desc | varchar(300) | not null | “” | 数据描述 |
dir_type | int | not null | null | 上级目录类型:1:工作区,2:数据集 |
dir_id | int | not null | null | 上级目录编号 |
data_type | int | not null | | 数据类型(矢量1、栅格2) |
table_name | varchar(30) | not null | “” | 只针对矢量数据,表示对应hbase中的表名;若为栅格数据,则该字段值为空字符串 |
creator_id | int | not null | null | 创建用户id |
status | int | not null | 0 | 数据状态:0:导入中,1:导入完成 |
createtime | datetime | nullable | CurrentDateTime | 创建时间 |
updatetime | datetime | nullable | CurrentDateTime | 更新时间 |
deletetime | datetime | nullable | CurrentDateTime | 删除时间 |

## 索引

字段 | 是否唯一 | 索引方法 | 备注 |
— | —- | —- | — |
name | False | BTree | 数据集名称建索引,不要求唯一,会利用该字段查询 |
createtime | False | BTree | 数据集创建时间建索引,会利用该字段查询 |
dir_type,dir_id | False | BTree | 上级目录类型与上级目录编号做联合索引,用于查询特定工作区/数据集的数据列表 |

## 说明 table_name需要用户自己定义

## 建表语句

CREATE TABLE `geodata` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(30) NOT NULL,
  `desc` varchar(300) NOT NULL,
  `dir_type` int(2) NOT NULL,
  `dir_id` int(11) NOT NULL,
  `data_type` int(2) NOT NULL,
  `table_name` varchar(30) NOT NULL,
  `creator_id` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  `createtime` datetime DEFAULT NULL,
  `updatetime` datetime DEFAULT NULL ON UPDATE current_timestamp(),
  `deletetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `data_index_name` (`name`) USING BTREE,
  KEY `data_index_createtime` (`createtime`) USING BTREE,
  KEY `data_index_dir_type_dir_id` (`dir_type`,`dir_id`) USING BTREE
);