Files
liche/sql/sys.sql
T
2023-02-16 15:21:18 +08:00

266 lines
14 KiB
SQL

-- ----------------------------
-- Title:管理员表
-- Author:0fun
-- Table:lc_sys_admin
-- ---------------------------
-- other_json:{"cate_id":[1,27], "city_id":["350200", "350500"], "platfrom_id":[0, 1], "app_id":[1,2]}
-- cate_id:可操作行业,city_id:可操作城市,platfrom_id:可登录平台,app_id:可操作应用,biz_id: 可操作门店
-- ---------------------------
drop table if exists lc_sys_admin;
create table lc_sys_admin(
id int unsigned not null auto_increment comment '管理id',
username varchar(32) not null comment '管理员名称',
mobile varchar(11) not null default '' comment '手机号码',
password varchar(255) not null comment '用户密码',
role_id int unsigned not null default 0 comment '角色id',
other_json text comment '行业、城市归属 json格式 {cate_id: [1,2]}',
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
c_time int unsigned not null default 0 comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='管理员表';
alter table lc_sys_admin add login_ip varchar(16) not null default '' comment '最近登录ip' after status;
-- ----------------------------
-- Title:管理日志表
-- Author:0fun
-- Table:lc_sys_admin_log
-- ---------------------------
drop table if exists lc_sys_admin_log;
create table lc_sys_admin_log(
id int unsigned not null auto_increment comment 'id',
admin_id int unsigned not null comment '管理员id',
username varchar(32) not null comment '管理员名称',
target_id int unsigned not null default 0 comment '对象id',
descrip varchar(255) not null comment '操作描述',
action varchar(32) not null comment '操作节点',
ip varchar(32) not null default '' comment 'ip',
jsondata text comment '更多数据',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='管理日志表';
create index idx_admin_id on lc_sys_admin_log(admin_id);
create index idx_action on lc_sys_admin_log(action);
alter table lc_sys_admin_log add type varchar(16) not null default '' comment '特殊日志类型 如jjd';
-- ----------------------------
-- Title:区域表
-- Author:0fun
-- Table:lc_sys_area
-- ---------------------------
drop table if exists lc_sys_area;
create table lc_sys_area(
id int unsigned not null auto_increment comment 'id',
name varchar(32) not null comment '商圈/路段 名称',
province_id int unsigned not null comment '省id',
province_name varchar(32) not null comment '省名称',
city_id int unsigned not null comment '城市id',
city_name varchar(32) not null comment '城市名称',
county_id int unsigned not null comment '区id',
county_name varchar(32) not null comment '区名称',
type tinyint(1) unsigned not null default 0 comment '类型 1:商圈|2:路段|3:卖场',
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='区域表';
-- ----------------------------
-- Title:行业分类表
-- Author:0fun
-- Table:lc_sys_category
-- ---------------------------
drop table if exists lc_sys_category;
create table lc_sys_category(
id int unsigned not null auto_increment comment 'id',
pid int unsigned not null default 0 comment '父id',
name varchar(32) not null comment '行业分类名称',
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='行业分类表';
-- ----------------------------
-- Title:开通城市表
-- Author:0fun
-- Table:lc_sys_city
-- ---------------------------
drop table if exists lc_sys_city;
create table lc_sys_city(
id int unsigned not null auto_increment comment 'id',
city_id int unsigned not null comment '城市id',
name varchar(32) not null default '' comment '城市名称',
firstchar varchar(2) not null default '' comment '城市首字母',
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='开通城市表';
alter table lc_sys_city add column fee_carno decimal(12,2) not null default 0.00 comment '挂牌价' after firstchar;
drop table if exists lc_sys_config;
create table lc_sys_config(
id int unsigned not null auto_increment comment '自增id',
k varchar(32) not null comment '配置key',
v text comment '配置',
c_time int unsigned not null default 0 comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='系统配置表';
-- ----------------------------
-- Title:系统菜单表
-- Author:0fun
-- Table:lc_sys_menu
-- ---------------------------
drop table if exists lc_sys_menu;
create table lc_sys_menu(
id int unsigned not null auto_increment comment '自增id',
pid int unsigned not null default 0 comment '父id',
name varchar(32) not null comment '菜单名称',
icon varchar(128) not null default '' comment '菜单图标',
node varchar(128) not null default '' comment '节点',
url varchar(128) not null default '' comment '链接',
sort int unsigned not null default 0 comment '排序',
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='系统菜单表';
alter table lc_sys_menu add outer_link tinyint(1) not null default 0 comment '是否为外链' after url;
alter table lc_sys_menu add column type tinyint(1) unsigned not null default 0 comment '类型(0总后台 1商家后台)';
-- ----------------------------
-- Title:系统角色表
-- Author:0fun
-- Table:lc_sys_role
-- ---------------------------
drop table if exists lc_sys_role;
create table lc_sys_role(
id int unsigned not null auto_increment comment '角色id',
name varchar(32) not null comment '角色名称',
menu_ids text comment '菜单id 都会隔开',
action_json text comment '操作权限 json格式 {菜单id: [1,2]}',
descrip varchar(255) not null default '' comment '角色描述',
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
primary key(id)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='系统角色表';
-- ----------------------------
-- Title:标签表
-- Author:0fun
-- Table:lc_sys_tag
-- ---------------------------
drop table if exists lc_sys_tag;
create table lc_sys_tag(
id int unsigned not null auto_increment comment '自增id',
tag_name varchar(128) not null comment '标签名称',
primary key(id),
unique key (tag_name)
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='标签表';
-- ----------------------------
-- Title:系统内容标签表
-- Author:0fun
-- Table:lc_sys_content_tags
-- ---------------------------
drop table if exists lc_sys_content_tags;
create table lc_sys_content_tags (
id int(10) unsigned not null auto_increment comment '自增id',
cate_id int(10) unsigned not null comment '一级分类id',
cate2_id int(10) unsigned not null comment '二级分类id',
tag_id int(10) unsigned not null comment '标签id',
status tinyint(1) not null default '1' comment '状态:-1删除,0禁用,1正常',
primary key (id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='系统内容标签表';
-- ----------------------------
-- Title:系统内容标签表
-- Author:0fun
-- Table:lc_sys_tag_category
-- ---------------------------
drop table if exists lc_sys_tag_category;
create table lc_sys_tag_category (
id int(10) unsigned not null auto_increment comment '自增id',
pid int(10) unsigned not null default '0' comment '父id',
name varchar(32) not null default '' comment '分类名称',
status tinyint(1) not null default '1' comment '状态:-1删除,0禁用,1正常',
primary key (id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='系统标签分类表';
-- ----------------------------
-- Title:公司管理
-- Author:xusir
-- Table:lc_sys_company
-- ---------------------------
drop table if exists lc_sys_company;
create table lc_sys_company (
id int(10) unsigned not null auto_increment comment '自增id',
title varchar(64) not null comment '公司名称',
short varchar(32) not null default '' comment '公司简称',
status tinyint(1) not null default '1' comment '状态:-1删除,0关闭,1开启',
primary key (id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='公司管理';
alter table lc_sys_company add column credit_code varchar(18) not null default '' comment '统一社会信用代码' after short;
alter table lc_sys_company add column wx_mchid varchar(10) not null default '' comment '微信商户号' after credit_code;
alter table lc_sys_company add column img_seal varchar(128) not null default '' comment '公章' after wx_mchid;
alter table lc_sys_company add column city_id int(10) unsigned not null default '0' comment '城市id' after wx_mchid;
alter table lc_sys_company add column type tinyint(1) not null default 0 comment '公司类型(0服务公司 1销售公司)' after status;
-- ----------------------------
-- Title:金融产品
-- Author:xusir
-- Table:lc_sys_finance
-- ---------------------------
drop table if exists lc_sys_finance;
create table lc_sys_finance (
id int(10) unsigned not null auto_increment comment '自增id',
title varchar(64) not null comment '公司名称',
logo varchar(128) not null default '' comment '菜单图标',
money_min decimal(12,2) not null default 0.00 comment '最低额度(万元)',
money_max decimal(12,2) not null default 0.00 comment '最高额度(万元)',
first_pay decimal(12,2) not null default 0.00 comment '首付(万元)',
month_min int not null default 0 comment '最低期限(月)',
month_max int not null default 0 comment '最高期限(月)',
status tinyint(1) not null default '1' comment '状态:-1删除,0关闭,1开启',
primary key (id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='金融产品';
-- ----------------------------
-- Title:地址管理
-- Author:xusir
-- Table:lc_sys_addr
-- ---------------------------
drop table if exists lc_sys_addr;
create table lc_sys_addr (
id int(10) unsigned not null auto_increment comment '自增id',
title varchar(128) not null comment '地址',
province_id int(10) unsigned not null comment '省id',
province_name varchar(32) not null comment '省名称',
city_id int(10) unsigned not null comment '城市id',
city_name varchar(32) not null comment '城市名称',
county_id int(10) unsigned not null comment '区id',
county_name varchar(32) not null comment '区名称',
status tinyint(1) not null default '1' comment '状态:-1删除,0关闭,1开启',
primary key (id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='地址管理';
drop table if exists `lc_sys_supplier`;
CREATE TABLE `lc_sys_supplier` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
`title` varchar(64) NOT NULL COMMENT '供应商',
`short` varchar(32) NOT NULL DEFAULT '' COMMENT '供应商简称',
`type` tinyint(2) NOT NULL DEFAULT '1' COMMENT '类型(1挂牌 2保险 3按揭 4 精品)',
`jsondata` json DEFAULT NULL COMMENT '配置数据',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:-1删除,0关闭,1开启',
`c_time` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
`u_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='供应商目录';