工具: mybatis+pgsql
详见: pgsql官方文档
表结构:
-- create table
create table user(
id varchar(32) not null default sys_guid(),
username varchar(25) not null,
status integer not null default 1,
image varchar(500),
depId varchar(32) not null default '0',
create_date timestamp not null default now(),
operator varchar(25) not null default ''
)
-- add comments to the table
comment on table user is '用户表';
-- add comments to the columns
comment on column users.id is '用户id';
comment on column users.username is '用户名';
comment on column users.status is '状态,1:正常,0:冻结';
comment on column users.image is '头像';
comment on column users.depId is '部门id';
comment on column users.create_date is '创建时间';
comment on column users.operator is '操作者';
-- create/recreate primary,unique and foreign key constraints
alter table user add constraint pk_id primary key(id);
-- create/recreate indexes
create unique index index_username on user(username);