feature:提交java后台管理系统

This commit is contained in:
chenweilin1 2025-09-03 14:18:54 +08:00
commit ebb69a35b3
517 changed files with 28035 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Compiled class file
*.class
# Log file
logs/
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
.idea
*.iml
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
target/
upload/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

12
README.md Normal file
View File

@ -0,0 +1,12 @@
## 项目说明
- drone-ops 是用SpringBoot3.4、SpringSecurity6.4、Mybatis-Plus、Flowable7.0、Vue3、Element-plus等技术开发的低代码开发平台旨在为开发者提供一个简洁、高效、可扩展的低代码开发平台。
- 使用门槛极低,支持国密加密、达梦数据库等,符合信创需求的低代码开发平台。
- 采用组件模式,扩展不同的业务功能,可以很方便的实现各种业务需求,且不会导致系统臃肿,若想使用某个组件,按需引入即可,反之亦然。
## 架构图
![输入图片说明](images/0.png)

502
db/mysql/maku.sql Normal file
View File

@ -0,0 +1,502 @@
CREATE TABLE sys_user
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
username varchar(50) NOT NULL COMMENT '用户名',
password varchar(100) COMMENT '密码',
real_name varchar(50) COMMENT '姓名',
avatar varchar(200) COMMENT '头像',
gender tinyint COMMENT '性别 0男 1女 2未知',
email varchar(100) COMMENT '邮箱',
mobile varchar(20) COMMENT '手机号',
org_id bigint COMMENT '机构ID',
super_admin tinyint COMMENT '超级管理员 0否 1',
status tinyint COMMENT '状态 0停用 1正常',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='用户管理';
CREATE TABLE sys_user_token
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
user_id bigint COMMENT '用户ID',
access_token varchar(32) COMMENT 'accessToken',
access_token_expire datetime COMMENT 'accessToken 过期时间',
refresh_token varchar(32) COMMENT 'refreshToken',
refresh_token_expire datetime COMMENT 'refreshToken 过期时间',
tenant_id bigint COMMENT '租户ID',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='用户Token';
CREATE TABLE sys_third_login
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
open_type varchar(50) COMMENT '开放平台类型',
open_id varchar(100) COMMENT '开放平台,唯一标识',
username varchar(100) COMMENT '昵称',
user_id bigint COMMENT '用户ID',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='第三方登录';
CREATE TABLE sys_third_login_config
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
open_type varchar(50) COMMENT '开放平台类型',
client_id varchar(200) COMMENT 'ClientID',
client_secret varchar(200) COMMENT 'ClientSecret',
redirect_uri varchar(200) COMMENT 'RedirectUri',
agent_id varchar(200) COMMENT 'AgentID',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='第三方登录配置';
CREATE TABLE sys_org
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
pid bigint COMMENT '上级ID',
name varchar(50) COMMENT '机构名称',
sort int COMMENT '排序',
leader_id bigint COMMENT '负责人ID',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_pid (pid)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='机构管理';
create table sys_role
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
name varchar(50) COMMENT '角色名称',
role_code varchar(50) COMMENT '角色编码',
remark varchar(100) COMMENT '备注',
data_scope tinyint COMMENT '数据范围 0全部数据 1本机构及子机构数据 2本机构数据 3本人数据 4自定义数据',
org_id bigint COMMENT '机构ID',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_org_id (org_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='角色管理';
create table sys_user_role
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
role_id bigint COMMENT '角色ID',
user_id bigint COMMENT '用户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_role_id (role_id),
key idx_user_id (user_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='用户角色关系';
CREATE TABLE sys_post
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
post_code varchar(100) COMMENT '岗位编码',
post_name varchar(100) COMMENT '岗位名称',
sort int COMMENT '排序',
status tinyint COMMENT '状态 0停用 1正常',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='岗位管理';
CREATE TABLE sys_user_post
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
user_id bigint COMMENT '用户ID',
post_id bigint COMMENT '岗位ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_user_id (user_id),
key idx_post_id (post_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='用户岗位关系';
create table sys_menu
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
pid bigint COMMENT '上级ID',
name varchar(200) COMMENT '菜单名称',
url varchar(200) COMMENT '菜单URL',
authority varchar(500) COMMENT '授权标识(多个用逗号分隔sys:menu:list,sys:menu:save)',
type tinyint COMMENT '类型 0菜单 1按钮 2接口',
open_style tinyint COMMENT '打开方式 0内部 1外部',
icon varchar(50) COMMENT '菜单图标',
sort int COMMENT '排序',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_pid (pid)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='菜单管理';
create table sys_role_menu
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
role_id bigint COMMENT '角色ID',
menu_id bigint COMMENT '菜单ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_role_id (role_id),
key idx_menu_id (menu_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='角色菜单关系';
create table sys_role_data_scope
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
role_id bigint COMMENT '角色ID',
org_id bigint COMMENT '机构ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id),
key idx_role_id (role_id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='角色数据权限';
create table sys_dict_type
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
dict_type varchar(100) NOT NULL COMMENT '字典类型',
dict_name varchar(255) NOT NULL COMMENT '字典名称',
dict_source tinyint default 0 COMMENT '来源 0字典数据 1动态SQL',
dict_sql varchar(500) COMMENT '动态SQL',
remark varchar(255) COMMENT '备注',
sort int COMMENT '排序',
pid bigint COMMENT '上级节点',
has_child tinyint default 0 COMMENT '是否有子节点',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='字典类型';
create table sys_dict_data
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
dict_type_id bigint NOT NULL COMMENT '字典类型ID',
dict_label varchar(255) NOT NULL COMMENT '字典标签',
dict_value varchar(255) COMMENT '字典值',
label_class varchar(100) COMMENT '标签样式',
remark varchar(255) COMMENT '备注',
sort int COMMENT '排序',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='字典数据';
create table sys_attachment
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
name varchar(255) NOT NULL COMMENT '附件名称',
url varchar(255) NOT NULL COMMENT '附件地址',
size bigint COMMENT '附件大小',
platform varchar(50) COMMENT '存储平台',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='附件管理';
create table sys_params
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
param_name varchar(100) COMMENT '参数名称',
param_type tinyint NOT NULL COMMENT '系统参数 0否 1',
param_key varchar(100) COMMENT '参数键',
param_value varchar(2000) COMMENT '参数值',
remark varchar(200) COMMENT '备注',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='参数管理';
create table sys_log_login
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
username varchar(50) COMMENT '用户名',
ip varchar(32) COMMENT '登录IP',
address varchar(32) COMMENT '登录地点',
user_agent varchar(500) COMMENT 'User Agent',
status tinyint COMMENT '登录状态 0失败 1成功',
operation tinyint unsigned COMMENT '操作信息 0登录成功 1退出成功 2验证码错误 3账号密码错误',
tenant_id bigint COMMENT '租户ID',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='登录日志';
create table sys_log_operate
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
module varchar(100) COMMENT '模块名',
name varchar(100) COMMENT '操作名',
req_uri varchar(200) DEFAULT NULL COMMENT '请求URI',
req_method varchar(20) DEFAULT NULL COMMENT '请求方法',
req_params text COMMENT '请求参数',
ip varchar(32) COMMENT '操作IP',
address varchar(32) COMMENT '登录地点',
user_agent varchar(500) COMMENT 'User Agent',
operate_type tinyint COMMENT '操作类型',
duration int NOT NULL COMMENT '执行时长',
status tinyint COMMENT '操作状态 0失败 1成功',
user_id bigint COMMENT '用户ID',
real_name varchar(50) COMMENT '操作人',
result_msg varchar(500) COMMENT '返回消息',
tenant_id bigint COMMENT '租户ID',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT ='操作日志';
CREATE TABLE sys_sms_config
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
platform tinyint COMMENT '平台类型 0阿里云 1腾讯云 2七牛云 3华为云',
group_name varchar(100) COMMENT '分组名称,发送短信时,可指定分组',
sign_name varchar(100) COMMENT '短信签名',
template_id varchar(100) COMMENT '短信模板',
app_id varchar(100) COMMENT '短信应用ID腾讯云等',
sender_id varchar(100) COMMENT '腾讯云国际短信、华为云等需要',
url varchar(200) COMMENT '接入地址,如:华为云',
access_key varchar(100) COMMENT 'AccessKey',
secret_key varchar(100) COMMENT 'SecretKey',
status tinyint COMMENT '状态 0禁用 1启用',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='短信配置';
CREATE TABLE sys_sms_log
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
platform_id bigint COMMENT '平台ID',
platform tinyint COMMENT '平台类型',
mobile varchar(20) NOT NULL COMMENT '手机号',
params varchar(200) COMMENT '参数',
status tinyint COMMENT '状态 0失败 1成功',
error varchar(2000) COMMENT '异常信息',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='短信日志';
CREATE TABLE sys_mail_config
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
platform tinyint COMMENT '平台类型 -1本地 0阿里云',
group_name varchar(100) COMMENT '分组名称,发送邮件时,可指定分组',
mail_host varchar(100) COMMENT 'SMTP服务器',
mail_port int COMMENT 'SMTP端口',
mail_from varchar(100) COMMENT '发件人邮箱',
mail_pass varchar(100) COMMENT '发件人密码',
region_id varchar(100) COMMENT 'regionId',
endpoint varchar(100) COMMENT '阿里云 endpoint',
access_key varchar(100) COMMENT 'AccessKey',
secret_key varchar(100) COMMENT 'SecretKey',
status tinyint COMMENT '状态 0禁用 1启用',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='邮件平台';
CREATE TABLE sys_mail_log
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
platform_id bigint COMMENT '平台ID',
platform tinyint COMMENT '平台类型',
mail_from varchar(100) COMMENT '发件人邮箱',
mail_tos varchar(1000) COMMENT '接受人邮箱',
subject varchar(200) COMMENT '邮件主题',
content text COMMENT '邮件内容',
status tinyint COMMENT '状态 0失败 1成功',
error varchar(2000) COMMENT '异常信息',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='邮件日志';
INSERT INTO sys_user (id, username, password, real_name, avatar, gender, email, mobile, status, org_id, super_admin, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (10000, 'admin', 'dc1fd00e3eeeb940ff46f457bf97d66ba7fcc36e0b20802383de142860e76ae6', 'admin', 'https://cdn.maku.net/images/avatar.png', 0, 'babamu@126.com', '13612345678', 1, null, 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1, NULL, '系统设置', NULL, NULL, 0, 0, 'icon-setting', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (2, 1, '菜单管理', 'sys/menu/index', NULL, 0, 0, 'icon-menu', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (3, 2, '查看', '', 'sys:menu:list', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (4, 2, '新增', '', 'sys:menu:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (5, 2, '修改', '', 'sys:menu:update,sys:menu:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (6, 2, '删除', '', 'sys:menu:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (7, 1, '数据字典', 'sys/dict/type', '', 0, 0, 'icon-insertrowabove', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (8, 7, '查询', '', 'sys:dict:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (9, 7, '新增', '', 'sys:dict:save', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (10, 7, '修改', '', 'sys:dict:update,sys:dict:info', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (11, 7, '删除', '', 'sys:dict:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (12, NULL, '权限管理', '', '', 0, 0, 'icon-safetycertificate', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (13, 12, '岗位管理', 'sys/post/index', '', 0, 0, 'icon-solution', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (14, 13, '查询', '', 'sys:post:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (15, 13, '新增', '', 'sys:post:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (16, 13, '修改', '', 'sys:post:update,sys:post:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (17, 13, '删除', '', 'sys:post:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (18, 12, '机构管理', 'sys/org/index', '', 0, 0, 'icon-cluster', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (19, 18, '查询', '', 'sys:org:list', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (20, 18, '新增', '', 'sys:org:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (21, 18, '修改', '', 'sys:org:update,sys:org:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (22, 18, '删除', '', 'sys:org:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (23, 12, '角色管理', 'sys/role/index', '', 0, 0, 'icon-team', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (24, 23, '查询', '', 'sys:role:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (25, 23, '新增', '', 'sys:role:save,sys:role:menu,sys:org:list', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (26, 23, '修改', '', 'sys:role:update,sys:role:info,sys:role:menu,sys:org:list,sys:user:page', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (27, 23, '删除', '', 'sys:role:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (28, 12, '用户管理', 'sys/user/index', '', 0, 0, 'icon-user', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (29, 28, '查询', '', 'sys:user:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (30, 28, '新增', '', 'sys:user:save,sys:role:list', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (31, 28, '修改', '', 'sys:user:update,sys:user:info,sys:role:list', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (32, 28, '删除', '', 'sys:user:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (33, NULL, '应用管理', '', '', 0, 0, 'icon-appstore', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (34, NULL, '日志管理', '', '', 0, 0, 'icon-filedone', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (35, 34, '登录日志', 'sys/log/login', 'sys:log:login', 0, 0, 'icon-solution', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (36, 28, '导入', '', 'sys:user:import', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (37, 28, '导出', '', 'sys:user:export', 1, 0, '', 6, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (38, 1, '参数管理', 'sys/params/index', 'sys:params:all', 0, 0, 'icon-filedone', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (39, 1, '接口文档', '{{apiUrl}}/doc.html', null, 0, 1, 'icon-file-text-fill', 10, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (40, 34, '操作日志', 'sys/log/operate', 'sys:operate:all', 0, 0, 'icon-file-text', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (41, 1, '系统配置', 'sys/config/index', null, 0, 0, 'icon-safetycertificate', 4, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (42, 41, '短信配置', '', 'sys:sms:config', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (43, 41, '邮件配置', '', 'sys:mail:config', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (44, 41, '第三方登录', '', 'sys:third:config', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (45, NULL, '基础工具', '', '', 0, 0, 'icon-wrench-fill', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (46, 45, '短信发送', 'sys/tool/sms/index', 'sys:sms:log', 0, 0, 'icon-message', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (47, 45, '邮件发送', 'sys/tool/mail/index', 'sys:mail:log', 0, 0, 'icon-mail', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (48, 45, '附件管理', 'sys/attachment/index', NULL, 0, 0, 'icon-folder-fill', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (49, 48, '查看', '', 'sys:attachment:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (50, 48, '上传', '', 'sys:attachment:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (51, 48, '删除', '', 'sys:attachment:delete', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (52, NULL, '企业版', 'https://maku.net/price', NULL, 0, 1, 'icon-safetycertificate', 10, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1, 'post_status', '状态', '岗位管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (2, 'user_gender', '性别', '用户管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (3, 'user_status', '状态', '用户管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (4, 'role_data_scope', '数据范围', '角色管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (5, 'enable_disable', '状态', '功能状态:启用 | 禁用 ', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (6, 'success_fail', '状态', '操作状态:成功 | 失败', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (7, 'login_operation', '操作信息', '登录管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (8, 'params_type', '系统参数', '参数管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (9, 'user_super_admin', '用户是否是超管','用户是否是超管', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (10, 'log_operate_type', '操作类型', '操作日志', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (11, 'sms_platform', '短信平台类型', '短信管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (12, 'mail_platform', '邮件平台类型', '邮件管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1, 1, '停用', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (2, 1, '正常', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (3, 2, '', '0', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (4, 2, '', '1', 'success', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (5, 2, '未知', '2', 'warning', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (6, 3, '正常', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (7, 3, '停用', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (8, 4, '全部数据', '0', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (9, 4, '本机构及子机构数据', '1', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (10, 4, '本机构数据', '2', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (11, 4, '本人数据', '3', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (12, 4, '自定义数据', '4', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (13, 5, '禁用', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (14, 5, '启用', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (15, 6, '失败', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (16, 6, '成功', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (17, 7, '登录成功', '0', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (18, 7, '退出成功', '1', 'warning', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (19, 7, '验证码错误', '2', 'danger', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (20, 7, '账号密码错误', '3', 'danger', '', 3, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (21, 8, '', '0', 'primary', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (22, 8, '', '1', 'danger', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (23, 9, '', '1', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (24, 9, '', '0', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (25, 10, '其它', '0', 'info', '', 10, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (26, 10, '查询', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (27, 10, '新增', '2', 'success', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (28, 10, '修改', '3', 'warning', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (29, 10, '删除', '4', 'danger', '', 3, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (30, 10, '导出', '5', 'info', '', 4, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (31, 10, '导入', '6', 'info', '', 5, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (32, 11, '阿里云', '0', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (33, 11, '腾讯云', '1', '', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (34, 11, '七牛云', '2', '', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (35, 11, '华为云', '3', '', '', 3, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (36, 12, '本地', '-1', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (37, 12, '阿里云', '0', '', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_params (param_name, param_type, param_key, param_value, remark, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ('用户登录-验证码开关', 1, 'LOGIN_CAPTCHA', 'false', '是否开启验证码true开启false关闭', 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_third_login_config (open_type, client_id, client_secret, redirect_uri, agent_id, tenant_id, version, deleted, create_time) VALUES ('feishu', 'cli_a541d3aa03f8500b', '5Chz39zvEhZtxSVZz3vLjfQHdkvavQaH', 'http://localhost:8090/sys/third/callback/feishu', '', 10000, 0, 0, now());
INSERT INTO sys_mail_config (platform, group_name, mail_host, mail_port, mail_from, mail_pass, region_id, endpoint, access_key, secret_key, status, version, deleted, creator, create_time, updater, update_time) VALUES (-1, 'test', NULL, NULL, 'baba_tv@163.com', 'TZNVURLYVBNJUNBB', '', '', NULL, NULL, 1, 1, 0, 10000, now(), 10000, now());

View File

@ -0,0 +1,336 @@
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (33, '代码生成器', '{{apiUrl}}/maku-generator/index.html', '', 0, 0, 'icon-rocket', 2, 0, 0, 10000, now(), 10000, now());
CREATE TABLE gen_datasource
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
db_type varchar(200) COMMENT '数据库类型',
conn_name varchar(200) NOT NULL COMMENT '连接名',
conn_url varchar(500) COMMENT 'URL',
username varchar(200) COMMENT '用户名',
password varchar(200) COMMENT '密码',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='数据源管理';
CREATE TABLE gen_config
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
config_key varchar(200),
config_value varchar(2000),
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='配置信息';
CREATE TABLE gen_field_type
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
column_type varchar(200) COMMENT '字段类型',
attr_type varchar(200) COMMENT '属性类型',
package_name varchar(200) COMMENT '属性包名',
create_time datetime COMMENT '创建时间',
primary key (id),
unique key (column_type)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='字段类型管理';
CREATE TABLE gen_base_class
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
package_name varchar(200) COMMENT '基类包名',
code varchar(200) COMMENT '基类编码',
fields varchar(500) COMMENT '基类字段,多个用英文逗号分隔',
remark varchar(200) COMMENT '备注',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='基类管理';
CREATE TABLE gen_table
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
table_name varchar(200) COMMENT '表名',
class_name varchar(200) COMMENT '类名',
table_comment varchar(200) COMMENT '说明',
author varchar(200) COMMENT '作者',
email varchar(200) COMMENT '邮箱',
package_name varchar(200) COMMENT '项目包名',
version varchar(200) COMMENT '项目版本号',
generator_type tinyint COMMENT '生成方式 0zip压缩包 1自定义目录',
backend_path varchar(500) COMMENT '后端生成路径',
frontend_path varchar(500) COMMENT '前端生成路径',
module_name varchar(200) COMMENT '模块名',
function_name varchar(200) COMMENT '功能名',
form_layout tinyint COMMENT '表单布局 1一列 2两列',
table_type tinyint COMMENT '表类型',
sub_table varchar(4000) COMMENT '子表数据',
table_operation varchar(200) COMMENT '生成功能',
auth_level tinyint COMMENT '权限级别 0:页面层级 1:按钮层级',
open_type tinyint COMMENT '新增编辑 0:弹窗 1:右侧栏',
request_url varchar(200) COMMENT '请求URL',
authority varchar(200) COMMENT '权限标识',
tree_id varchar(200) COMMENT '树形ID',
tree_pid varchar(200) COMMENT '树形父ID',
tree_label varchar(200) COMMENT '树展示列',
left_title varchar(200) COMMENT '左侧标题',
left_from tinyint COMMENT '数据来源',
left_table_name varchar(200) COMMENT '左侧树表名',
left_url varchar(200) COMMENT '接口地址',
left_relation_field varchar(200) COMMENT '关联字段',
datasource_id bigint COMMENT '数据源ID',
baseclass_id bigint COMMENT '基类ID',
create_time datetime COMMENT '创建时间',
primary key (id),
unique key (table_name)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='代码生成表';
CREATE TABLE gen_table_field
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
table_id bigint COMMENT '表ID',
field_name varchar(200) COMMENT '字段名称',
field_type varchar(200) COMMENT '字段类型',
field_comment varchar(200) COMMENT '字段说明',
attr_name varchar(200) COMMENT '属性名',
attr_type varchar(200) COMMENT '属性类型',
package_name varchar(200) COMMENT '属性包名',
sort int COMMENT '排序',
auto_fill varchar(20) COMMENT '自动填充 DEFAULT、INSERT、UPDATE、INSERT_UPDATE',
primary_pk tinyint COMMENT '主键 0否 1',
base_field tinyint COMMENT '基类字段 0否 1',
form_item tinyint COMMENT '表单项 0否 1',
form_required tinyint COMMENT '表单必填 0否 1',
form_type varchar(200) COMMENT '表单类型',
form_dict varchar(200) COMMENT '表单字典类型',
form_validator varchar(200) COMMENT '表单效验',
grid_item tinyint COMMENT '列表项 0否 1',
grid_sort tinyint COMMENT '列表排序 0否 1',
query_item tinyint COMMENT '查询项 0否 1',
query_type varchar(200) COMMENT '查询方式',
query_form_type varchar(200) COMMENT '查询表单类型',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='代码生成表字段';
CREATE TABLE gen_project_modify
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
project_name varchar(100) COMMENT '项目名',
project_code varchar(100) COMMENT '项目标识',
project_package varchar(100) COMMENT '项目包名',
project_path varchar(200) COMMENT '项目路径',
modify_project_name varchar(100) COMMENT '变更项目名',
modify_project_code varchar(100) COMMENT '变更标识',
modify_project_package varchar(100) COMMENT '变更包名',
exclusions varchar(200) COMMENT '排除文件',
modify_suffix varchar(200) COMMENT '变更文件',
modify_tmp_path varchar(100) COMMENT '变更临时路径',
create_time datetime COMMENT '创建时间',
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='项目名变更';
-- 用于测试代码生成器的表结构 --
CREATE TABLE gen_test_member
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
name varchar(50) COMMENT '姓名',
gender tinyint COMMENT '性别',
age int COMMENT '年龄',
tenant_id bigint COMMENT '租户ID',
create_time datetime COMMENT '创建时间',
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='单表测试';
CREATE TABLE gen_test_tree
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
parent_id bigint COMMENT '上级ID',
tree_name varchar(100) COMMENT '名称',
tenant_id bigint COMMENT '租户ID',
create_time datetime COMMENT '创建时间',
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='树表测试';
CREATE TABLE gen_test_product
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
name varchar(100) COMMENT '名称',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (id)
)ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='产品测试';
CREATE TABLE gen_test_product_info
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
images varchar(2000) COMMENT '图片',
intro varchar(5000) COMMENT '介绍',
product_id bigint COMMENT '产品ID',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (id)
)ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='产品信息';
CREATE TABLE gen_test_product_param
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
param_name varchar(200) COMMENT '参数名称',
param_value varchar(200) COMMENT '参数值',
product_id bigint COMMENT '产品ID',
tenant_id bigint COMMENT '租户ID',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (id)
)ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='产品参数';
CREATE TABLE gen_test_goods_category
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
name varchar(100) COMMENT '名称',
pid bigint COMMENT '上级ID',
tenant_id bigint COMMENT '租户ID',
deleted tinyint COMMENT '删除标识',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (id)
)ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='商品分类';
CREATE TABLE gen_test_goods
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
name varchar(100) COMMENT '名称',
intro varchar(5000) COMMENT '介绍',
category_id bigint COMMENT '分类ID',
tenant_id bigint COMMENT '租户ID',
deleted tinyint COMMENT '删除标识',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (id)
)ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='商品管理';
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('datetime', 'LocalDateTime', 'java.time.LocalDateTime', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('date', 'LocalDateTime', 'java.time.LocalDateTime', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('tinyint', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('smallint', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('mediumint', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('integer', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('bigint', 'Long', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('float', 'Float', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('double', 'Double', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('decimal', 'BigDecimal', 'java.math.BigDecimal', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('bit', 'Boolean', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('char', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('varchar', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('tinytext', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('text', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('mediumtext', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('longtext', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('timestamp', 'LocalDateTime', 'java.time.LocalDateTime', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('NUMBER', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('BINARY_INTEGER', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('BINARY_FLOAT', 'Float', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('BINARY_DOUBLE', 'Double', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('VARCHAR2', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('NVARCHAR', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('NVARCHAR2', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('CLOB', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int8', 'Long', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int4', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int2', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('numeric', 'BigDecimal', 'java.math.BigDecimal', now());
INSERT INTO gen_base_class (package_name, code, fields, remark, create_time) VALUES ('com.bdzl.framework.mybatis.entity', 'BaseEntity', 'id,creator,create_time,updater,update_time,version,deleted', '使用该基类,则需要表里有这些字段', now());
INSERT INTO gen_project_modify (project_name, project_code, project_package, project_path, modify_project_name, modify_project_code, modify_project_package, exclusions, modify_suffix, create_time) VALUES ('drone-ops', 'maku', 'com.bdzl', 'D:/makunet/drone-ops', 'baba-boot', 'baba', 'com.baba', '.git,.idea,target,logs', 'java,xml,yml,txt', now());
INSERT INTO gen_project_modify (project_name, project_code, project_package, project_path, modify_project_name, modify_project_code, modify_project_package, exclusions, modify_suffix, create_time) VALUES ('maku-cloud', 'maku', 'com.bdzl', 'D:/makunet/maku-cloud', 'baba-cloud', 'baba', 'com.baba', '.git,.idea,target,logs', 'java,xml,yml,txt', now());
INSERT INTO gen_config (config_key, config_value) VALUES ('gen_config', '');
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (20, 'gen_test_member', 'GenTestMember', '单表测试', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'member', 1, 0, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\",\"import\"]', 0, 0, '/test/member', 'test:member', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (21, 'gen_test_tree', 'GenTestTree', '树表测试', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'tree', 1, 1, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\"]', 0, 0, '/test/tree', 'test:tree', 'id', 'parent_id', 'tree_name', 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (22, 'gen_test_goods', 'GenTestGoods', '商品管理', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'goods', 1, 2, '[]', '[\"query\",\"insert\",\"update\",\"delete\"]', 0, 0, '/test/goods', 'test:goods', NULL, NULL, NULL, 0, NULL, now(), 0, 'gen_test_goods_category', '/test/category/list', 'category_id', '分类列表');
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (23, 'gen_test_goods_category', 'GenTestGoodsCategory', '商品分类', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'category', 1, 1, '[]', '[\"query\",\"insert\",\"update\",\"delete\"]', 0, 0, '/test/category', 'test:category', 'id', 'pid', 'name', 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (24, 'gen_test_product_info', 'GenTestProductInfo', '产品信息', '阿沐', 'babamu@126.com', 'com.bdzl', '', 0, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'info', 1, 0, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\"]', 0, 0, '/test/info', 'test:info', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (25, 'gen_test_product_param', 'GenTestProductParam', '产品参数', '阿沐', 'babamu@126.com', 'com.bdzl', '', 0, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'param', 1, 0, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\"]', 0, 0, '/test/param', 'test:param', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (26, 'gen_test_product', 'GenTestProduct', '产品测试', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'product', 1, 0, '[{\"tableName\":\"gen_test_product_info\",\"foreignKey\":\"product_id\",\"tableTitle\":\"产品信息\",\"mainRelation\":1,\"sort\":0},{\"tableName\":\"gen_test_product_param\",\"foreignKey\":\"product_id\",\"tableTitle\":\"产品参数\",\"mainRelation\":2,\"sort\":1}]', '[\"query\",\"insert\",\"update\",\"delete\"]', 0, 1, '/test/product', 'test:product', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (220, 20, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (221, 20, 'name', 'varchar', '姓名', 'name', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (222, 20, 'gender', 'tinyint', '性别', 'gender', 'Integer', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'radio', 'user_gender', NULL, 1, 0, 1, '=', 'select', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (223, 20, 'age', 'int', '年龄', 'age', 'Integer', NULL, 3, 'DEFAULT', 0, 0, 1, 1, 'number', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (224, 20, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (225, 20, 'version', 'int', '版本号', 'version', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (226, 20, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (227, 20, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (228, 21, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (229, 21, 'tree_name', 'varchar', '名称', 'treeName', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (230, 21, 'parent_id', 'bigint', '上级ID', 'parentId', 'Long', NULL, 2, 'DEFAULT', 0, 0, 1, 0, 'treeselect', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (231, 21, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (232, 21, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 4, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 1, '=', 'date', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (233, 22, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (234, 22, 'name', 'varchar', '名称', 'name', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, 'like', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (235, 22, 'intro', 'varchar', '介绍', 'intro', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (236, 22, 'category_id', 'bigint', '分类ID', 'categoryId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (237, 22, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (238, 22, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (239, 22, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (240, 22, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (241, 22, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 8, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (242, 22, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 9, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (243, 23, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (244, 23, 'name', 'varchar', '名称', 'name', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, 'like', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (245, 23, 'pid', 'bigint', '上级ID', 'pid', 'Long', NULL, 1, 'DEFAULT', 0, 0, 1, 0, 'treeselect', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (246, 23, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (247, 23, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 4, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (248, 23, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (249, 23, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 1, '=', 'datetime', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (250, 23, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 7, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (251, 23, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (252, 24, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (253, 24, 'images', 'varchar', '图片', 'images', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'image', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (254, 24, 'intro', 'varchar', '介绍', 'intro', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'editor', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (255, 24, 'product_id', 'bigint', '产品ID', 'productId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (256, 24, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (257, 24, 'version', 'int', '版本号', 'version', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (258, 24, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (259, 24, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (260, 24, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (261, 24, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 9, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (262, 24, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 10, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (263, 25, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (264, 25, 'param_name', 'varchar', '参数名称', 'paramName', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (265, 25, 'param_value', 'varchar', '参数值', 'paramValue', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (266, 25, 'product_id', 'bigint', '产品ID', 'productId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (267, 25, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (268, 25, 'version', 'int', '版本号', 'version', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (269, 25, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (270, 25, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (271, 25, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (272, 25, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 9, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (273, 25, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 10, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (274, 26, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (275, 26, 'name', 'varchar', '名称', 'name', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, 'like', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (276, 26, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 2, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (277, 26, 'version', 'int', '版本号', 'version', 'Integer', NULL, 3, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (278, 26, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 4, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (279, 26, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (280, 26, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 1, '=', 'datetime', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (281, 26, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 7, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (282, 26, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());

View File

@ -0,0 +1,129 @@
-- 表结构
CREATE TABLE iot_device (
id bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
code varchar(255) NOT NULL COMMENT '编码',
name varchar(255) NOT NULL COMMENT '名称',
type int NOT NULL COMMENT '设备类型1.手持设备2.柜体3传感设备',
uid varchar(255) NOT NULL COMMENT '唯一标识码',
secret varchar(255) DEFAULT NULL COMMENT '设备密钥',
app_version varchar(255) DEFAULT NULL COMMENT 'App版本号',
battery_percent varchar(10) DEFAULT NULL COMMENT '电池电量百分比',
temperature varchar(10) DEFAULT NULL COMMENT '温度',
status tinyint NOT NULL DEFAULT '1' COMMENT '状态0禁用1启用',
running_status int NOT NULL DEFAULT '0' COMMENT '运行状态0.离线状态 1.在线状态 2.正常待机 3.用户使用中 4.OTA升级中',
protocol_type varchar(20) NOT NULL DEFAULT 'MQTT' COMMENT '协议类型',
up_time datetime DEFAULT NULL COMMENT '上线时间',
down_time datetime DEFAULT NULL COMMENT '下线时间',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
creator bigint DEFAULT NULL COMMENT '创建者',
create_time datetime DEFAULT NULL COMMENT '创建时间',
updater bigint DEFAULT NULL COMMENT '更新者',
update_time datetime DEFAULT NULL COMMENT '更新时间',
version int DEFAULT NULL COMMENT '版本号',
deleted tinyint DEFAULT NULL COMMENT '删除标识 0正常 1已删除',
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT='设备表';
CREATE TABLE iot_device_event_log (
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
device_id bigint NOT NULL COMMENT '设备id',
event_type tinyint NOT NULL COMMENT '事件类型',
event_uid varchar(50) DEFAULT NULL COMMENT '事件标识id',
event_payload varchar(1000) DEFAULT NULL COMMENT '事件数据',
event_time datetime DEFAULT NULL COMMENT '事件时间',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
version int DEFAULT NULL COMMENT '版本号',
deleted tinyint DEFAULT NULL COMMENT '删除标识 0正常 1已删除',
creator bigint DEFAULT NULL COMMENT '创建者',
create_time datetime DEFAULT NULL COMMENT '创建时间',
updater bigint DEFAULT NULL COMMENT '更新者',
update_time datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT='设备事件日志';
CREATE TABLE iot_device_service_log (
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
device_id bigint NOT NULL COMMENT '设备id',
service_type tinyint NOT NULL COMMENT '服务类型',
service_uid varchar(50) DEFAULT NULL COMMENT '服务标识id',
service_payload varchar(1000) DEFAULT NULL COMMENT '服务数据',
service_time datetime DEFAULT NULL COMMENT '服务时间',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
version int DEFAULT NULL COMMENT '版本号',
deleted tinyint DEFAULT NULL COMMENT '删除标识 0正常 1已删除',
creator bigint DEFAULT NULL COMMENT '创建者',
create_time datetime DEFAULT NULL COMMENT '创建时间',
updater bigint DEFAULT NULL COMMENT '更新者',
update_time datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT='设备服务日志';
INSERT INTO iot_device (id, code, name, type, uid, secret, app_version, battery_percent, temperature, status, running_status, protocol_type, up_time, down_time, tenant_id, creator, create_time, updater, update_time, version, deleted) VALUES (1, 'test-tcp', 'testTCP', 1, 'test12345678', '123456', NULL, NULL, NULL, 1, 1, 'TCP', now(), NULL, NULL, 10000, now(), 10000, now(), 0, 0);
-- 菜单,权限
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ( NULL, '物联网平台', NULL, NULL, 0, 0, 'icon-printer-fill', 6, 0, 0, 10000,now(), 10000, now());
SET @pid = @@identity;
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @pid) , '设备列表', 'iot/device/index', NULL, 0, 0, 'icon-menu', 0, 0, 0, 10000, now(), 10000, now());
SET @menuId = @@identity;
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '查看', '', 'iot:device:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '新增', '', 'iot:device:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '修改', '', 'iot:device:update,iot:device:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '删除', '', 'iot:device:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '下发指令', '', 'iot:device:send', 1, 0, '', 4, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '上报数据', '', 'iot:device:report', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '设备事件日志', '', 'iot:device_event_log:page', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (@menuId, '设备服务日志', '', 'iot:device_service_log:page', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
-- 字典数据
INSERT INTO sys_dict_type (dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUE('device_type', '设备类型', '设备类型', 0, 10000, 0, 0, 10000, now(), 10000, now() );
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '手持设备', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '柜体', '2', 'primary', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '传感设备', '3', 'primary', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES('device_running_status', '设备运行状态', '设备运行状态:离线|在线|待机|使用中|OTA升级中', 0, 10000, 0, 0, 10000, now(), 10000, now() );
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '离线状态', '0', 'danger', NULL, 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '在线状态', '1', 'success', NULL, 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES('device_command', '设备指令', '设备服务具备的功能', 0, 10000, 0, 0, 10000, now(), 10000, now() );
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '远程锁定', 'LOCK', NULL, NULL, 0, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '远程解锁', 'UNLOCK', NULL, NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '登录', 'SIGN_ON', NULL, NULL, 2, NULL, 0, 1, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '登出', 'SIGN_OFF', NULL, NULL, 3, NULL, 0, 1, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'OTA升级', 'OTA_UPGRADE', NULL, NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES('device_protocol_type', '设备协议类型', '设备协议类型', 0, 10000, 0, 0, 10000, now(), 10000, now() );
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'MQTT', 'MQTT', NULL, NULL, 0, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'TCP', 'TCP', NULL, NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'UDP', 'UDP', NULL, NULL, 2, NULL, 0, 1, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'BLE', 'BLE', NULL, NULL, 3, NULL, 0, 1, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'CoAP', 'CoAP', NULL, NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'LwM2M', 'LwM2M', NULL, NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'Modbus', 'Modbus', NULL, NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES('device_property', '设备属性', '设备通用属性:运行状态|APP版本|电池电量百分比|温度', 0, 10000, 0, 0, 10000, now(), 10000, now() );
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '运行状态', 'RUNNING_STATUS', NULL, NULL, 0, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'APP版本', 'APP_VERSION', NULL, NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '电池电量百分比', 'BATTERY_PERCENT', NULL, NULL, 2, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '温度', 'TEMPERATURE', NULL, NULL, 3, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES('device_event_type', '事件类型', '事件日志类型', 0, 10000, 0, 0, 10000, now(), 10000, now() );
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '下线', 'OFFLINE', 'danger', NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '上线', 'ONLINE', 'primary', NULL, 2, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '登录', 'SIGN_ON', 'primary', NULL, 3, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '退出登录', 'SIGN_OFF', 'danger', NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'OTA升级', 'OTA_UPGRADE', 'primary', NULL, 5, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '设备远程锁定', 'LOCK', 'primary', NULL, 6, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '设备远程解锁', 'UNLOCK', 'primary', NULL,7, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), 'APP版本信息', 'APP_VERSION_REPORT', 'primary', NULL, 8, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '电池电量', 'BATTERY_PERCENT_REPORT', 'primary', NULL, 9, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '温度', 'TEMPERATURE_REPORT', 'primary', NULL, 0, NULL, 10, 0, 10000, now(), 10000, now());

View File

@ -0,0 +1,19 @@
CREATE TABLE member_user
(
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
nick_name varchar(100) NOT NULL COMMENT '昵称',
mobile varchar(20) NOT NULL COMMENT '手机号',
avatar varchar(200) COMMENT '头像',
birthday date COMMENT '出生日期',
gender tinyint COMMENT '性别 0男 1女 2未知',
openid varchar(200) COMMENT '第三方平台,唯一标识',
last_login_ip varchar(100) COMMENT '最后登录IP',
last_login_time datetime COMMENT '最后登录时间',
tenant_id bigint COMMENT '租户ID',
remark varchar(500) COMMENT '备注',
status tinyint COMMENT '状态 0禁用 1启用',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
create_time datetime COMMENT '创建时间',
primary key (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='会员管理';

View File

@ -0,0 +1,6 @@
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (33, '系统监控', '', '', 0, 0, 'icon-Report', 10, 0, 0, 10000, now(), 10000, now());
set @menuId = @@identity;
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '服务监控', 'monitor/server/index', 'monitor:server:all', 0, 0, 'icon-sever', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '缓存监控', 'monitor/cache/index', 'monitor:cache:all', 0, 0, 'icon-fund-fill', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '在线用户', 'monitor/user/index', 'monitor:user:all', 0, 0, 'icon-user', 3, 0, 0, 10000, now(), 10000, now());

View File

@ -0,0 +1,216 @@
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1, '定时任务', 'quartz/schedule/index', NULL, 0, 0, 'icon-reloadtime', 0, 0, 0, 10000, now(), 10000, now());
SET @menuId = @@identity;
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '查看', '', 'schedule:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '新增', '', 'schedule:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '修改', '', 'schedule:update,schedule:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '删除', '', 'schedule:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '立即运行', '', 'schedule:run', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @menuId), '日志', '', 'schedule:log', 1, 0, '', 4, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ('schedule_group', '任务组名', '定时任务', 0, 10000, 0, 0, 10000, now(), 10000, now());
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '默认', 'default', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '系统', 'system', '', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ('schedule_status', '状态', '定时任务', 0, 10000, 0, 0, 10000, now(), 10000, now());
SET @typeId = @@identity;
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '暂停', '0', 'danger', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ((SELECT @typeId), '正常', '1', 'primary', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
DROP TABLE IF EXISTS schedule_job;
DROP TABLE IF EXISTS schedule_job_log;
CREATE TABLE schedule_job (
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
job_name varchar(200) COMMENT '名称',
job_group varchar(100) COMMENT '分组',
bean_name varchar(200) COMMENT 'spring bean名称',
method varchar(100) COMMENT '执行方法',
params varchar(2000) COMMENT '参数',
cron_expression varchar(100) COMMENT 'cron表达式',
status tinyint unsigned COMMENT '状态 0暂停 1正常',
concurrent tinyint unsigned COMMENT '是否并发 0禁止 1允许',
remark varchar(255) COMMENT '备注',
version int COMMENT '版本号',
deleted tinyint COMMENT '删除标识 0正常 1已删除',
creator bigint COMMENT '创建者',
create_time datetime COMMENT '创建时间',
updater bigint COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='定时任务';
CREATE TABLE schedule_job_log (
id bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
job_id bigint NOT NULL COMMENT '任务id',
job_name varchar(200) COMMENT '任务名称',
job_group varchar(100) COMMENT '任务组名',
bean_name varchar(200) COMMENT 'spring bean名称',
method varchar(100) COMMENT '执行方法',
params varchar(2000) COMMENT '参数',
status tinyint unsigned NOT NULL COMMENT '任务状态 0失败 1成功',
error varchar(2000) COMMENT '异常信息',
times bigint NOT NULL COMMENT '耗时(单位:毫秒)',
create_time datetime COMMENT '创建时间',
PRIMARY KEY (id),
key idx_job_id (job_id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='定时任务日志';
INSERT INTO schedule_job (id, job_name, job_group, bean_name, method, params, cron_expression, status, concurrent, remark, version, deleted, creator, create_time, updater, update_time) VALUES (1, '测试任务', 'system', 'testTask', 'run', '123', '0 * * * * ? *', 0, 0, '', 14, 0, 10000, now(), 10000, now());
-- ----------------------------------------------------------
-- 以下为Quartz框架自带的表结构
-- ----------------------------------------------------------
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
DROP TABLE IF EXISTS QRTZ_LOCKS;
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
DROP TABLE IF EXISTS QRTZ_CALENDARS;
create table QRTZ_JOB_DETAILS (
sched_name varchar(120) not null comment '调度名称',
job_name varchar(200) not null comment '任务名称',
job_group varchar(200) not null comment '任务组名',
description varchar(250) null comment '相关介绍',
job_class_name varchar(250) not null comment '执行任务类名称',
is_durable varchar(1) not null comment '是否持久化',
is_nonconcurrent varchar(1) not null comment '是否并发',
is_update_data varchar(1) not null comment '是否更新数据',
requests_recovery varchar(1) not null comment '是否接受恢复执行',
job_data blob null comment '存放持久化job对象',
primary key (sched_name, job_name, job_group)
) ENGINE=InnoDB COMMENT = '任务详细信息表';
create table QRTZ_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment '触发器的名字',
trigger_group varchar(200) not null comment '触发器所属组的名字',
job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键',
job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键',
description varchar(250) null comment '相关介绍',
next_fire_time bigint(13) null comment '上一次触发时间(毫秒)',
prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发',
priority integer null comment '优先级',
trigger_state varchar(16) not null comment '触发器状态',
trigger_type varchar(8) not null comment '触发器的类型',
start_time bigint(13) not null comment '开始时间',
end_time bigint(13) null comment '结束时间',
calendar_name varchar(200) null comment '日程表名称',
misfire_instr smallint(2) null comment '补偿执行的策略',
job_data blob null comment '存放持久化job对象',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, job_name, job_group)
references QRTZ_JOB_DETAILS(sched_name, job_name, job_group)
) ENGINE=InnoDB COMMENT = '触发器详细信息表';
create table QRTZ_SIMPLE_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
repeat_count bigint(7) not null comment '重复的次数统计',
repeat_interval bigint(12) not null comment '重复的间隔时间',
times_triggered bigint(10) not null comment '已经触发的次数',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group)
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) ENGINE=InnoDB COMMENT = '简单触发器的信息表';
create table QRTZ_CRON_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
cron_expression varchar(200) not null comment 'cron表达式',
time_zone_id varchar(80) comment '时区',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group)
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) ENGINE=InnoDB COMMENT = 'Cron类型的触发器表';
create table QRTZ_BLOB_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
blob_data blob null comment '存放持久化Trigger对象',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group)
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) ENGINE=InnoDB COMMENT = 'Blob类型的触发器表';
create table QRTZ_CALENDARS (
sched_name varchar(120) not null comment '调度名称',
calendar_name varchar(200) not null comment '日历名称',
calendar blob not null comment '存放持久化calendar对象',
primary key (sched_name, calendar_name)
) ENGINE=InnoDB COMMENT = '日历信息表';
create table QRTZ_PAUSED_TRIGGER_GRPS (
sched_name varchar(120) not null comment '调度名称',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
primary key (sched_name, trigger_group)
) ENGINE=InnoDB COMMENT = '暂停的触发器表';
create table QRTZ_FIRED_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
entry_id varchar(95) not null comment '调度器实例id',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
instance_name varchar(200) not null comment '调度器实例名',
fired_time bigint(13) not null comment '触发的时间',
sched_time bigint(13) not null comment '定时器制定的时间',
priority integer not null comment '优先级',
state varchar(16) not null comment '状态',
job_name varchar(200) null comment '任务名称',
job_group varchar(200) null comment '任务组名',
is_nonconcurrent varchar(1) null comment '是否并发',
requests_recovery varchar(1) null comment '是否接受恢复执行',
primary key (sched_name, entry_id)
) ENGINE=InnoDB COMMENT = '已触发的触发器表';
create table QRTZ_SCHEDULER_STATE (
sched_name varchar(120) not null comment '调度名称',
instance_name varchar(200) not null comment '实例名称',
last_checkin_time bigint(13) not null comment '上次检查时间',
checkin_interval bigint(13) not null comment '检查间隔时间',
primary key (sched_name, instance_name)
) ENGINE=InnoDB COMMENT = '调度器状态表';
create table QRTZ_LOCKS (
sched_name varchar(120) not null comment '调度名称',
lock_name varchar(40) not null comment '悲观锁名称',
primary key (sched_name, lock_name)
) ENGINE=InnoDB COMMENT = '存储的悲观锁信息表';
create table QRTZ_SIMPROP_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数',
str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数',
str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数',
int_prop_1 int null comment 'int类型的trigger的第一个参数',
int_prop_2 int null comment 'int类型的trigger的第二个参数',
long_prop_1 bigint null comment 'long类型的trigger的第一个参数',
long_prop_2 bigint null comment 'long类型的trigger的第二个参数',
dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数',
dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数',
bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数',
bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group)
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) ENGINE=InnoDB COMMENT = '同步机制的行锁表';

826
db/postgresql/maku.sql Normal file
View File

@ -0,0 +1,826 @@
CREATE TABLE sys_user
(
id bigserial NOT NULL,
username varchar(50) NOT NULL,
password varchar(100),
real_name varchar(50),
avatar varchar(200),
gender int,
email varchar(100),
mobile varchar(20),
org_id int8,
super_admin int,
status int,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_user IS '用户管理';
COMMENT ON COLUMN sys_user.id IS 'id';
COMMENT ON COLUMN sys_user.username IS '用户名';
COMMENT ON COLUMN sys_user.password IS '密码';
COMMENT ON COLUMN sys_user.real_name IS '姓名';
COMMENT ON COLUMN sys_user.avatar IS '头像';
COMMENT ON COLUMN sys_user.gender IS '性别 0男 1女 2未知';
COMMENT ON COLUMN sys_user.email IS '邮箱';
COMMENT ON COLUMN sys_user.mobile IS '手机号';
COMMENT ON COLUMN sys_user.org_id IS '机构ID';
COMMENT ON COLUMN sys_user.super_admin IS '超级管理员 0否 1';
COMMENT ON COLUMN sys_user.status IS '状态 0停用 1正常';
COMMENT ON COLUMN sys_user.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_user.version IS '版本号';
COMMENT ON COLUMN sys_user.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_user.creator IS '创建者';
COMMENT ON COLUMN sys_user.create_time IS '创建时间';
COMMENT ON COLUMN sys_user.updater IS '更新者';
COMMENT ON COLUMN sys_user.update_time IS '更新时间';
CREATE TABLE sys_user_token
(
id bigserial NOT NULL,
user_id int8,
access_token varchar(50) NOT NULL,
access_token_expire timestamp,
refresh_token varchar(50) NOT NULL,
refresh_token_expire timestamp,
tenant_id int8,
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_user_token IS '用户管理';
COMMENT ON COLUMN sys_user_token.id IS 'id';
COMMENT ON COLUMN sys_user_token.user_id IS '用户ID';
COMMENT ON COLUMN sys_user_token.access_token IS 'accessToken';
COMMENT ON COLUMN sys_user_token.access_token_expire IS 'accessToken 过期时';
COMMENT ON COLUMN sys_user_token.refresh_token IS 'refreshToken';
COMMENT ON COLUMN sys_user_token.refresh_token_expire IS 'refreshToken 过期时间';
COMMENT ON COLUMN sys_user_token.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_user_token.create_time IS '创建时间';
CREATE TABLE sys_third_login
(
id bigserial NOT NULL,
open_type varchar(50),
open_id varchar(100),
username varchar(100),
user_id int8,
tenant_id int8,
version int,
deleted int,
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_third_login IS '第三方登录';
COMMENT ON COLUMN sys_third_login.id IS 'id';
COMMENT ON COLUMN sys_third_login.open_type IS '开放平台类型';
COMMENT ON COLUMN sys_third_login.open_id IS '开放平台,唯一标识';
COMMENT ON COLUMN sys_third_login.username IS '昵称';
COMMENT ON COLUMN sys_third_login.username IS '用户ID';
COMMENT ON COLUMN sys_third_login.user_id IS '租户ID';
COMMENT ON COLUMN sys_third_login.version IS '版本号';
COMMENT ON COLUMN sys_third_login.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_third_login.create_time IS '创建时间';
CREATE TABLE sys_third_login_config
(
id bigserial NOT NULL,
open_type varchar(50),
client_id varchar(200),
client_secret varchar(200),
redirect_uri varchar(200),
agent_id varchar(200),
tenant_id int8,
version int,
deleted int,
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_third_login_config IS '第三方登录配置';
COMMENT ON COLUMN sys_third_login_config.id IS 'id';
COMMENT ON COLUMN sys_third_login_config.open_type IS '开放平台类型';
COMMENT ON COLUMN sys_third_login_config.client_id IS 'ClientID';
COMMENT ON COLUMN sys_third_login_config.client_secret IS 'ClientSecret';
COMMENT ON COLUMN sys_third_login_config.redirect_uri IS 'RedirectUri';
COMMENT ON COLUMN sys_third_login_config.agent_id IS 'AgentID';
COMMENT ON COLUMN sys_third_login_config.version IS '版本号';
COMMENT ON COLUMN sys_third_login_config.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_third_login_config.create_time IS '创建时间';
CREATE TABLE sys_org
(
id bigserial NOT NULL,
pid int8,
name varchar(50),
sort int,
leader_id int8,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_org IS '机构管理';
COMMENT ON COLUMN sys_org.id IS 'id';
COMMENT ON COLUMN sys_org.pid IS '上级ID';
COMMENT ON COLUMN sys_org.name IS '机构名称';
COMMENT ON COLUMN sys_org.sort IS '排序';
COMMENT ON COLUMN sys_org.leader_id IS '负责人ID';
COMMENT ON COLUMN sys_org.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_org.version IS '版本号';
COMMENT ON COLUMN sys_org.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_org.creator IS '创建者';
COMMENT ON COLUMN sys_org.create_time IS '创建时间';
COMMENT ON COLUMN sys_org.updater IS '更新者';
COMMENT ON COLUMN sys_org.update_time IS '更新时间';
create table sys_role
(
id bigserial NOT NULL,
name varchar(50),
role_code varchar(50),
remark varchar(100),
data_scope int,
org_id int8,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_role IS '角色管理';
COMMENT ON COLUMN sys_role.id IS 'id';
COMMENT ON COLUMN sys_role.name IS '角色名称';
COMMENT ON COLUMN sys_role.role_code IS '角色编码';
COMMENT ON COLUMN sys_role.remark IS '备注';
COMMENT ON COLUMN sys_role.data_scope IS '数据范围 0全部数据 1本机构及子机构数据 2本机构数据 3本人数据 4自定义数据';
COMMENT ON COLUMN sys_role.org_id IS '机构ID';
COMMENT ON COLUMN sys_role.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_role.version IS '版本号';
COMMENT ON COLUMN sys_role.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_role.creator IS '创建者';
COMMENT ON COLUMN sys_role.create_time IS '创建时间';
COMMENT ON COLUMN sys_role.updater IS '更新者';
COMMENT ON COLUMN sys_role.update_time IS '更新时间';
create table sys_user_role
(
id bigserial NOT NULL,
role_id int8,
user_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_user_role IS '用户角色关系';
COMMENT ON COLUMN sys_user_role.id IS 'id';
COMMENT ON COLUMN sys_user_role.role_id IS '角色ID';
COMMENT ON COLUMN sys_user_role.user_id IS '用户ID';
COMMENT ON COLUMN sys_user_role.version IS '版本号';
COMMENT ON COLUMN sys_user_role.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_user_role.creator IS '创建者';
COMMENT ON COLUMN sys_user_role.create_time IS '创建时间';
COMMENT ON COLUMN sys_user_role.updater IS '更新者';
COMMENT ON COLUMN sys_user_role.update_time IS '更新时间';
CREATE TABLE sys_post
(
id bigserial NOT NULL,
post_code varchar(100),
post_name varchar(100),
sort int,
status int,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_post IS '岗位管理';
COMMENT ON COLUMN sys_post.id IS 'id';
COMMENT ON COLUMN sys_post.post_code IS '岗位编码';
COMMENT ON COLUMN sys_post.post_name IS '岗位名称';
COMMENT ON COLUMN sys_post.sort IS '排序';
COMMENT ON COLUMN sys_post.status IS '状态 0停用 1正常';
COMMENT ON COLUMN sys_post.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_post.version IS '版本号';
COMMENT ON COLUMN sys_post.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_post.creator IS '创建者';
COMMENT ON COLUMN sys_post.create_time IS '创建时间';
COMMENT ON COLUMN sys_post.updater IS '更新者';
COMMENT ON COLUMN sys_post.update_time IS '更新时间';
CREATE TABLE sys_user_post
(
id bigserial NOT NULL,
user_id int8,
post_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_user_post IS '用户岗位关系';
COMMENT ON COLUMN sys_user_post.id IS 'id';
COMMENT ON COLUMN sys_user_post.user_id IS '用户ID';
COMMENT ON COLUMN sys_user_post.post_id IS '岗位ID';
COMMENT ON COLUMN sys_user_post.version IS '版本号';
COMMENT ON COLUMN sys_user_post.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_user_post.creator IS '创建者';
COMMENT ON COLUMN sys_user_post.create_time IS '创建时间';
COMMENT ON COLUMN sys_user_post.updater IS '更新者';
COMMENT ON COLUMN sys_user_post.update_time IS '更新时间';
create table sys_menu
(
id bigserial NOT NULL,
pid int8,
name varchar(200),
url varchar(200),
authority varchar(500),
type int,
open_style int,
icon varchar(50),
sort int,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_menu IS '菜单管理';
COMMENT ON COLUMN sys_menu.id IS 'id';
COMMENT ON COLUMN sys_menu.pid IS '上级ID';
COMMENT ON COLUMN sys_menu.name IS '菜单名称';
COMMENT ON COLUMN sys_menu.url IS '菜单URL';
COMMENT ON COLUMN sys_menu.authority IS '授权标识';
COMMENT ON COLUMN sys_menu.type IS '类型 0菜单 1按钮 2接口';
COMMENT ON COLUMN sys_menu.open_style IS '打开方式 0内部 1外部';
COMMENT ON COLUMN sys_menu.icon IS '菜单图标';
COMMENT ON COLUMN sys_menu.sort IS '排序';
COMMENT ON COLUMN sys_menu.version IS '版本号';
COMMENT ON COLUMN sys_menu.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_menu.creator IS '创建者';
COMMENT ON COLUMN sys_menu.create_time IS '创建时间';
COMMENT ON COLUMN sys_menu.updater IS '更新者';
COMMENT ON COLUMN sys_menu.update_time IS '更新时间';
create table sys_role_menu
(
id bigserial NOT NULL,
role_id int8,
menu_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_role_menu IS '角色菜单关系';
COMMENT ON COLUMN sys_role_menu.id IS 'id';
COMMENT ON COLUMN sys_role_menu.role_id IS '角色ID';
COMMENT ON COLUMN sys_role_menu.menu_id IS '菜单ID';
COMMENT ON COLUMN sys_role_menu.version IS '版本号';
COMMENT ON COLUMN sys_role_menu.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_role_menu.creator IS '创建者';
COMMENT ON COLUMN sys_role_menu.create_time IS '创建时间';
COMMENT ON COLUMN sys_role_menu.updater IS '更新者';
COMMENT ON COLUMN sys_role_menu.update_time IS '更新时间';
create table sys_role_data_scope
(
id bigserial NOT NULL,
role_id int8,
org_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
CREATE INDEX idx_role_id on sys_role_data_scope(role_id);
COMMENT ON TABLE sys_role_data_scope IS '角色数据权限';
COMMENT ON COLUMN sys_role_data_scope.id IS 'id';
COMMENT ON COLUMN sys_role_data_scope.role_id IS '角色ID';
COMMENT ON COLUMN sys_role_data_scope.org_id IS '机构ID';
COMMENT ON COLUMN sys_role_data_scope.version IS '版本号';
COMMENT ON COLUMN sys_role_data_scope.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_role_data_scope.creator IS '创建者';
COMMENT ON COLUMN sys_role_data_scope.create_time IS '创建时间';
COMMENT ON COLUMN sys_role_data_scope.updater IS '更新者';
COMMENT ON COLUMN sys_role_data_scope.update_time IS '更新时间';
create table sys_dict_type
(
id bigserial NOT NULL,
dict_type varchar(100),
dict_name varchar(255),
dict_source int default 0,
dict_sql varchar(500),
remark varchar(255),
sort int,
pid int8,
has_child int default 0,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_dict_type IS '字典类型';
COMMENT ON COLUMN sys_dict_type.id IS 'id';
COMMENT ON COLUMN sys_dict_type.dict_type IS '字典类型';
COMMENT ON COLUMN sys_dict_type.dict_name IS '字典名称';
COMMENT ON COLUMN sys_dict_type.dict_source IS '来源 0字典数据 1动态SQL';
COMMENT ON COLUMN sys_dict_type.dict_sql IS '动态SQL';
COMMENT ON COLUMN sys_dict_type.remark IS '备注';
COMMENT ON COLUMN sys_dict_type.sort IS '排序';
COMMENT ON COLUMN sys_dict_type.pid IS '上级节点';
COMMENT ON COLUMN sys_dict_type.has_child IS '是否有子节点';
COMMENT ON COLUMN sys_dict_type.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_dict_type.version IS '版本号';
COMMENT ON COLUMN sys_dict_type.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_dict_type.creator IS '创建者';
COMMENT ON COLUMN sys_dict_type.create_time IS '创建时间';
COMMENT ON COLUMN sys_dict_type.updater IS '更新者';
COMMENT ON COLUMN sys_dict_type.update_time IS '更新时间';
create table sys_dict_data
(
id bigserial NOT NULL,
dict_type_id int8,
dict_label varchar(255),
dict_value varchar(255),
label_class varchar(100),
remark varchar(255),
sort int,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_dict_data IS '字典数据';
COMMENT ON COLUMN sys_dict_data.id IS 'id';
COMMENT ON COLUMN sys_dict_data.dict_type_id IS '字典类型ID';
COMMENT ON COLUMN sys_dict_data.dict_label IS '字典标签';
COMMENT ON COLUMN sys_dict_data.dict_value IS '字典值';
COMMENT ON COLUMN sys_dict_data.label_class IS '标签样式';
COMMENT ON COLUMN sys_dict_data.remark IS '备注';
COMMENT ON COLUMN sys_dict_data.sort IS '排序';
COMMENT ON COLUMN sys_dict_data.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_dict_data.version IS '版本号';
COMMENT ON COLUMN sys_dict_data.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_dict_data.creator IS '创建者';
COMMENT ON COLUMN sys_dict_data.create_time IS '创建时间';
COMMENT ON COLUMN sys_dict_data.updater IS '更新者';
COMMENT ON COLUMN sys_dict_data.update_time IS '更新时间';
create table sys_attachment
(
id bigserial NOT NULL,
name varchar(255) NOT NULL,
url varchar(255) NOT NULL,
size int8,
platform varchar(50),
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_attachment IS '附件管理';
COMMENT ON COLUMN sys_attachment.id IS 'id';
COMMENT ON COLUMN sys_attachment.name IS '附件名称';
COMMENT ON COLUMN sys_attachment.url IS '附件地址';
COMMENT ON COLUMN sys_attachment.size IS '附件大小';
COMMENT ON COLUMN sys_attachment.platform IS '存储平台';
COMMENT ON COLUMN sys_attachment.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_attachment.version IS '版本号';
COMMENT ON COLUMN sys_attachment.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_attachment.creator IS '创建者';
COMMENT ON COLUMN sys_attachment.create_time IS '创建时间';
COMMENT ON COLUMN sys_attachment.updater IS '更新者';
COMMENT ON COLUMN sys_attachment.update_time IS '更新时间';
create table sys_params
(
id bigserial NOT NULL,
param_name varchar(100),
param_type int NOT NULL,
param_key varchar(100),
param_value varchar(2000),
remark varchar(200),
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_params IS '参数管理';
COMMENT ON COLUMN sys_params.id IS 'id';
COMMENT ON COLUMN sys_params.param_name IS '参数名称';
COMMENT ON COLUMN sys_params.param_type IS '系统参数 0否 1';
COMMENT ON COLUMN sys_params.param_key IS '参数键';
COMMENT ON COLUMN sys_params.param_value IS '参数值';
COMMENT ON COLUMN sys_params.remark IS '备注';
COMMENT ON COLUMN sys_params.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_params.version IS '版本号';
COMMENT ON COLUMN sys_params.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_params.creator IS '创建者';
COMMENT ON COLUMN sys_params.create_time IS '创建时间';
COMMENT ON COLUMN sys_params.updater IS '更新者';
COMMENT ON COLUMN sys_params.update_time IS '更新时间';
create table sys_log_login
(
id bigserial NOT NULL,
username varchar(50),
ip varchar(32),
address varchar(32),
user_agent varchar(500),
status int,
operation int,
tenant_id int8,
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_log_login IS '登录日志';
COMMENT ON COLUMN sys_log_login.id IS 'id';
COMMENT ON COLUMN sys_log_login.username IS '用户名';
COMMENT ON COLUMN sys_log_login.ip IS '登录IP';
COMMENT ON COLUMN sys_log_login.address IS '登录地点';
COMMENT ON COLUMN sys_log_login.user_agent IS 'User Agent';
COMMENT ON COLUMN sys_log_login.status IS '登录状态 0失败 1成功';
COMMENT ON COLUMN sys_log_login.operation IS '操作信息 0登录成功 1退出成功 2验证码错误 3账号密码错误';
COMMENT ON COLUMN sys_log_login.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_log_login.create_time IS '创建时间';
create table sys_log_operate
(
id bigserial NOT NULL,
module varchar(100),
name varchar(100),
req_uri varchar(200),
req_method varchar(20),
req_params text,
ip varchar(32),
address varchar(32),
user_agent varchar(500),
operate_type int,
duration int,
status int,
user_id int,
real_name varchar(50),
result_msg varchar(500),
tenant_id int8,
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_log_operate IS '操作日志';
COMMENT ON COLUMN sys_log_operate.id IS 'id';
COMMENT ON COLUMN sys_log_operate.module IS '模块名';
COMMENT ON COLUMN sys_log_operate.name IS '操作名';
COMMENT ON COLUMN sys_log_operate.req_uri IS '请求URI';
COMMENT ON COLUMN sys_log_operate.req_method IS '请求方法';
COMMENT ON COLUMN sys_log_operate.req_params IS '请求参数';
COMMENT ON COLUMN sys_log_operate.ip IS '操作IP';
COMMENT ON COLUMN sys_log_operate.address IS '登录地点';
COMMENT ON COLUMN sys_log_operate.user_agent IS 'User Agent';
COMMENT ON COLUMN sys_log_operate.operate_type IS '操作类型';
COMMENT ON COLUMN sys_log_operate.status IS '登录状态 0失败 1成功';
COMMENT ON COLUMN sys_log_operate.user_id IS '用户ID';
COMMENT ON COLUMN sys_log_operate.real_name IS '操作人';
COMMENT ON COLUMN sys_log_operate.result_msg IS '返回消息';
COMMENT ON COLUMN sys_log_operate.tenant_id IS '租户ID';
COMMENT ON COLUMN sys_log_operate.create_time IS '创建时间';
CREATE TABLE sys_sms_config
(
id bigserial NOT NULL,
platform int,
group_name varchar(100),
sign_name varchar(100),
template_id varchar(100),
app_id varchar(100),
sender_id varchar(100),
url varchar(200),
access_key varchar(100),
secret_key varchar(100),
status int,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_sms_config IS '短信配置';
COMMENT ON COLUMN sys_sms_config.id IS 'id';
COMMENT ON COLUMN sys_sms_config.platform IS '平台类型 0阿里云 1腾讯云 2七牛云 3华为云';
COMMENT ON COLUMN sys_sms_config.group_name IS '分组名称,发送短信时,可指定分组';
COMMENT ON COLUMN sys_sms_config.sign_name IS '短信签名';
COMMENT ON COLUMN sys_sms_config.template_id IS '短信模板';
COMMENT ON COLUMN sys_sms_config.app_id IS '短信应用ID腾讯云等';
COMMENT ON COLUMN sys_sms_config.sender_id IS '腾讯云国际短信、华为云等需要';
COMMENT ON COLUMN sys_sms_config.url IS '接入地址,如:华为云';
COMMENT ON COLUMN sys_sms_config.access_key IS 'AccessKey';
COMMENT ON COLUMN sys_sms_config.secret_key IS 'SecretKey';
COMMENT ON COLUMN sys_sms_config.status IS '状态 0禁用 1启用';
COMMENT ON COLUMN sys_sms_config.version IS '版本号';
COMMENT ON COLUMN sys_sms_config.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_sms_config.creator IS '创建者';
COMMENT ON COLUMN sys_sms_config.create_time IS '创建时间';
COMMENT ON COLUMN sys_sms_config.updater IS '更新者';
COMMENT ON COLUMN sys_sms_config.update_time IS '更新时间';
CREATE TABLE sys_sms_log
(
id bigserial NOT NULL,
platform_id int8,
platform int,
mobile varchar(20) NOT NULL,
params varchar(200),
status int,
error varchar(2000),
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_sms_log IS '短信日志';
COMMENT ON COLUMN sys_sms_log.id IS 'id';
COMMENT ON COLUMN sys_sms_log.platform_id IS '平台ID';
COMMENT ON COLUMN sys_sms_log.platform IS '平台类型';
COMMENT ON COLUMN sys_sms_log.mobile IS '手机号';
COMMENT ON COLUMN sys_sms_log.params IS '参数';
COMMENT ON COLUMN sys_sms_log.status IS '状态 0失败 1成功';
COMMENT ON COLUMN sys_sms_log.error IS '异常信息';
COMMENT ON COLUMN sys_sms_log.create_time IS '创建时间';
CREATE TABLE sys_mail_config
(
id bigserial NOT NULL,
platform int,
group_name varchar(100),
mail_host varchar(100),
mail_port int,
mail_from varchar(100),
mail_pass varchar(100),
region_id varchar(100),
endpoint varchar(100),
access_key varchar(100),
secret_key varchar(100),
status int,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_mail_config IS '邮件平台';
COMMENT ON COLUMN sys_mail_config.id IS 'id';
COMMENT ON COLUMN sys_mail_config.platform IS '平台类型 -1本地 0阿里云';
COMMENT ON COLUMN sys_mail_config.group_name IS '分组名称,发送邮件时,可指定分组';
COMMENT ON COLUMN sys_mail_config.mail_host IS 'SMTP服务器';
COMMENT ON COLUMN sys_mail_config.mail_port IS 'SMTP端口';
COMMENT ON COLUMN sys_mail_config.mail_from IS '发件人邮箱';
COMMENT ON COLUMN sys_mail_config.mail_pass IS '发件人密码';
COMMENT ON COLUMN sys_mail_config.region_id IS 'regionId';
COMMENT ON COLUMN sys_mail_config.endpoint IS '阿里云 endpoint';
COMMENT ON COLUMN sys_mail_config.access_key IS 'AccessKey';
COMMENT ON COLUMN sys_mail_config.secret_key IS 'SecretKey';
COMMENT ON COLUMN sys_mail_config.status IS '状态 0禁用 1启用';
COMMENT ON COLUMN sys_mail_config.version IS '版本号';
COMMENT ON COLUMN sys_mail_config.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN sys_mail_config.creator IS '创建者';
COMMENT ON COLUMN sys_mail_config.create_time IS '创建时间';
COMMENT ON COLUMN sys_mail_config.updater IS '更新者';
COMMENT ON COLUMN sys_mail_config.update_time IS '更新时间';
CREATE TABLE sys_mail_log
(
id bigserial NOT NULL,
platform_id int8,
platform int,
mail_from varchar(100),
mail_tos varchar(1000),
subject varchar(200),
content text,
status int,
error varchar(2000),
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE sys_mail_log IS '邮件日志';
COMMENT ON COLUMN sys_mail_log.id IS 'id';
COMMENT ON COLUMN sys_mail_log.platform_id IS '平台ID';
COMMENT ON COLUMN sys_mail_log.platform IS '平台类型';
COMMENT ON COLUMN sys_mail_log.mail_from IS '发件人邮箱';
COMMENT ON COLUMN sys_mail_log.mail_tos IS '接受人邮箱';
COMMENT ON COLUMN sys_mail_log.subject IS '邮件主题';
COMMENT ON COLUMN sys_mail_log.content IS '邮件内容';
COMMENT ON COLUMN sys_mail_log.status IS '状态 0失败 1成功';
COMMENT ON COLUMN sys_mail_log.error IS '异常信息';
COMMENT ON COLUMN sys_mail_log.create_time IS '创建时间';
INSERT INTO sys_user (id, username, password, real_name, avatar, gender, email, mobile, status, org_id, super_admin, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (10000, 'admin', 'dc1fd00e3eeeb940ff46f457bf97d66ba7fcc36e0b20802383de142860e76ae6', 'admin', 'https://cdn.maku.net/images/avatar.png', 0, 'babamu@126.com', '13612345678', 1, null, 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1, NULL, '系统设置', NULL, NULL, 0, 0, 'icon-setting', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (2, 1, '菜单管理', 'sys/menu/index', NULL, 0, 0, 'icon-menu', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (3, 2, '查看', '', 'sys:menu:list', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (4, 2, '新增', '', 'sys:menu:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (5, 2, '修改', '', 'sys:menu:update,sys:menu:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (6, 2, '删除', '', 'sys:menu:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (7, 1, '数据字典', 'sys/dict/type', '', 0, 0, 'icon-insertrowabove', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (8, 7, '查询', '', 'sys:dict:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (9, 7, '新增', '', 'sys:dict:save', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (10, 7, '修改', '', 'sys:dict:update,sys:dict:info', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (11, 7, '删除', '', 'sys:dict:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (12, NULL, '权限管理', '', '', 0, 0, 'icon-safetycertificate', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (13, 12, '岗位管理', 'sys/post/index', '', 0, 0, 'icon-solution', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (14, 13, '查询', '', 'sys:post:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (15, 13, '新增', '', 'sys:post:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (16, 13, '修改', '', 'sys:post:update,sys:post:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (17, 13, '删除', '', 'sys:post:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (18, 12, '机构管理', 'sys/org/index', '', 0, 0, 'icon-cluster', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (19, 18, '查询', '', 'sys:org:list', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (20, 18, '新增', '', 'sys:org:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (21, 18, '修改', '', 'sys:org:update,sys:org:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (22, 18, '删除', '', 'sys:org:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (23, 12, '角色管理', 'sys/role/index', '', 0, 0, 'icon-team', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (24, 23, '查询', '', 'sys:role:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (25, 23, '新增', '', 'sys:role:save,sys:role:menu,sys:org:list', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (26, 23, '修改', '', 'sys:role:update,sys:role:info,sys:role:menu,sys:org:list,sys:user:page', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (27, 23, '删除', '', 'sys:role:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (28, 12, '用户管理', 'sys/user/index', '', 0, 0, 'icon-user', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (29, 28, '查询', '', 'sys:user:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (30, 28, '新增', '', 'sys:user:save,sys:role:list', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (31, 28, '修改', '', 'sys:user:update,sys:user:info,sys:role:list', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (32, 28, '删除', '', 'sys:user:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (33, NULL, '应用管理', '', '', 0, 0, 'icon-appstore', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (34, NULL, '日志管理', '', '', 0, 0, 'icon-filedone', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (35, 34, '登录日志', 'sys/log/login', 'sys:log:login', 0, 0, 'icon-solution', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (36, 28, '导入', '', 'sys:user:import', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (37, 28, '导出', '', 'sys:user:export', 1, 0, '', 6, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (38, 1, '参数管理', 'sys/params/index', 'sys:params:all', 0, 0, 'icon-filedone', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (39, 1, '接口文档', '{{apiUrl}}/doc.html', null, 0, 1, 'icon-file-text-fill', 10, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (40, 34, '操作日志', 'sys/log/operate', 'sys:operate:all', 0, 0, 'icon-file-text', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (41, 1, '系统配置', 'sys/config/index', null, 0, 0, 'icon-safetycertificate', 4, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (42, 41, '短信配置', '', 'sys:sms:config', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (43, 41, '邮件配置', '', 'sys:mail:config', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (44, 41, '第三方登录', '', 'sys:third:config', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (45, NULL, '基础工具', '', '', 0, 0, 'icon-wrench-fill', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (46, 45, '短信发送', 'sys/tool/sms/index', 'sys:sms:log', 0, 0, 'icon-message', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (47, 45, '邮件发送', 'sys/tool/mail/index', 'sys:mail:log', 0, 0, 'icon-mail', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (48, 45, '附件管理', 'sys/attachment/index', NULL, 0, 0, 'icon-folder-fill', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (49, 48, '查看', '', 'sys:attachment:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (50, 48, '上传', '', 'sys:attachment:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (51, 48, '删除', '', 'sys:attachment:delete', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (52, NULL, '企业版', 'https://maku.net/price', NULL, 0, 1, 'icon-safetycertificate', 10, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1, 'post_status', '状态', '岗位管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (2, 'user_gender', '性别', '用户管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (3, 'user_status', '状态', '用户管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (4, 'role_data_scope', '数据范围', '角色管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (5, 'enable_disable', '状态', '功能状态:启用 | 禁用 ', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (6, 'success_fail', '状态', '操作状态:成功 | 失败', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (7, 'login_operation', '操作信息', '登录管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (8, 'params_type', '系统参数', '参数管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (9, 'user_super_admin', '用户是否是超管','用户是否是超管', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (10, 'log_operate_type', '操作类型', '操作日志', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (11, 'sms_platform', '短信平台类型', '短信管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (12, 'mail_platform', '邮件平台类型', '邮件管理', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1, 1, '停用', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (2, 1, '正常', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (3, 2, '', '0', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (4, 2, '', '1', 'success', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (5, 2, '未知', '2', 'warning', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (6, 3, '正常', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (7, 3, '停用', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (8, 4, '全部数据', '0', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (9, 4, '本机构及子机构数据', '1', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (10, 4, '本机构数据', '2', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (11, 4, '本人数据', '3', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (12, 4, '自定义数据', '4', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (13, 5, '禁用', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (14, 5, '启用', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (15, 6, '失败', '0', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (16, 6, '成功', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (17, 7, '登录成功', '0', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (18, 7, '退出成功', '1', 'warning', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (19, 7, '验证码错误', '2', 'danger', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (20, 7, '账号密码错误', '3', 'danger', '', 3, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (21, 8, '', '0', 'primary', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (22, 8, '', '1', 'danger', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (23, 9, '', '1', 'danger', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (24, 9, '', '0', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (25, 10, '其它', '0', 'info', '', 10, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (26, 10, '查询', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (27, 10, '新增', '2', 'success', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (28, 10, '修改', '3', 'warning', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (29, 10, '删除', '4', 'danger', '', 3, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (30, 10, '导出', '5', 'info', '', 4, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (31, 10, '导入', '6', 'info', '', 5, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (32, 11, '阿里云', '0', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (33, 11, '腾讯云', '1', '', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (34, 11, '七牛云', '2', '', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (35, 11, '华为云', '3', '', '', 3, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (36, 12, '本地', '-1', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (id, dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (37, 12, '阿里云', '0', '', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_params (param_name, param_type, param_key, param_value, remark, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES ('用户登录-验证码开关', 1, 'LOGIN_CAPTCHA', 'false', '是否开启验证码true开启false关闭', 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_third_login_config (open_type, client_id, client_secret, redirect_uri, agent_id, tenant_id, version, deleted, create_time) VALUES ('feishu', 'cli_a541d3aa03f8500b', '5Chz39zvEhZtxSVZz3vLjfQHdkvavQaH', 'http://localhost:8090/sys/third/callback/feishu', '', 10000, 0, 0, now());
INSERT INTO sys_mail_config (platform, group_name, mail_host, mail_port, mail_from, mail_pass, region_id, endpoint, access_key, secret_key, status, version, deleted, creator, create_time, updater, update_time) VALUES (-1, 'test', NULL, NULL, 'baba_tv@163.com', 'TZNVURLYVBNJUNBB', '', '', NULL, NULL, 1, 1, 0, 10000, now(), 10000, now());
select setval('sys_user_id_seq', (select max(id) from sys_user));
select setval('sys_menu_id_seq', (select max(id) from sys_menu));
select setval('sys_dict_type_id_seq', (select max(id) from sys_dict_type));
select setval('sys_dict_data_id_seq', (select max(id) from sys_dict_data));
commit;

View File

@ -0,0 +1,468 @@
INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (33, '代码生成器', '{{apiUrl}}/maku-generator/index.html', '', 0, 0, 'icon-rocket', 2, 0, 0, 10000, now(), 10000, now());
CREATE TABLE gen_datasource (
id bigserial NOT NULL,
db_type varchar(200),
conn_name varchar(200),
conn_url varchar(500),
username varchar(200),
password varchar(200),
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE gen_datasource IS '数据源管理';
COMMENT ON COLUMN gen_datasource.id IS 'id';
COMMENT ON COLUMN gen_datasource.db_type IS '数据库类型';
COMMENT ON COLUMN gen_datasource.conn_name IS '连接名';
COMMENT ON COLUMN gen_datasource.conn_url IS 'URL';
COMMENT ON COLUMN gen_datasource.username IS '用户名';
COMMENT ON COLUMN gen_datasource.password IS '密码';
COMMENT ON COLUMN gen_datasource.create_time IS '创建时间';
CREATE TABLE gen_config
(
id bigserial NOT NULL,
config_key varchar(200),
config_value varchar(2000),
primary key (id)
);
CREATE TABLE gen_field_type
(
id bigserial NOT NULL,
column_type varchar(200),
attr_type varchar(200),
package_name varchar(200),
create_time timestamp,
primary key (id)
);
CREATE UNIQUE INDEX gen_column_type on gen_field_type(column_type);
COMMENT ON TABLE gen_field_type IS '字段类型管理';
COMMENT ON COLUMN gen_field_type.id IS 'id';
COMMENT ON COLUMN gen_field_type.column_type IS '字段类型';
COMMENT ON COLUMN gen_field_type.attr_type IS '属性类型';
COMMENT ON COLUMN gen_field_type.package_name IS '属性包名';
COMMENT ON COLUMN gen_field_type.create_time IS '创建时间';
CREATE TABLE gen_base_class
(
id bigserial NOT NULL,
package_name varchar(200),
code varchar(200),
fields varchar(500),
remark varchar(200),
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE gen_base_class IS '基类管理';
COMMENT ON COLUMN gen_base_class.id IS 'id';
COMMENT ON COLUMN gen_base_class.package_name IS '基类包名';
COMMENT ON COLUMN gen_base_class.code IS '基类编码';
COMMENT ON COLUMN gen_base_class.fields IS '基类字段,多个用英文逗号分隔';
COMMENT ON COLUMN gen_base_class.remark IS '备注';
COMMENT ON COLUMN gen_base_class.create_time IS '创建时间';
CREATE TABLE gen_table
(
id bigserial NOT NULL,
table_name varchar(200),
class_name varchar(200),
table_comment varchar(200),
author varchar(200),
email varchar(200),
package_name varchar(200),
version varchar(200),
generator_type int,
backend_path varchar(500),
frontend_path varchar(500),
module_name varchar(200),
function_name varchar(200),
form_layout int,
table_type int,
sub_table varchar(4000),
table_operation varchar(200),
auth_level int,
open_type int,
request_url varchar(200),
authority varchar(200),
tree_id varchar(200),
tree_pid varchar(200),
tree_label varchar(200),
left_title varchar(200),
left_from int,
left_table_name varchar(200),
left_url varchar(200),
left_relation_field varchar(200),
datasource_id int8,
baseclass_id int8,
create_time timestamp,
primary key (id)
);
CREATE UNIQUE INDEX gen_table_name on gen_table(table_name);
COMMENT ON TABLE gen_table IS '代码生成表';
COMMENT ON COLUMN gen_table.id IS 'id';
COMMENT ON COLUMN gen_table.table_name IS '表名';
COMMENT ON COLUMN gen_table.class_name IS '类名';
COMMENT ON COLUMN gen_table.table_comment IS '说明';
COMMENT ON COLUMN gen_table.author IS '作者';
COMMENT ON COLUMN gen_table.email IS '邮箱';
COMMENT ON COLUMN gen_table.package_name IS '项目包名';
COMMENT ON COLUMN gen_table.version IS '项目版本号';
COMMENT ON COLUMN gen_table.generator_type IS '生成方式 0zip压缩包 1自定义目录';
COMMENT ON COLUMN gen_table.backend_path IS '后端生成路径';
COMMENT ON COLUMN gen_table.frontend_path IS '前端生成路径';
COMMENT ON COLUMN gen_table.module_name IS '模块名';
COMMENT ON COLUMN gen_table.function_name IS '功能名';
COMMENT ON COLUMN gen_table.form_layout IS '表单布局 1一列 2两列';
COMMENT ON COLUMN gen_table.datasource_id IS '数据源ID';
COMMENT ON COLUMN gen_table.baseclass_id IS '基类ID';
COMMENT ON COLUMN gen_table.create_time IS '创建时间';
CREATE TABLE gen_table_field
(
id bigserial NOT NULL,
table_id int8,
field_name varchar(200),
field_type varchar(200),
field_comment varchar(200),
attr_name varchar(200),
attr_type varchar(200),
package_name varchar(200),
sort int,
auto_fill varchar(20),
primary_pk boolean,
base_field boolean,
form_item boolean,
form_required boolean,
form_type varchar(200),
form_dict varchar(200),
form_validator varchar(200),
grid_item boolean,
grid_sort boolean,
query_item boolean,
query_type varchar(200),
query_form_type varchar(200),
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE gen_table_field IS '代码生成表字段';
COMMENT ON COLUMN gen_table_field.id IS 'id';
COMMENT ON COLUMN gen_table_field.table_id IS '表ID';
COMMENT ON COLUMN gen_table_field.field_name IS '字段名称';
COMMENT ON COLUMN gen_table_field.field_type IS '字段类型';
COMMENT ON COLUMN gen_table_field.field_comment IS '字段说明';
COMMENT ON COLUMN gen_table_field.attr_name IS '属性名';
COMMENT ON COLUMN gen_table_field.attr_type IS '属性类型';
COMMENT ON COLUMN gen_table_field.package_name IS '属性包名';
COMMENT ON COLUMN gen_table_field.sort IS '排序';
COMMENT ON COLUMN gen_table_field.auto_fill IS '自动填充 DEFAULT、INSERT、UPDATE、INSERT_UPDATE';
COMMENT ON COLUMN gen_table_field.primary_pk IS '主键 0否 1';
COMMENT ON COLUMN gen_table_field.base_field IS '基类字段 0否 1';
COMMENT ON COLUMN gen_table_field.form_item IS '表单项 0否 1';
COMMENT ON COLUMN gen_table_field.form_required IS '表单必填 0否 1';
COMMENT ON COLUMN gen_table_field.form_type IS '表单类型';
COMMENT ON COLUMN gen_table_field.form_dict IS '表单字典类型';
COMMENT ON COLUMN gen_table_field.form_validator IS '表单效验';
COMMENT ON COLUMN gen_table_field.grid_item IS '列表项 0否 1';
COMMENT ON COLUMN gen_table_field.grid_sort IS '列表排序 0否 1';
COMMENT ON COLUMN gen_table_field.query_item IS '查询项 0否 1';
COMMENT ON COLUMN gen_table_field.query_type IS '查询方式';
COMMENT ON COLUMN gen_table_field.query_form_type IS '查询表单类型';
CREATE TABLE gen_project_modify
(
id bigserial NOT NULL,
project_name varchar(100),
project_code varchar(100),
project_package varchar(100),
project_path varchar(200),
modify_project_name varchar(100),
modify_project_code varchar(100),
modify_project_package varchar(100),
exclusions varchar(200),
modify_suffix varchar(200),
modify_tmp_path varchar(100),
create_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_project_modify IS '项目名变更';
COMMENT ON COLUMN gen_project_modify.id IS 'id';
COMMENT ON COLUMN gen_project_modify.project_name IS '项目名';
COMMENT ON COLUMN gen_project_modify.project_code IS '项目标识';
COMMENT ON COLUMN gen_project_modify.project_package IS '项目包名';
COMMENT ON COLUMN gen_project_modify.project_path IS '项目路径';
COMMENT ON COLUMN gen_project_modify.modify_project_name IS '变更项目名';
COMMENT ON COLUMN gen_project_modify.modify_project_code IS '变更标识';
COMMENT ON COLUMN gen_project_modify.modify_project_package IS '变更包名';
COMMENT ON COLUMN gen_project_modify.exclusions IS '排除文件';
COMMENT ON COLUMN gen_project_modify.modify_suffix IS '变更文件';
COMMENT ON COLUMN gen_project_modify.modify_tmp_path IS '变更临时路径';
COMMENT ON COLUMN gen_project_modify.create_time IS '创建时间';
-- 用于测试代码生成器的表结构 --
CREATE TABLE gen_test_member
(
id bigserial NOT NULL,
name varchar(50),
gender int,
age int,
tenant_id int8,
create_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_member IS '单表测试';
COMMENT ON COLUMN gen_test_member.id IS 'id';
COMMENT ON COLUMN gen_test_member.name IS '姓名';
COMMENT ON COLUMN gen_test_member.gender IS '性别';
COMMENT ON COLUMN gen_test_member.age IS '年龄';
COMMENT ON COLUMN gen_test_member.tenant_id IS '租户ID';
COMMENT ON COLUMN gen_test_member.create_time IS '创建时间';
CREATE TABLE gen_test_tree
(
id bigserial NOT NULL,
parent_id int8,
tree_name varchar(100),
tenant_id int8,
create_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_tree IS '树表测试';
COMMENT ON COLUMN gen_test_tree.id IS 'id';
COMMENT ON COLUMN gen_test_tree.parent_id IS '上级ID';
COMMENT ON COLUMN gen_test_tree.tree_name IS '名称';
COMMENT ON COLUMN gen_test_tree.tenant_id IS '租户ID';
COMMENT ON COLUMN gen_test_tree.create_time IS '创建时间';
CREATE TABLE gen_test_product
(
id bigserial NOT NULL,
name varchar(100),
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_product IS '产品测试';
COMMENT ON COLUMN gen_test_product.id IS 'id';
COMMENT ON COLUMN gen_test_product.name IS '名称';
CREATE TABLE gen_test_product_info
(
id bigserial NOT NULL,
images varchar(2000),
intro varchar(5000),
product_id int8,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_product_info IS '产品信息';
COMMENT ON COLUMN gen_test_product_info.id IS 'id';
COMMENT ON COLUMN gen_test_product_info.images IS '图片';
COMMENT ON COLUMN gen_test_product_info.intro IS '介绍';
COMMENT ON COLUMN gen_test_product_info.product_id IS '产品ID';
CREATE TABLE gen_test_product_param
(
id bigserial NOT NULL,
param_name varchar(200),
param_value varchar(200),
product_id int8,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_product_param IS '产品参数';
COMMENT ON COLUMN gen_test_product_param.id IS 'id';
COMMENT ON COLUMN gen_test_product_param.param_name IS '参数名称';
COMMENT ON COLUMN gen_test_product_param.param_value IS '参数值';
COMMENT ON COLUMN gen_test_product_param.product_id IS '产品ID';
CREATE TABLE gen_test_goods_category
(
id bigserial NOT NULL,
name varchar(100),
pid int8,
tenant_id int8,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_goods_category IS '商品分类';
COMMENT ON COLUMN gen_test_goods_category.id IS 'id';
COMMENT ON COLUMN gen_test_goods_category.name IS '名称';
COMMENT ON COLUMN gen_test_goods_category.pid IS '上级ID';
CREATE TABLE gen_test_goods
(
id bigserial NOT NULL,
name varchar(100),
intro varchar(5000),
category_id int8,
tenant_id int8,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE gen_test_goods IS '商品管理';
COMMENT ON COLUMN gen_test_goods.id IS 'id';
COMMENT ON COLUMN gen_test_goods.name IS '名称';
COMMENT ON COLUMN gen_test_goods.intro IS '介绍';
COMMENT ON COLUMN gen_test_goods.category_id IS '分类ID';
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('datetime', 'LocalDateTime', 'java.time.LocalDateTime', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('date', 'LocalDateTime', 'java.time.LocalDateTime', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('tinyint', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('smallint', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('mediumint', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('integer', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('bigint', 'Long', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('float', 'Float', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('double', 'Double', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('decimal', 'BigDecimal', 'java.math.BigDecimal', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('bit', 'Boolean', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('char', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('varchar', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('tinytext', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('text', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('mediumtext', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('longtext', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('timestamp', 'LocalDateTime', 'java.time.LocalDateTime', now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('NUMBER', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('BINARY_INTEGER', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('BINARY_FLOAT', 'Float', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('BINARY_DOUBLE', 'Double', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('VARCHAR2', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('NVARCHAR', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('NVARCHAR2', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('CLOB', 'String', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int8', 'Long', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int4', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('int2', 'Integer', NULL, now());
INSERT INTO gen_field_type (column_type, attr_type, package_name, create_time) VALUES ('numeric', 'BigDecimal', 'java.math.BigDecimal', now());
INSERT INTO gen_base_class (package_name, code, fields, remark, create_time) VALUES ('com.bdzl.framework.mybatis.entity', 'BaseEntity', 'id,creator,create_time,updater,update_time,version,deleted', '使用该基类,则需要表里有这些字段', now());
INSERT INTO gen_project_modify (project_name, project_code, project_package, project_path, modify_project_name, modify_project_code, modify_project_package, exclusions, modify_suffix, create_time) VALUES ('drone-ops', 'maku', 'com.bdzl', 'D:/makunet/drone-ops', 'baba-boot', 'baba', 'com.baba', '.git,.idea,target,logs', 'java,xml,yml,txt', now());
INSERT INTO gen_project_modify (project_name, project_code, project_package, project_path, modify_project_name, modify_project_code, modify_project_package, exclusions, modify_suffix, create_time) VALUES ('maku-cloud', 'maku', 'com.bdzl', 'D:/makunet/maku-cloud', 'baba-cloud', 'baba', 'com.baba', '.git,.idea,target,logs', 'java,xml,yml,txt', now());
INSERT INTO gen_config (config_key, config_value) VALUES ('gen_config', '');
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (20, 'gen_test_member', 'GenTestMember', '单表测试', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'member', 1, 0, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\",\"import\"]', 0, 0, '/test/member', 'test:member', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (21, 'gen_test_tree', 'GenTestTree', '树表测试', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'tree', 1, 1, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\"]', 0, 0, '/test/tree', 'test:tree', 'id', 'parent_id', 'tree_name', 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (22, 'gen_test_goods', 'GenTestGoods', '商品管理', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'goods', 1, 2, '[]', '[\"query\",\"insert\",\"update\",\"delete\"]', 0, 0, '/test/goods', 'test:goods', NULL, NULL, NULL, 0, NULL, now(), 0, 'gen_test_goods_category', '/test/category/list', 'category_id', '分类列表');
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (23, 'gen_test_goods_category', 'GenTestGoodsCategory', '商品分类', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'category', 1, 1, '[]', '[\"query\",\"insert\",\"update\",\"delete\"]', 0, 0, '/test/category', 'test:category', 'id', 'pid', 'name', 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (24, 'gen_test_product_info', 'GenTestProductInfo', '产品信息', '阿沐', 'babamu@126.com', 'com.bdzl', '', 0, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'info', 1, 0, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\"]', 0, 0, '/test/info', 'test:info', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (25, 'gen_test_product_param', 'GenTestProductParam', '产品参数', '阿沐', 'babamu@126.com', 'com.bdzl', '', 0, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'param', 1, 0, NULL, '[\"query\",\"insert\",\"update\",\"delete\",\"export\"]', 0, 0, '/test/param', 'test:param', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table (id, table_name, class_name, table_comment, author, email, package_name, version, generator_type, backend_path, frontend_path, module_name, function_name, form_layout, table_type, sub_table, table_operation, auth_level, open_type, request_url, authority, tree_id, tree_pid, tree_label, datasource_id, baseclass_id, create_time, left_from, left_table_name, left_url, left_relation_field, left_title) VALUES (26, 'gen_test_product', 'GenTestProduct', '产品测试', '阿沐', 'babamu@126.com', 'com.bdzl', '', 1, '/Users/maku/makunet/drone-ops-enterprise/drone-ops-new', '/Users/maku/makunet/maku-admin-enterprise', 'test', 'product', 1, 0, '[{\"tableName\":\"gen_test_product_info\",\"foreignKey\":\"product_id\",\"tableTitle\":\"产品信息\",\"mainRelation\":1,\"sort\":0},{\"tableName\":\"gen_test_product_param\",\"foreignKey\":\"product_id\",\"tableTitle\":\"产品参数\",\"mainRelation\":2,\"sort\":1}]', '[\"query\",\"insert\",\"update\",\"delete\"]', 0, 1, '/test/product', 'test:product', NULL, NULL, NULL, 0, NULL, now(), NULL, NULL, NULL, NULL, NULL);
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (220, 20, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (221, 20, 'name', 'varchar', '姓名', 'name', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (222, 20, 'gender', 'tinyint', '性别', 'gender', 'Integer', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'radio', 'user_gender', NULL, 1, 0, 1, '=', 'select', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (223, 20, 'age', 'int', '年龄', 'age', 'Integer', NULL, 3, 'DEFAULT', 0, 0, 1, 1, 'number', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (224, 20, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (225, 20, 'version', 'int', '版本号', 'version', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (226, 20, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (227, 20, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (228, 21, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (229, 21, 'tree_name', 'varchar', '名称', 'treeName', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (230, 21, 'parent_id', 'bigint', '上级ID', 'parentId', 'Long', NULL, 2, 'DEFAULT', 0, 0, 1, 0, 'treeselect', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (231, 21, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (232, 21, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 4, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 1, '=', 'date', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (233, 22, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (234, 22, 'name', 'varchar', '名称', 'name', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, 'like', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (235, 22, 'intro', 'varchar', '介绍', 'intro', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (236, 22, 'category_id', 'bigint', '分类ID', 'categoryId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (237, 22, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (238, 22, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (239, 22, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (240, 22, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (241, 22, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 8, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (242, 22, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 9, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (243, 23, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (244, 23, 'name', 'varchar', '名称', 'name', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, 'like', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (245, 23, 'pid', 'bigint', '上级ID', 'pid', 'Long', NULL, 1, 'DEFAULT', 0, 0, 1, 0, 'treeselect', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (246, 23, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (247, 23, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 4, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (248, 23, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (249, 23, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 1, '=', 'datetime', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (250, 23, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 7, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (251, 23, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (252, 24, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (253, 24, 'images', 'varchar', '图片', 'images', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'image', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (254, 24, 'intro', 'varchar', '介绍', 'intro', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'editor', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (255, 24, 'product_id', 'bigint', '产品ID', 'productId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (256, 24, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (257, 24, 'version', 'int', '版本号', 'version', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (258, 24, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (259, 24, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (260, 24, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (261, 24, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 9, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (262, 24, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 10, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (263, 25, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (264, 25, 'param_name', 'varchar', '参数名称', 'paramName', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (265, 25, 'param_value', 'varchar', '参数值', 'paramValue', 'String', NULL, 2, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (266, 25, 'product_id', 'bigint', '产品ID', 'productId', 'Long', NULL, 3, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (267, 25, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 4, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (268, 25, 'version', 'int', '版本号', 'version', 'Integer', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (269, 25, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (270, 25, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 7, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (271, 25, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (272, 25, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 9, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (273, 25, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 10, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (274, 26, 'id', 'bigint', 'ID', 'id', 'Long', NULL, 0, 'DEFAULT', 1, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (275, 26, 'name', 'varchar', '名称', 'name', 'String', NULL, 1, 'DEFAULT', 0, 0, 1, 1, 'input', NULL, NULL, 1, 0, 1, 'like', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (276, 26, 'tenant_id', 'bigint', '租户ID', 'tenantId', 'Long', NULL, 2, 'DEFAULT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (277, 26, 'version', 'int', '版本号', 'version', 'Integer', NULL, 3, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (278, 26, 'deleted', 'tinyint', '删除标识', 'deleted', 'Integer', NULL, 4, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (279, 26, 'creator', 'bigint', '创建者', 'creator', 'Long', NULL, 5, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (280, 26, 'create_time', 'datetime', '创建时间', 'createTime', 'LocalDateTime', 'java.time.LocalDateTime', 6, 'INSERT', 0, 0, 0, 0, 'input', NULL, NULL, 1, 0, 1, '=', 'datetime', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (281, 26, 'updater', 'bigint', '更新者', 'updater', 'Long', NULL, 7, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
INSERT INTO gen_table_field (id, table_id, field_name, field_type, field_comment, attr_name, attr_type, package_name, sort, auto_fill, primary_pk, base_field, form_item, form_required, form_type, form_dict, form_validator, grid_item, grid_sort, query_item, query_type, query_form_type, create_time) VALUES (282, 26, 'update_time', 'datetime', '更新时间', 'updateTime', 'LocalDateTime', 'java.time.LocalDateTime', 8, 'INSERT_UPDATE', 0, 0, 0, 0, 'input', NULL, NULL, 0, 0, 0, '=', 'input', now());
commit;

View File

@ -0,0 +1,164 @@
CREATE TABLE iot_device (
id bigserial NOT NULL,
code varchar(255),
name varchar(255),
type int,
uid varchar(255),
secret varchar(255),
app_version varchar(255),
battery_percent varchar(10),
temperature varchar(10),
status int,
running_status int DEFAULT 0,
protocol_type varchar(20),
up_time timestamp,
down_time timestamp,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE iot_device IS '设备表';
COMMENT ON COLUMN iot_device.id IS 'id';
COMMENT ON COLUMN iot_device.code IS '编码';
COMMENT ON COLUMN iot_device.name IS '名称';
COMMENT ON COLUMN iot_device.type IS '设备类型1.手持设备2.柜体3传感设备';
COMMENT ON COLUMN iot_device.uid IS '唯一标识码';
COMMENT ON COLUMN iot_device.secret IS '设备密钥';
COMMENT ON COLUMN iot_device.app_version IS 'App版本号';
COMMENT ON COLUMN iot_device.battery_percent IS '电池电量百分比';
COMMENT ON COLUMN iot_device.status IS '状态0禁用1启用';
COMMENT ON COLUMN iot_device.running_status IS '运行状态0.离线状态 1.在线状态 2.正常待机 3.用户使用中 4.OTA升级中';
COMMENT ON COLUMN iot_device.protocol_type IS '协议类型';
COMMENT ON COLUMN iot_device.up_time IS '上线时间';
COMMENT ON COLUMN iot_device.down_time IS '下线时间';
COMMENT ON COLUMN iot_device.tenant_id IS '租户ID';
COMMENT ON COLUMN iot_device.version IS '版本号';
COMMENT ON COLUMN iot_device.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN iot_device.creator IS '创建者';
COMMENT ON COLUMN iot_device.create_time IS '创建时间';
COMMENT ON COLUMN iot_device.updater IS '更新者';
COMMENT ON COLUMN iot_device.update_time IS '更新时间';
CREATE TABLE iot_device_event_log (
id bigserial NOT NULL,
device_id int8,
event_type int,
event_uid varchar(50),
event_payload varchar(1000),
event_time timestamp,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE iot_device_event_log IS '设备事件日志';
COMMENT ON COLUMN iot_device_event_log.id IS 'id';
COMMENT ON COLUMN iot_device_event_log.device_id IS '设备id';
COMMENT ON COLUMN iot_device_event_log.event_type IS '事件类型';
COMMENT ON COLUMN iot_device_event_log.event_uid IS '事件标识id';
COMMENT ON COLUMN iot_device_event_log.event_payload IS '事件数据';
COMMENT ON COLUMN iot_device_event_log.event_time IS '事件时间';
COMMENT ON COLUMN iot_device_event_log.tenant_id IS '租户ID';
COMMENT ON COLUMN iot_device_event_log.version IS '版本号';
COMMENT ON COLUMN iot_device_event_log.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN iot_device_event_log.creator IS '创建者';
COMMENT ON COLUMN iot_device_event_log.create_time IS '创建时间';
COMMENT ON COLUMN iot_device_event_log.updater IS '更新者';
COMMENT ON COLUMN iot_device_event_log.update_time IS '更新时间';
CREATE TABLE iot_device_service_log (
id bigserial NOT NULL,
device_id int8,
service_type int,
service_uid varchar(50),
service_payload varchar(1000),
service_time timestamp,
tenant_id int8,
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE iot_device_service_log IS '设备服务日志';
COMMENT ON COLUMN iot_device_service_log.id IS 'id';
COMMENT ON COLUMN iot_device_service_log.device_id IS '设备id';
COMMENT ON COLUMN iot_device_service_log.service_type IS '服务类型';
COMMENT ON COLUMN iot_device_service_log.service_uid IS '服务标识id';
COMMENT ON COLUMN iot_device_service_log.service_payload IS '服务数据';
COMMENT ON COLUMN iot_device_service_log.service_time IS '服务时间';
COMMENT ON COLUMN iot_device_service_log.tenant_id IS '租户ID';
COMMENT ON COLUMN iot_device_service_log.version IS '版本号';
COMMENT ON COLUMN iot_device_service_log.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN iot_device_service_log.creator IS '创建者';
COMMENT ON COLUMN iot_device_service_log.create_time IS '创建时间';
COMMENT ON COLUMN iot_device_service_log.updater IS '更新者';
INSERT INTO iot_device (id, code, name, type, uid, secret, app_version, battery_percent, temperature, status, running_status, protocol_type, up_time, down_time, tenant_id, creator, create_time, updater, update_time, version, deleted) VALUES (1, 'test-tcp', 'testTCP', 1, 'test12345678', '123456', NULL, NULL, NULL, 1, 1, 'TCP', now(), NULL, NULL, 10000, now(), 10000, now(), 0, 0);
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1601, NULL, '物联网平台', NULL, NULL, 0, 0, 'icon-printer-fill', 6, 0, 0, 10000,now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1602, 1601, '设备列表', 'iot/device/index', NULL, 0, 0, 'icon-menu', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1603, 1602, '查看', '', 'iot:device:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1604, 1602, '新增', '', 'iot:device:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1605, 1602, '修改', '', 'iot:device:update,iot:device:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1606, 1602, '删除', '', 'iot:device:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1607, 1602, '下发指令', '', 'iot:device:send', 1, 0, '', 4, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1608, 1602, '上报数据', '', 'iot:device:report', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1609, 1602, '设备事件日志', '', 'iot:device_event_log:page', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1610, 1602, '设备服务日志', '', 'iot:device_service_log:page', 1, 0, '', 5, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUE(1601, 'device_type', '设备类型', '设备类型', 0, 10000, 0, 0, 10000, now(), 10000, now() );
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1601, '手持设备', '1', 'primary', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1601, '柜体', '2', 'primary', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1601, '传感设备', '3', 'primary', '', 2, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES(1602, 'device_running_status', '设备运行状态', '设备运行状态:离线|在线|待机|使用中|OTA升级中', 0, 10000, 0, 0, 10000, now(), 10000, now() );
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1602, '离线状态', '0', 'danger', NULL, 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1602, '在线状态', '1', 'success', NULL, 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES(1603, 'device_command', '设备指令', '设备服务具备的功能', 0, 10000, 0, 0, 10000, now(), 10000, now() );
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1603, '远程锁定', 'LOCK', NULL, NULL, 0, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1603, '远程解锁', 'UNLOCK', NULL, NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1603, '登录', 'SIGN_ON', NULL, NULL, 2, NULL, 0, 1, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1603, '登出', 'SIGN_OFF', NULL, NULL, 3, NULL, 0, 1, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1603, 'OTA升级', 'OTA_UPGRADE', NULL, NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES(1604, 'device_property', '设备属性', '设备通用属性:运行状态|APP版本|电池电量百分比|温度', 0, 10000, 0, 0, 10000, now(), 10000, now() );
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1604, '运行状态', 'RUNNING_STATUS', NULL, NULL, 0, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1604, 'APP版本', 'APP_VERSION', NULL, NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1604, '电池电量百分比', 'BATTERY_PERCENT', NULL, NULL, 2, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1604, '温度', 'TEMPERATURE', NULL, NULL, 3, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type,dict_name,remark,sort,tenant_id,version,deleted,creator,create_time,updater,update_time )VALUES(1605, 'device_event_type', '事件类型', '事件日志类型', 0, 10000, 0, 0, 10000, now(), 10000, now() );
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '下线', 'OFFLINE', 'danger', NULL, 1, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '上线', 'ONLINE', 'primary', NULL, 2, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '登录', 'SIGN_ON', 'primary', NULL, 3, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '退出登录', 'SIGN_OFF', 'danger', NULL, 4, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, 'OTA升级', 'OTA_UPGRADE', 'primary', NULL, 5, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '设备远程锁定', 'LOCK', 'primary', NULL, 6, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '设备远程解锁', 'UNLOCK', 'primary', NULL,7, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, 'APP版本信息', 'APP_VERSION_REPORT', 'primary', NULL, 8, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '电池电量', 'BATTERY_PERCENT_REPORT', 'primary', NULL, 9, NULL, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1605, '温度', 'TEMPERATURE_REPORT', 'primary', NULL, 0, NULL, 10, 0, 10000, now(), 10000, now());
select setval('sys_menu_id_seq', (select max(id) from sys_menu));
select setval('sys_dict_type_id_seq', (select max(id) from sys_dict_type));

View File

@ -0,0 +1,35 @@
CREATE TABLE member_user
(
id bigserial NOT NULL,
nick_name varchar(100) NOT NULL,
mobile varchar(20) NOT NULL,
avatar varchar(200),
birthday timestamp,
gender int,
openid varchar(200),
last_login_ip varchar(100),
last_login_time timestamp,
remark varchar(500),
tenant_id int8,
status int,
version int,
deleted int,
create_time timestamp,
primary key (id)
);
COMMENT ON TABLE member_user IS '会员管理';
COMMENT ON COLUMN member_user.id IS 'id';
COMMENT ON COLUMN member_user.nick_name IS '昵称';
COMMENT ON COLUMN member_user.mobile IS '手机号';
COMMENT ON COLUMN member_user.avatar IS '头像';
COMMENT ON COLUMN member_user.birthday IS '出生日期';
COMMENT ON COLUMN member_user.gender IS '性别 0男 1女 2未知';
COMMENT ON COLUMN member_user.openid IS '第三方平台,唯一标识';
COMMENT ON COLUMN member_user.last_login_ip IS '最后登录IP';
COMMENT ON COLUMN member_user.last_login_time IS '最后登录时间';
COMMENT ON COLUMN member_user.remark IS '备注';
COMMENT ON COLUMN member_user.status IS '状态 0禁用 1启用';
COMMENT ON COLUMN member_user.version IS '版本号';
COMMENT ON COLUMN member_user.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN member_user.create_time IS '创建时间';

View File

@ -0,0 +1,7 @@
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1301, 33, '系统监控', '', '', 0, 0, 'icon-Report', 10, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1302, 1301, '服务监控', 'monitor/server/index', 'monitor:server:all', 0, 0, 'icon-sever', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1304, 1301, '缓存监控', 'monitor/cache/index', 'monitor:cache:all', 0, 0, 'icon-fund-fill', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1305, 1301, '在线用户', 'monitor/user/index', 'monitor:user:all', 0, 0, 'icon-user', 3, 0, 0, 10000, now(), 10000, now());
commit;

View File

@ -0,0 +1,272 @@
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1201, 1, '定时任务', 'quartz/schedule/index', NULL, 0, 0, 'icon-reloadtime', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1202, 1201, '查看', '', 'schedule:page', 1, 0, '', 0, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1203, 1201, '新增', '', 'schedule:save', 1, 0, '', 1, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1204, 1201, '修改', '', 'schedule:update,schedule:info', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1205, 1201, '删除', '', 'schedule:delete', 1, 0, '', 3, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1206, 1201, '立即运行', '', 'schedule:run', 1, 0, '', 2, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_menu (id, pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1207, 1201, '日志', '', 'schedule:log', 1, 0, '', 4, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1201, 'schedule_group', '任务组名', '定时任务', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1201, '默认', 'default', '', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1201, '系统', 'system', '', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_type (id, dict_type, dict_name, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1202, 'schedule_status', '状态', '定时任务', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1202, '暂停', '0', 'danger', '', 0, 10000, 0, 0, 10000, now(), 10000, now());
INSERT INTO sys_dict_data (dict_type_id, dict_label, dict_value, label_class, remark, sort, tenant_id, version, deleted, creator, create_time, updater, update_time) VALUES (1202, '正常', '1', 'primary', '', 1, 10000, 0, 0, 10000, now(), 10000, now());
select setval('sys_menu_id_seq', (select max(id) from sys_menu));
select setval('sys_dict_type_id_seq', (select max(id) from sys_dict_type));
select setval('sys_dict_data_id_seq', (select max(id) from sys_dict_data));
DROP TABLE IF EXISTS schedule_job;
DROP TABLE IF EXISTS schedule_job_log;
CREATE TABLE schedule_job (
id bigserial NOT NULL,
job_name varchar(200),
job_group varchar(100),
bean_name varchar(200),
method varchar(100),
params varchar(2000),
cron_expression varchar(100),
status int,
concurrent int,
remark varchar(255),
version int,
deleted int,
creator int8,
create_time timestamp,
updater int8,
update_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE schedule_job IS '定时任务';
COMMENT ON COLUMN schedule_job.id IS 'id';
COMMENT ON COLUMN schedule_job.job_name IS '名称';
COMMENT ON COLUMN schedule_job.job_group IS '分组';
COMMENT ON COLUMN schedule_job.bean_name IS 'spring bean名称';
COMMENT ON COLUMN schedule_job.method IS '执行方法';
COMMENT ON COLUMN schedule_job.params IS '参数';
COMMENT ON COLUMN schedule_job.cron_expression IS 'cron表达式';
COMMENT ON COLUMN schedule_job.status IS '状态 0暂停 1正常';
COMMENT ON COLUMN schedule_job.concurrent IS '是否并发 0禁止 1允许';
COMMENT ON COLUMN schedule_job.remark IS '备注';
COMMENT ON COLUMN schedule_job.version IS '版本号';
COMMENT ON COLUMN schedule_job.deleted IS '删除标识 0正常 1已删除';
COMMENT ON COLUMN schedule_job.creator IS '创建者';
COMMENT ON COLUMN schedule_job.create_time IS '创建时间';
COMMENT ON COLUMN schedule_job.updater IS '更新者';
COMMENT ON COLUMN schedule_job.update_time IS '更新时间';
CREATE TABLE schedule_job_log (
id bigserial NOT NULL,
job_id int8 NOT NULL,
job_name varchar(200),
job_group varchar(100),
bean_name varchar(200),
method varchar(100),
params varchar(2000),
status int,
error varchar(2000),
times int8 NOT NULL,
create_time timestamp,
PRIMARY KEY (id)
);
COMMENT ON TABLE schedule_job_log IS '定时任务日志';
COMMENT ON COLUMN schedule_job_log.id IS 'id';
COMMENT ON COLUMN schedule_job_log.job_id IS '任务id';
COMMENT ON COLUMN schedule_job_log.job_name IS '任务名称';
COMMENT ON COLUMN schedule_job_log.job_group IS '任务组名';
COMMENT ON COLUMN schedule_job_log.bean_name IS 'spring bean名称';
COMMENT ON COLUMN schedule_job_log.method IS '执行方法';
COMMENT ON COLUMN schedule_job_log.params IS '参数';
COMMENT ON COLUMN schedule_job_log.status IS '任务状态 0失败 1成功';
COMMENT ON COLUMN schedule_job_log.error IS '异常信息';
COMMENT ON COLUMN schedule_job_log.times IS '耗时(单位:毫秒)';
COMMENT ON COLUMN schedule_job_log.create_time IS '创建时间';
INSERT INTO schedule_job (job_name, job_group, bean_name, method, params, cron_expression, status, concurrent, remark, version, deleted, creator, create_time, updater, update_time) VALUES ('测试任务', 'system', 'testTask', 'run', '123', '0 * * * * ? *', 0, 0, '', 14, 0, 10000, now(), 10000, now());
-- ----------------------------------------------------------
-- 以下为Quartz框架自带的表结构
-- ----------------------------------------------------------
CREATE TABLE qrtz_job_details
(
SCHED_NAME VARCHAR(120) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL,
JOB_CLASS_NAME VARCHAR(250) NOT NULL,
IS_DURABLE BOOL NOT NULL,
IS_NONCONCURRENT BOOL NOT NULL,
IS_UPDATE_DATA BOOL NOT NULL,
REQUESTS_RECOVERY BOOL NOT NULL,
JOB_DATA BYTEA NULL,
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
);
CREATE TABLE qrtz_triggers
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL,
NEXT_FIRE_TIME BIGINT NULL,
PREV_FIRE_TIME BIGINT NULL,
PRIORITY INTEGER NULL,
TRIGGER_STATE VARCHAR(16) NOT NULL,
TRIGGER_TYPE VARCHAR(8) NOT NULL,
START_TIME BIGINT NOT NULL,
END_TIME BIGINT NULL,
CALENDAR_NAME VARCHAR(200) NULL,
MISFIRE_INSTR SMALLINT NULL,
JOB_DATA BYTEA NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
);
CREATE TABLE qrtz_simple_triggers
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
REPEAT_COUNT BIGINT NOT NULL,
REPEAT_INTERVAL BIGINT NOT NULL,
TIMES_TRIGGERED BIGINT NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE qrtz_cron_triggers
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
CRON_EXPRESSION VARCHAR(120) NOT NULL,
TIME_ZONE_ID VARCHAR(80),
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE qrtz_simprop_triggers
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
STR_PROP_1 VARCHAR(512) NULL,
STR_PROP_2 VARCHAR(512) NULL,
STR_PROP_3 VARCHAR(512) NULL,
INT_PROP_1 INT NULL,
INT_PROP_2 INT NULL,
LONG_PROP_1 BIGINT NULL,
LONG_PROP_2 BIGINT NULL,
DEC_PROP_1 NUMERIC(13,4) NULL,
DEC_PROP_2 NUMERIC(13,4) NULL,
BOOL_PROP_1 BOOL NULL,
BOOL_PROP_2 BOOL NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE qrtz_blob_triggers
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
BLOB_DATA BYTEA NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE qrtz_calendars
(
SCHED_NAME VARCHAR(120) NOT NULL,
CALENDAR_NAME VARCHAR(200) NOT NULL,
CALENDAR BYTEA NOT NULL,
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
);
CREATE TABLE qrtz_paused_trigger_grps
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
);
CREATE TABLE qrtz_fired_triggers
(
SCHED_NAME VARCHAR(120) NOT NULL,
ENTRY_ID VARCHAR(95) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL,
FIRED_TIME BIGINT NOT NULL,
SCHED_TIME BIGINT NOT NULL,
PRIORITY INTEGER NOT NULL,
STATE VARCHAR(16) NOT NULL,
JOB_NAME VARCHAR(200) NULL,
JOB_GROUP VARCHAR(200) NULL,
IS_NONCONCURRENT BOOL NULL,
REQUESTS_RECOVERY BOOL NULL,
PRIMARY KEY (SCHED_NAME,ENTRY_ID)
);
CREATE TABLE qrtz_scheduler_state
(
SCHED_NAME VARCHAR(120) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL,
LAST_CHECKIN_TIME BIGINT NOT NULL,
CHECKIN_INTERVAL BIGINT NOT NULL,
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
);
CREATE TABLE qrtz_locks
(
SCHED_NAME VARCHAR(120) NOT NULL,
LOCK_NAME VARCHAR(40) NOT NULL,
PRIMARY KEY (SCHED_NAME,LOCK_NAME)
);
create index idx_qrtz_j_req_recovery on qrtz_job_details(SCHED_NAME,REQUESTS_RECOVERY);
create index idx_qrtz_j_grp on qrtz_job_details(SCHED_NAME,JOB_GROUP);
create index idx_qrtz_t_j on qrtz_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
create index idx_qrtz_t_jg on qrtz_triggers(SCHED_NAME,JOB_GROUP);
create index idx_qrtz_t_c on qrtz_triggers(SCHED_NAME,CALENDAR_NAME);
create index idx_qrtz_t_g on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP);
create index idx_qrtz_t_state on qrtz_triggers(SCHED_NAME,TRIGGER_STATE);
create index idx_qrtz_t_n_state on qrtz_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
create index idx_qrtz_t_n_g_state on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
create index idx_qrtz_t_next_fire_time on qrtz_triggers(SCHED_NAME,NEXT_FIRE_TIME);
create index idx_qrtz_t_nft_st on qrtz_triggers(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
create index idx_qrtz_t_nft_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
create index idx_qrtz_t_nft_st_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME);
create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
commit;

11
deploy/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
# 构建镜像执行命令【docker build -t drone-ops:1.0 .】
FROM eclipse-temurin:17-jre
LABEL maintainer="BDZL"
# 设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT ["java", "-server", "-Xms1024M", "-Xmx1024M", "-Djava.security.egd=file:/dev/./urandom", "-Dfile.encoding=UTF-8", "-XX:+HeapDumpOnOutOfMemoryError", "-jar", "/app/app.jar" ]

View File

@ -0,0 +1,51 @@
version: '3.9'
# 通过 Docker Compose 构建 EMQX 集群
services:
maku-emqx1:
image: emqx:5.7.1
container_name: maku-emqx1
environment:
- "EMQX_NODE_NAME=emqx@node1.emqx.io"
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io,emqx@node2.emqx.io]"
healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx", "ctl", "status"]
interval: 5s
timeout: 25s
retries: 5
networks:
emqx-bridge:
aliases:
- node1.emqx.io
ports:
- 1883:1883
- 8083:8083
- 8084:8084
- 8883:8883
- 18083:18083
# 如果需要持久 Docker 容器 ,请将以下目录挂载到容器外部,这样即使容器被删除数据也不会丢失
volumes:
- /work/www/emqx/data:/opt/emqx/data
- /work/www/emqx/log:/opt/emqx/log
# maku-emqx2:
# image: emqx:5.7.1
# container_name: maku-emqx2
# environment:
# - "EMQX_NODE_NAME=emqx@node2.emqx.io"
# - "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
# - "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io,emqx@node2.emqx.io]"
# healthcheck:
# test: ["CMD", "/opt/emqx/bin/emqx", "ctl", "status"]
# interval: 5s
# timeout: 25s
# retries: 5
# networks:
# emqx-bridge:
# aliases:
# - node2.emqx.io
# volumes:
# - $PWD/emqx2_data:/opt/emqx/data
networks:
emqx-bridge:
driver: bridge

11
deploy/docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3.9'
services:
drone-ops:
image: drone-ops:1.0
container_name: drone-ops
ports:
- 8090:8090
environment:
- spring.profiles.active=dev
volumes:
- /usr/dj/drone-ops/drone-ops-server.jar:/app/app.jar

18
drone-ops-api/pom.xml Normal file
View File

@ -0,0 +1,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.bdzl</groupId>
<artifactId>drone-ops</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drone-ops-api</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,61 @@
package com.bdzl.api.module.system;
import java.util.Map;
/**
* 短信服务API
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface SmsApi {
/**
* 发送短信
*
* @param mobile 手机号
* @param params 参数
* @return 是否发送成功
*/
boolean send(String mobile, Map<String, String> params);
/**
* 发送短信
*
* @param groupName 分组名称
* @param mobile 手机号
* @param params 参数
* @return 是否发送成功
*/
boolean send(String groupName, String mobile, Map<String, String> params);
/**
* 发送短信
*
* @param mobile 手机号
* @param key 参数KEY
* @param value 参数Value
* @return 是否发送成功
*/
boolean sendCode(String mobile, String key, String value);
/**
* 发送短信
*
* @param groupName 分组名称
* @param mobile 手机号
* @param key 参数KEY
* @param value 参数Value
* @return 是否发送成功
*/
boolean sendCode(String groupName, String mobile, String key, String value);
/**
* 效验短信验证码
*
* @param mobile 手机号
* @param code 验证码
* @return 是否效验成功
*/
boolean verifyCode(String mobile, String code);
}

View File

@ -0,0 +1,53 @@
package com.bdzl.api.module.system;
import java.io.InputStream;
/**
* 存储服务API
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface StorageApi {
/**
* 根据文件名生成带时间戳的新文件名
*
* @param fileName 文件名
* @return 返回带时间戳的文件名
*/
String getNewFileName(String fileName);
/**
* 生成路径不包含文件名
*
* @return 返回生成的路径
*/
String getPath();
/**
* 根据文件名生成路径
*
* @param fileName 文件名
* @return 生成文件路径
*/
String getPath(String fileName);
/**
* 文件上传
*
* @param data 文件字节数组
* @param path 文件路径包含文件名
* @return 返回http地址
*/
String upload(byte[] data, String path);
/**
* 文件上传
*
* @param inputStream 字节流
* @param path 文件路径包含文件名
* @return 返回http地址
*/
String upload(InputStream inputStream, String path);
}

115
drone-ops-framework/pom.xml Normal file
View File

@ -0,0 +1,115 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.bdzl</groupId>
<artifactId>drone-ops</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drone-ops-framework</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
</dependency>
<!-- 为了解决knife4j不支持springboot3.4 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
</dependency>
<dependency>
<artifactId>okio</artifactId>
<groupId>com.squareup.okio</groupId>
</dependency>
<dependency>
<groupId>com.fhs-opensource</groupId>
<artifactId>easy-trans-mybatis-plus-extend</artifactId>
</dependency>
<dependency>
<groupId>com.fhs-opensource</groupId>
<artifactId>easy-trans-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
<dependency>
<groupId>org.lionsoul</groupId>
<artifactId>ip2region</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,149 @@
package com.bdzl.framework.common.cache;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* Redis Cache
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Component
public class RedisCache {
@Resource
private RedisTemplate<String, Object> redisTemplate;
/**
* 默认过期时长为24小时单位
*/
public final static long DEFAULT_EXPIRE = 60 * 60 * 24L;
/**
* 过期时长为1小时单位
*/
public final static long HOUR_ONE_EXPIRE = 60 * 60 * 1L;
/**
* 过期时长为6小时单位
*/
public final static long HOUR_SIX_EXPIRE = 60 * 60 * 6L;
/**
* 不设置过期时长
*/
public final static long NOT_EXPIRE = -1L;
public void set(String key, Object value, long expire) {
redisTemplate.opsForValue().set(key, value);
if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
public void set(String key, Object value) {
redisTemplate.opsForValue().set(key, value);
}
public Object get(String key, long expire) {
Object value = redisTemplate.opsForValue().get(key);
if (expire != NOT_EXPIRE) {
expire(key, expire);
}
return value;
}
public Object get(String key) {
return get(key, NOT_EXPIRE);
}
public Long increment(String key) {
return redisTemplate.opsForValue().increment(key);
}
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
public Set<String> keys(String pattern) {
return redisTemplate.keys(pattern);
}
public void delete(String key) {
redisTemplate.delete(key);
}
public void delete(Collection<String> keys) {
redisTemplate.delete(keys);
}
public Object hGet(String key, String field) {
return redisTemplate.opsForHash().get(key, field);
}
public Map<String, Object> hGetAll(String key) {
HashOperations<String, String, Object> hashOperations = redisTemplate.opsForHash();
return hashOperations.entries(key);
}
public void hMSet(String key, Map<String, Object> map) {
hMSet(key, map, DEFAULT_EXPIRE);
}
public void hMSet(String key, Map<String, Object> map, long expire) {
redisTemplate.opsForHash().putAll(key, map);
if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
public void hSet(String key, String field, Object value) {
hSet(key, field, value, DEFAULT_EXPIRE);
}
public void hSet(String key, String field, Object value, long expire) {
redisTemplate.opsForHash().put(key, field, value);
if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
public void expire(String key, long expire) {
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
}
public void expireAt(String key, Date expire) {
redisTemplate.expireAt(key, expire);
}
public Long getExpire(String key) {
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
public void hDel(String key, Object... fields) {
redisTemplate.opsForHash().delete(key, fields);
}
public void leftPush(String key, Object value) {
leftPush(key, value, DEFAULT_EXPIRE);
}
public void leftPush(String key, Object value, long expire) {
redisTemplate.opsForList().leftPush(key, value);
if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
public Object rightPop(String key) {
return redisTemplate.opsForList().rightPop(key);
}
}

View File

@ -0,0 +1,29 @@
package com.bdzl.framework.common.cache;
/**
* Redis Key管理
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class RedisKeys {
/**
* 验证码Key
*/
public static String getCaptchaKey(String key) {
return "sys:captcha:" + key;
}
/**
* accessToken Key
*/
public static String getAccessTokenKey(String accessToken) {
return "sys:token:" + accessToken;
}
public static String getLogKey() {
return "sys:log";
}
}

View File

@ -0,0 +1,41 @@
package com.bdzl.framework.common.config;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.ser.std.NumberSerializer;
import java.io.IOException;
/**
* 解决js精度丢失问题
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@JacksonStdImpl
public class BigNumberSerializer extends NumberSerializer {
/**
* JS Number.MAX_SAFE_INTEGER Number.MIN_SAFE_INTEGER
*/
private static final long MAX_SAFE_INTEGER = 9007199254740991L;
private static final long MIN_SAFE_INTEGER = -9007199254740991L;
/**
* 提供实例
*/
public static final BigNumberSerializer INSTANCE = new BigNumberSerializer(Number.class);
public BigNumberSerializer(Class<? extends Number> rawType) {
super(rawType);
}
@Override
public void serialize(Number value, JsonGenerator gen, SerializerProvider provider) throws IOException {
// 超出范围 序列化位字符串
if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) {
super.serialize(value, gen, provider);
} else {
gen.writeString(value.toString());
}
}
}

View File

@ -0,0 +1,29 @@
package com.bdzl.framework.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
* 跨域配置
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Configuration
public class CorsConfig {
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowCredentials(true);
corsConfiguration.addAllowedHeader("*");
corsConfiguration.addAllowedOriginPattern("*");
corsConfiguration.addAllowedMethod("*");
source.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(source);
}
}

View File

@ -0,0 +1,49 @@
package com.bdzl.framework.common.config;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
@Configuration
public class JacksonConfig {
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public Jackson2ObjectMapperBuilderCustomizer customJackson() {
return builder -> {
builder.serializerByType(LocalDateTime.class,
new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
builder.serializerByType(LocalDate.class,
new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
builder.serializerByType(LocalTime.class,
new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
builder.deserializerByType(LocalDateTime.class,
new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
builder.deserializerByType(LocalDate.class,
new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
builder.deserializerByType(LocalTime.class,
new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
// builder.serializationInclusion(JsonInclude.Include.NON_NULL);
// 避免Long精度丢失超过JS最大精度使用String类型
builder.serializerByType(Long.class, BigNumberSerializer.INSTANCE);
builder.failOnUnknownProperties(false);
builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
};
}
}

View File

@ -0,0 +1,48 @@
package com.bdzl.framework.common.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
/**
* Redis配置
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Configuration
public class RedisConfig {
public GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.registerModule(new JavaTimeModule());
objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
return new GenericJackson2JsonRedisSerializer(objectMapper);
}
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
// Key HashKey使用String序列化
template.setKeySerializer(RedisSerializer.string());
template.setHashKeySerializer(RedisSerializer.string());
// Value HashValue使用Json序列化
template.setValueSerializer(genericJackson2JsonRedisSerializer());
template.setHashValueSerializer(genericJackson2JsonRedisSerializer());
template.setConnectionFactory(factory);
template.afterPropertiesSet();
return template;
}
}

View File

@ -0,0 +1,52 @@
package com.bdzl.framework.common.constant;
/**
* 常量
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface Constant {
/**
* 根节点标识
*/
Long ROOT = 0L;
/**
* 当前页码
*/
String PAGE = "page";
/**
* 数据权限
*/
String DATA_SCOPE = "dataScope";
/**
* 超级管理员
*/
Integer SUPER_ADMIN = 1;
/**
* 禁用
*/
Integer DISABLE = 0;
/**
* 启用
*/
Integer ENABLE = 1;
/**
* 失败
*/
Integer FAIL = 0;
/**
* 成功
*/
Integer SUCCESS = 1;
/**
* OK
*/
String OK = "OK";
/**
* pgsql的driver
*/
String PGSQL_DRIVER = "org.postgresql.Driver";
}

View File

@ -0,0 +1,41 @@
package com.bdzl.framework.common.excel;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import com.bdzl.framework.common.utils.DateUtils;
import java.util.Date;
/**
* 日期转换
*
* @author eden
*/
public class DateConverter implements Converter<Date> {
@Override
public Class<Date> supportJavaTypeKey() {
return Date.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Date convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
String dateString = cellData.getStringValue();
return dateString == null ? null : DateUtils.parse(dateString, DateUtils.DATE_TIME_PATTERN);
}
@Override
public WriteCellData<Date> convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
String dateValue = DateUtils.format(value, DateUtils.DATE_TIME_PATTERN);
return new WriteCellData<>(dateValue);
}
}

View File

@ -0,0 +1,61 @@
package com.bdzl.framework.common.excel;
import cn.idev.excel.context.AnalysisContext;
import cn.idev.excel.event.AnalysisEventListener;
import java.util.LinkedList;
import java.util.List;
/**
* excel读取监听器
*
* @author eden
*/
public class ExcelDataListener<T> extends AnalysisEventListener<T> {
/**
* 定义一个保存Excel所有记录的集合
*/
private final List<T> list = new LinkedList<>();
/**
* 回调接口
*/
private final ExcelFinishCallBack<T> callBack;
/**
* 构造 ExcelFinishCallBack
*
* @param callBack ExcelFinishCallBack
*/
public ExcelDataListener(ExcelFinishCallBack<T> callBack) {
this.callBack = callBack;
}
/**
* 这个每一条数据解析都会来调用
* 在这里可以做一些其他的操作过滤分批入库... 就考自己去拓展了
*
* @param data one row value. is same as {@link AnalysisContext#readRowHolder()}
* @param context context
*/
@Override
public void invoke(T data, AnalysisContext context) {
list.add(data);
if (list.size() == 500) {
this.callBack.doSaveBatch(list);
list.clear();
}
}
/**
* 所有数据解析完成了 都会来调用
* 解析完成之后将所有数据存入回调接口中
*
* @param context context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
this.callBack.doSaveBatch(list);
}
}

View File

@ -0,0 +1,21 @@
package com.bdzl.framework.common.excel;
import java.util.List;
/**
* excel读取数据完成
*
* @param <T> the type parameter
* @author eden
*/
public interface ExcelFinishCallBack<T> {
/**
* Do save batch.
*
* @param result the result
*/
default void doSaveBatch(List<T> result) {
}
}

View File

@ -0,0 +1,43 @@
package com.bdzl.framework.common.excel;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import com.bdzl.framework.common.utils.DateUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* 日期转换
*
* @author eden
*/
public class LocalDateTimeConverter implements Converter<LocalDateTime> {
@Override
public Class<LocalDateTime> supportJavaTypeKey() {
return LocalDateTime.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public LocalDateTime convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
String dateString = cellData.getStringValue();
return dateString == null ? null : LocalDateTimeUtil.parse(dateString, DateTimeFormatter.ofPattern(DateUtils.DATE_TIME_PATTERN));
}
@Override
public WriteCellData<LocalDateTime> convertToExcelData(LocalDateTime value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
String dateValue = LocalDateTimeUtil.format(value, DateUtils.DATE_TIME_PATTERN);
return new WriteCellData<>(dateValue);
}
}

View File

@ -0,0 +1,22 @@
package com.bdzl.framework.common.exception;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 错误编码
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Getter
@AllArgsConstructor
public enum ErrorCode {
UNAUTHORIZED(401, "还未授权,不能访问"),
FORBIDDEN(403, "没有权限,禁止访问"),
REFRESH_TOKEN_INVALID(400, "refresh_token 已失效"),
INTERNAL_SERVER_ERROR(500, "服务器异常,请稍后再试");
private final int code;
private final String msg;
}

View File

@ -0,0 +1,44 @@
package com.bdzl.framework.common.exception;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 自定义异常
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ServerException extends RuntimeException {
private static final long serialVersionUID = 1L;
private int code;
private String msg;
public ServerException(String msg) {
super(msg);
this.code = ErrorCode.INTERNAL_SERVER_ERROR.getCode();
this.msg = msg;
}
public ServerException(ErrorCode errorCode) {
super(errorCode.getMsg());
this.code = errorCode.getCode();
this.msg = errorCode.getMsg();
}
public ServerException(String msg, Throwable e) {
super(msg, e);
this.code = ErrorCode.INTERNAL_SERVER_ERROR.getCode();
this.msg = msg;
}
public ServerException(int code, String msg) {
super(msg);
this.code = code;
this.msg = msg;
}
}

View File

@ -0,0 +1,66 @@
package com.bdzl.framework.common.exception;
import lombok.extern.slf4j.Slf4j;
import com.bdzl.framework.common.utils.Result;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.resource.NoResourceFoundException;
/**
* 异常处理器
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Slf4j
@RestControllerAdvice
public class ServerExceptionHandler {
/**
* 处理自定义异常
*/
@ExceptionHandler(ServerException.class)
public Result<String> handleException(ServerException ex) {
return Result.error(ex.getCode(), ex.getMsg());
}
/**
* SpringMVC参数绑定Validator校验不正确
*/
@ExceptionHandler(BindException.class)
public Result<String> bindException(BindException ex) {
FieldError fieldError = ex.getFieldError();
assert fieldError != null;
return Result.error(fieldError.getDefaultMessage());
}
@ExceptionHandler(NoResourceFoundException.class)
public ResponseEntity<String> handleResourceNotFoundException(NoResourceFoundException e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("404 Not Found: " + e.getResourcePath());
}
@ExceptionHandler(AccessDeniedException.class)
public Result<String> handleAccessDeniedException(Exception ex) {
return Result.error(ErrorCode.FORBIDDEN);
}
@ExceptionHandler(IllegalArgumentException.class)
public Result<String> handleIllegalArgumentException(Exception ex) {
return Result.error(ex.getMessage());
}
@ExceptionHandler(Exception.class)
public Result<String> handleException(Exception ex) {
log.error(ex.getMessage(), ex);
return Result.error(ErrorCode.INTERNAL_SERVER_ERROR);
}
}

View File

@ -0,0 +1,32 @@
package com.bdzl.framework.common.query;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
/**
* 查询公共参数
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
public class Query {
@NotNull(message = "页码不能为空")
@Min(value = 1, message = "页码最小值为 1")
@Schema(description = "当前页码", required = true)
Integer page;
@NotNull(message = "每页条数不能为空")
@Range(min = 1, max = 1000, message = "每页条数,取值范围 1-1000")
@Schema(description = "每页条数", required = true)
Integer limit;
@Schema(description = "排序字段")
String order;
@Schema(description = "是否升序")
boolean asc;
}

View File

@ -0,0 +1,59 @@
package com.bdzl.framework.common.utils;
import cn.hutool.http.HttpUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 获取真实地址
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Slf4j
public class AddressUtils {
// 实时查询
public static final String ADDRESS_URL = "https://whois.pconline.com.cn/ipJson.jsp";
public static final String UNKNOWN = "未知";
public static String getAddressByIP(String ip) {
// 内网
if (IpUtils.internalIp(ip)) {
return "内网IP";
}
try {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ip", ip);
paramMap.put("json", true);
String response = HttpUtil.get(ADDRESS_URL, paramMap);
if (StringUtils.isBlank(response)) {
log.error("根据IP获取地址异常 {}", ip);
return UNKNOWN;
}
Address address = JsonUtils.parseObject(response, Address.class);
return String.format("%s %s", address.getPro(), address.getCity());
} catch (Exception e) {
log.error("根据IP获取地址异常 {}", ip);
}
return UNKNOWN;
}
@Data
static class Address {
/**
*
*/
private String pro;
/**
*
*/
private String city;
}
}

View File

@ -0,0 +1,33 @@
package com.bdzl.framework.common.utils;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.bdzl.framework.common.exception.ServerException;
/**
* 校验工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class AssertUtils {
public static void isBlank(String str, String variable) {
if (StrUtil.isBlank(str)) {
throw new ServerException(variable + "不能为空");
}
}
public static void isNull(Object object, String variable) {
if (object == null) {
throw new ServerException(variable + "不能为空");
}
}
public static void isArrayEmpty(Object[] array, String variable) {
if(ArrayUtil.isEmpty(array)){
throw new ServerException(variable + "不能为空");
}
}
}

View File

@ -0,0 +1,73 @@
package com.bdzl.framework.common.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 日期处理
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class DateUtils {
/**
* 时间格式(yyyy-MM-dd)
*/
public final static String DATE_PATTERN = "yyyy-MM-dd";
/**
* 时间格式(yyyy-MM-dd HH:mm:ss)
*/
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
/**
* 日期格式化 日期格式为yyyy-MM-dd
*
* @param date 日期
* @return 返回yyyy-MM-dd格式日期
*/
public static String format(Date date) {
return format(date, DATE_PATTERN);
}
/**
* 日期格式化 日期格式为yyyy-MM-dd
*
* @param date 日期
* @param pattern 格式DateUtils.DATE_TIME_PATTERN
* @return 返回yyyy-MM-dd格式日期
*/
public static String format(Date date, String pattern) {
if (date != null) {
SimpleDateFormat df = new SimpleDateFormat(pattern);
return df.format(date);
}
return null;
}
/**
* 日期解析
*
* @param date 日期
* @param pattern 格式DateUtils.DATE_TIME_PATTERN
* @return 返回Date
*/
public static Date parse(String date, String pattern) {
try {
return new SimpleDateFormat(pattern).parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 日期是否过期
*/
public static boolean isExpired(LocalDateTime time) {
LocalDateTime now = LocalDateTime.now();
return now.isAfter(time);
}
}

View File

@ -0,0 +1,230 @@
package com.bdzl.framework.common.utils;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.idev.excel.FastExcel;
import cn.idev.excel.converters.longconverter.LongStringConverter;
import cn.idev.excel.support.ExcelTypeEnum;
import com.fhs.common.utils.ConverterUtils;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.util.ReflectUtils;
import com.fhs.core.trans.vo.TransPojo;
import com.fhs.trans.service.impl.DictionaryTransService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import com.bdzl.framework.common.excel.ExcelDataListener;
import com.bdzl.framework.common.excel.ExcelFinishCallBack;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
/**
* The type Excel utils.
* {@link <a href="https://idev.cn/fastexcel/zh-CN/docs/write/write_spring"></a>}
*
* @author eden
*/
@Slf4j
public class ExcelUtils {
/**
* 读取excel文件
*
* @param <T> 数据类型
* @param file excel文件
* @param head 列名
* @param callBack 回调 导入时传入定义好的回调接口excel数据解析完毕之后监听器将数据传入回调函数
* 这样调用工具类时可以通过回调函数获取导入的数据如果数据量过大可根据实际情况进行分配入库
*/
public static <T> void readAnalysis(MultipartFile file, Class<T> head, ExcelFinishCallBack<T> callBack) {
try {
FastExcel.read(file.getInputStream(), head, new ExcelDataListener<>(callBack)).sheet().doRead();
} catch (IOException e) {
log.error("readAnalysis error", e);
}
}
/**
* 读取excel文件
*
* @param <T> 数据类型
* @param file excel文件
* @param head 列名
* @param callBack 回调 导入时传入定义好的回调接口excel数据解析完毕之后监听器将数据传入回调函数
* 这样调用工具类时可以通过回调函数获取导入的数据如果数据量过大可根据实际情况进行分配入库
*/
public static <T> void readAnalysis(File file, Class<T> head, ExcelFinishCallBack<T> callBack) {
try {
FastExcel.read(new FileInputStream(file), head, new ExcelDataListener<>(callBack)).sheet().doRead();
} catch (IOException e) {
log.error("readAnalysis error", e);
}
}
/**
* 读取excel文件 同步
*
* @param <T> 数据类型
* @param file 文件
* @param clazz 模板类
* @return java.util.List
*/
public static <T> List<T> readSync(File file, Class<T> clazz) {
return readSync(file, clazz, 1, 0, ExcelTypeEnum.XLSX);
}
/**
* 读取excel文件 同步
*
* @param <T> 数据类型
* @param file 文件
* @param clazz 模板类
* @param rowNum 数据开始行 1
* @param sheetNo 第几张表
* @param excelType 数据表格式类型
* @return java.util.List list
*/
public static <T> List<T> readSync(File file, Class<T> clazz, Integer rowNum, Integer sheetNo, ExcelTypeEnum excelType) {
return FastExcel.read(file).headRowNumber(rowNum).excelType(excelType).head(clazz).sheet(sheetNo).doReadSync();
}
/**
* 导出数据到文件
*
* @param <T> 数据类型
* @param head 类名
* @param file 导入到文件
* @param data 数据
*/
public static <T> void excelExport(Class<T> head, File file, List<T> data) {
excelExport(head, file, "sheet1", data);
}
/**
* 导出数据到文件
*
* @param <T> 写入格式
* @param head 类名
* @param file 写入到文件
* @param sheetName sheet名称
* @param data 数据列表
*/
public static <T> void excelExport(Class<T> head, File file, String sheetName, List<T> data) {
try {
FastExcel.write(file, head).sheet(sheetName).registerConverter(new LongStringConverter()).doWrite(data);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 导出数据到web
* 文件下载失败了会返回一个有部分数据的Excel
*
* @param head 类名
* @param excelName excel名字
* @param sheetName sheet名称
* @param data 数据
*/
public static <T> void excelExport(Class<T> head, String excelName, String sheetName, List<T> data) {
try {
HttpServletResponse response = getExportResponse(excelName);
FastExcel.write(response.getOutputStream(), head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName)
.registerConverter(new LongStringConverter()).doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 导出数据到web
* 文件下载失败了会返回一个有部分数据的Excel
*
* @param head 类名
* @param excelName excel名字
* @param sheetName sheet名称
* @param data 数据
*/
public static <T> void excelExport(List<List<String>> head, String excelName, String sheetName, List<T> data) {
try {
HttpServletResponse response = getExportResponse(excelName);
FastExcel.write(response.getOutputStream()).head(head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName)
.registerConverter(new LongStringConverter()).doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static HttpServletResponse getExportResponse(String excelName) {
HttpServletResponse response = HttpContextUtils.getHttpServletResponse();
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setCharacterEncoding("UTF-8");
excelName += DateUtil.format(new Date(), "yyyyMMddHHmmss");
String fileName = URLUtil.encode(excelName, StandardCharsets.UTF_8);
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
return response;
}
/**
* 解析字典数据到字段上
* 比如 T中有 genderLabel字段 为男 需要给 gender 字段自动设置为0
*
* @param dataList 需要被反向解析的数据
*/
@SneakyThrows
public static <T extends TransPojo> void parseDict(List<T> dataList) {
//没有数据就不需要初始化
if (CollectionUtil.isEmpty(dataList)) {
return;
}
Class<? extends TransPojo> clazz = dataList.get(0).getClass();
//拿到所有需要反向翻译的字段
List<Field> fields = ReflectUtils.getAnnotationField(clazz, Trans.class);
//过滤出字典翻译
fields = fields.stream().filter(field -> TransType.DICTIONARY.equals(field.getAnnotation(Trans.class).type())).toList();
DictionaryTransService dictionaryTransService = SpringUtil.getBean(DictionaryTransService.class);
for (T data : dataList) {
for (Field field : fields) {
Trans trans = field.getAnnotation(Trans.class);
// key不能为空并且ref不为空的才自动处理
if (StrUtil.isAllNotBlank(trans.key(), trans.ref())) {
Field ref = ReflectUtils.getDeclaredField(clazz, trans.ref());
ref.setAccessible(true);
// 获取字典反向值
String value = dictionaryTransService.getDictionaryTransMap().get("un_trans:" + trans.key() + "_" + ref.get(data));
if (StringUtils.isBlank(value)) {
continue;
}
// 一般目标字段是int或者string字段 后面有添加单独抽离方法
if (Integer.class.equals(field.getType())) {
field.setAccessible(true);
field.set(data, ConverterUtils.toInteger(value));
} else {
field.setAccessible(true);
field.set(data, ConverterUtils.toString(value));
}
}
}
}
}
}

View File

@ -0,0 +1,32 @@
package com.bdzl.framework.common.utils;
import cn.hutool.core.io.IoUtil;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Exception工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class ExceptionUtils {
/**
* 获取异常信息
* @param e 异常
* @return 返回异常信息
*/
public static String getExceptionMessage(Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
e.printStackTrace(pw);
// 关闭IO流
IoUtil.close(pw);
IoUtil.close(sw);
return sw.toString();
}
}

View File

@ -0,0 +1,77 @@
package com.bdzl.framework.common.utils;
import cn.hutool.core.util.StrUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* Http
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class HttpContextUtils {
public static HttpServletRequest getHttpServletRequest() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
return null;
}
return ((ServletRequestAttributes) requestAttributes).getRequest();
}
public static HttpServletResponse getHttpServletResponse() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
return null;
}
return ((ServletRequestAttributes) requestAttributes).getResponse();
}
public static Map<String, String> getParameterMap(HttpServletRequest request) {
Enumeration<String> parameters = request.getParameterNames();
Map<String, String> params = new HashMap<>();
while (parameters.hasMoreElements()) {
String parameter = parameters.nextElement();
String value = request.getParameter(parameter);
if (StrUtil.isNotBlank(value)) {
params.put(parameter, value);
}
}
return params;
}
public static String getDomain() {
HttpServletRequest request = getHttpServletRequest();
return getDomain(request);
}
public static String getDomain(HttpServletRequest request) {
String domain = request.getHeader(HttpHeaders.ORIGIN);
if (StrUtil.isBlank(domain)) {
domain = request.getHeader(HttpHeaders.REFERER);
}
return StringUtils.removeEnd(domain, "/");
}
public static String getOrigin() {
HttpServletRequest request = getHttpServletRequest();
return request.getHeader(HttpHeaders.ORIGIN);
}
}

View File

@ -0,0 +1,238 @@
package com.bdzl.framework.common.utils;
import cn.hutool.core.util.StrUtil;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import com.bdzl.framework.common.exception.ServerException;
import org.lionsoul.ip2region.xdb.Searcher;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* IP地址 工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Slf4j
public class IpUtils {
private final static Searcher searcher;
static {
// ip地址库
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource resource = resolver.getResource("classpath:ip2region.xdb");
try {
searcher = Searcher.newWithBuffer(resource.getContentAsByteArray());
} catch (Exception e) {
log.error("ip2region 初始化异常", e);
throw new ServerException("ip2region 初始化异常", e);
}
}
public static String getAddressByIP(String ip) {
// 内网
if (IpUtils.internalIp(ip)) {
return "内网IP";
}
try {
String address = searcher.search(ip);
return address.replace("0|", "").replace("|0", "").replace("中国|", "");
} catch (Exception e) {
log.error("根据IP获取地址异常 {}", ip);
return "未知";
}
}
/**
* 获取客户端IP地址
*/
public static String getIpAddr(HttpServletRequest request) {
if (request == null) {
return "unknown";
}
String ip = request.getHeader("x-forwarded-for");
if (StrUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (StrUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (StrUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (StrUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Real-IP");
}
if (StrUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
}
/**
* 检查是否为内部IP地址
*
* @param ip IP地址
*/
public static boolean internalIp(String ip) {
byte[] addr = textToNumericFormatV4(ip);
return internalIp(addr) || "127.0.0.1".equals(ip);
}
/**
* 检查是否为内部IP地址
*
* @param addr byte地址
*/
private static boolean internalIp(byte[] addr) {
if (addr == null) return true;
// IPv6地址处理
if (addr.length == 16) {
return (addr[0] & 0xFE) == 0xFC; //RFC4193标准fc00::/7
}
// IPv4地址长度校验
if (addr.length != 4) return true;
final byte b0 = addr[0];
final byte b1 = addr[1];
// 10.0.0.0/8
if (b0 == 0x0A) return true;
// 172.16.0.0/12
if (b0 == (byte)0xAC) {
return (b1 >= 0x10 && b1 <= 0x1F);
}
// 192.168.0.0/16
return (b0 == (byte)0xC0) && (b1 == (byte)0xA8);
}
/**
* 将IPv4地址转换成字节
*
* @param text IPv4地址
* @return byte 字节
*/
public static byte[] textToNumericFormatV4(String text) {
if (StrUtil.isBlank(text)) {
return null;
}
byte[] bytes = new byte[4];
String[] elements = text.split("\\.", -1);
try {
long l;
int i;
switch (elements.length) {
case 1:
l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L)) {
return null;
}
bytes[0] = (byte) (int) (l >> 24 & 0xFF);
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 2:
l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) {
return null;
}
bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L)) {
return null;
}
bytes[1] = (byte) (int) (l >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 3:
for (i = 0; i < 2; ++i) {
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) {
return null;
}
bytes[i] = (byte) (int) (l & 0xFF);
}
l = Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L)) {
return null;
}
bytes[2] = (byte) (int) (l >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 4:
for (i = 0; i < 4; ++i) {
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) {
return null;
}
bytes[i] = (byte) (int) (l & 0xFF);
}
break;
default:
return null;
}
} catch (NumberFormatException e) {
return null;
}
return bytes;
}
/**
* 获取本地IP地址
*
* @return 本地IP地址
*/
public static String getHostIp() {
try {
return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException ignored) {
}
return "127.0.0.1";
}
/**
* 获取主机名
*
* @return 本地主机名
*/
public static String getHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException ignored) {
}
return "未知";
}
/**
* 从反向代理中获得第一个非 unknown IP地址
*/
public static String getMultistageReverseProxyIp(String ip) {
// 反向代理检测
if (ip.indexOf(",") > 0) {
final String[] ips = ip.trim().split(",");
for (String sub : ips) {
if (!"unknown".equalsIgnoreCase(sub)) {
ip = sub;
break;
}
}
}
return ip;
}
}

View File

@ -0,0 +1,78 @@
package com.bdzl.framework.common.utils;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.util.ArrayList;
import java.util.List;
/**
* JSON 工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class JsonUtils {
private static final ObjectMapper objectMapper = new ObjectMapper();
static {
objectMapper.registerModule(new JavaTimeModule());
// objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
public static String toJsonString(Object object) {
try {
return objectMapper.writeValueAsString(object);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static <T> T parseObject(String text, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return null;
}
try {
return objectMapper.readValue(text, clazz);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
if (ArrayUtil.isEmpty(bytes)) {
return null;
}
try {
return objectMapper.readValue(bytes, clazz);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static <T> T parseObject(String text, TypeReference<T> typeReference) {
try {
return objectMapper.readValue(text, typeReference);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static <T> List<T> parseArray(String text, Class<T> clazz) {
if (StrUtil.isEmpty(text)) {
return new ArrayList<>();
}
try {
return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,35 @@
package com.bdzl.framework.common.utils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 分页工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
@Schema(description = "分页数据")
public class PageResult<T> implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "总记录数")
private int total;
@Schema(description = "列表数据")
private List<T> list;
/**
* 分页
* @param list 列表数据
* @param total 总记录数
*/
public PageResult(List<T> list, long total) {
this.list = list;
this.total = (int)total;
}
}

View File

@ -0,0 +1,53 @@
package com.bdzl.framework.common.utils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import com.bdzl.framework.common.exception.ErrorCode;
/**
* 响应数据
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
@Schema(description = "响应")
public class Result<T> {
@Schema(description = "编码 0表示成功其他值表示失败")
private int code = 0;
@Schema(description = "消息内容")
private String msg = "success";
@Schema(description = "响应数据")
private T data;
public static <T> Result<T> ok() {
return ok(null);
}
public static <T> Result<T> ok(T data) {
Result<T> result = new Result<>();
result.setData(data);
return result;
}
public static <T> Result<T> error() {
return error(ErrorCode.INTERNAL_SERVER_ERROR);
}
public static <T> Result<T> error(String msg) {
return error(ErrorCode.INTERNAL_SERVER_ERROR.getCode(), msg);
}
public static <T> Result<T> error(ErrorCode errorCode) {
return error(errorCode.getCode(), errorCode.getMsg());
}
public static <T> Result<T> error(int code, String msg) {
Result<T> result = new Result<>();
result.setCode(code);
result.setMsg(msg);
return result;
}
}

View File

@ -0,0 +1,33 @@
package com.bdzl.framework.common.utils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 树节点所有需要实现树节点的都需要继承该类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
public class TreeNode<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@Schema(description = "id")
private Long id;
/**
* 上级ID
*/
@Schema(description = "上级ID")
private Long pid;
/**
* 子节点列表
*/
private List<T> children = new ArrayList<>();
}

View File

@ -0,0 +1,71 @@
package com.bdzl.framework.common.utils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 树形结构工具类菜单机构等
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class TreeUtils {
/**
* 根据pid构建树节点
*/
public static <T extends TreeNode<T>> List<T> build(List<T> treeNodes, Long pid) {
// pid不能为空
AssertUtils.isNull(pid, "pid");
List<T> treeList = new ArrayList<>();
for (T treeNode : treeNodes) {
if (pid.equals(treeNode.getPid())) {
treeList.add(findChildren(treeNodes, treeNode));
}
}
return treeList;
}
/**
* 查找子节点
*/
private static <T extends TreeNode<T>> T findChildren(List<T> treeNodes, T rootNode) {
for (T treeNode : treeNodes) {
if (rootNode.getId().equals(treeNode.getPid())) {
rootNode.getChildren().add(findChildren(treeNodes, treeNode));
}
}
return rootNode;
}
/**
* 构建树节点
*/
public static <T extends TreeNode<T>> List<T> build(List<T> treeNodes) {
List<T> result = new ArrayList<>();
// list转map
Map<Long, T> nodeMap = new LinkedHashMap<>(treeNodes.size());
for (T treeNode : treeNodes) {
nodeMap.put(treeNode.getId(), treeNode);
}
for (T node : nodeMap.values()) {
T parent = nodeMap.get(node.getPid());
if (parent != null && !(node.getId().equals(parent.getId()))) {
parent.getChildren().add(node);
continue;
}
result.add(node);
}
return result;
}
}

View File

@ -0,0 +1,50 @@
package com.bdzl.framework.common.xss;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
/**
* XSS 配置文件
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Configuration
@EnableConfigurationProperties(XssProperties.class)
@ConditionalOnProperty(prefix = "maku.xss", value = "enabled")
public class XssConfiguration {
private final static PathMatcher pathMatcher = new AntPathMatcher();
@Bean
public FilterRegistrationBean<XssFilter> xssFilter(XssProperties properties) {
FilterRegistrationBean<XssFilter> bean = new FilterRegistrationBean<>();
bean.setFilter(new XssFilter(properties, pathMatcher));
bean.setOrder(Integer.MAX_VALUE);
bean.setName("xssFilter");
return bean;
}
/**
* xss过滤处理json类型的请求
*/
@Bean
public ObjectMapper xssFilterObjectMapper(Jackson2ObjectMapperBuilder builder, XssProperties properties) {
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
// 注册xss过滤器
SimpleModule module = new SimpleModule("XssFilterJsonDeserializer");
module.addDeserializer(String.class, new XssFilterJsonDeserializer(properties, pathMatcher));
objectMapper.registerModule(module);
return objectMapper;
}
}

View File

@ -0,0 +1,44 @@
package com.bdzl.framework.common.xss;
import cn.hutool.core.util.StrUtil;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.util.PathMatcher;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
/**
* Xss 过滤器
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@AllArgsConstructor
public class XssFilter extends OncePerRequestFilter {
private final XssProperties properties;
private final PathMatcher pathMatcher;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
filterChain.doFilter(new XssRequestWrapper(request), response);
}
@Override
protected boolean shouldNotFilter(HttpServletRequest request) {
// 如果是json数据则不处理
String contentType = request.getContentType();
if (StrUtil.isBlank(contentType) || StrUtil.startWithIgnoreCase(contentType, MediaType.APPLICATION_JSON_VALUE)) {
return true;
}
// 放行不过滤的URL
return properties.getExcludeUrls().stream().anyMatch(excludeUrl -> pathMatcher.match(excludeUrl, request.getServletPath()));
}
}

View File

@ -0,0 +1,50 @@
package com.bdzl.framework.common.xss;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import jakarta.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor;
import com.bdzl.framework.common.utils.HttpContextUtils;
import org.springframework.util.PathMatcher;
import java.io.IOException;
/**
* xss json过滤
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@AllArgsConstructor
public class XssFilterJsonDeserializer extends JsonDeserializer<String> {
private final XssProperties properties;
private final PathMatcher pathMatcher;
@Override
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
String value = jsonParser.getValueAsString();
if (StrUtil.isBlank(value)) {
return value;
}
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
if (request == null) {
return value;
}
// 判断该URI是否放行
boolean flag = properties.getExcludeUrls().stream().anyMatch(excludeUrl -> pathMatcher.match(excludeUrl, request.getServletPath()));
if (flag) {
return value;
}
return XssUtils.filter(value);
}
@Override
public Class<String> handledType() {
return String.class;
}
}

View File

@ -0,0 +1,26 @@
package com.bdzl.framework.common.xss;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.Collections;
import java.util.List;
/**
* XSS 配置项
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
@ConfigurationProperties(prefix = "maku.xss")
public class XssProperties {
/**
* 是否开启 XSS
*/
private boolean enabled;
/**
* 排除的URL列表
*/
private List<String> excludeUrls = Collections.emptyList();
}

View File

@ -0,0 +1,71 @@
package com.bdzl.framework.common.xss;
import cn.hutool.core.util.StrUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* XSS Request Wrapper
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class XssRequestWrapper extends HttpServletRequestWrapper {
public XssRequestWrapper(HttpServletRequest request) {
super(request);
}
@Override
public String getParameter(String name) {
String value = super.getParameter(name);
return filterXss(value);
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = filterXss(parameters[i]);
}
return parameters;
}
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> map = new LinkedHashMap<>();
Map<String, String[]> parameters = super.getParameterMap();
for (String key : parameters.keySet()) {
String[] values = parameters.get(key);
for (int i = 0; i < values.length; i++) {
values[i] = filterXss(values[i]);
}
map.put(key, values);
}
return map;
}
@Override
public String getHeader(String name) {
String value = super.getHeader(name);
return filterXss(value);
}
private String filterXss(String content) {
if (StrUtil.isBlank(content)) {
return content;
}
return XssUtils.filter(content);
}
}

View File

@ -0,0 +1,29 @@
package com.bdzl.framework.common.xss;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.safety.Safelist;
/**
* XSS 过滤工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class XssUtils {
/**
* 不格式化
*/
private final static Document.OutputSettings outputSettings = new Document.OutputSettings().prettyPrint(false);
/**
* XSS过滤
*
* @param content 需要过滤的内容
* @return 返回过滤后的内容
*/
public static String filter(String content) {
return Jsoup.clean(content, "", Safelist.relaxed(), outputSettings);
}
}

View File

@ -0,0 +1,40 @@
package com.bdzl.framework.mybatis.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.bdzl.framework.mybatis.handler.FieldMetaObjectHandler;
import com.bdzl.framework.mybatis.interceptor.DataScopeInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* mybatis-plus 配置
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
// 数据权限
mybatisPlusInterceptor.addInnerInterceptor(new DataScopeInnerInterceptor());
// 分页插件
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
// 乐观锁
mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
// 防止全表更新与删除
mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
return mybatisPlusInterceptor;
}
@Bean
public FieldMetaObjectHandler fieldMetaObjectHandler(){
return new FieldMetaObjectHandler();
}
}

View File

@ -0,0 +1,14 @@
package com.bdzl.framework.mybatis.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 基础Dao
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface BaseDao<T> extends BaseMapper<T> {
}

View File

@ -0,0 +1,60 @@
package com.bdzl.framework.mybatis.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fhs.core.trans.vo.TransPojo;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Entity基类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
public abstract class BaseEntity implements TransPojo {
/**
* id
*/
@TableId
private Long id;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
/**
* 版本号
*/
@Version
@TableField(fill = FieldFill.INSERT)
private Integer version;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
private Integer deleted;
}

View File

@ -0,0 +1,57 @@
package com.bdzl.framework.mybatis.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.bdzl.framework.security.user.SecurityUser;
import com.bdzl.framework.security.user.UserDetail;
import org.apache.ibatis.reflection.MetaObject;
import java.time.LocalDateTime;
/**
* mybatis-plus 自动填充字段
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class FieldMetaObjectHandler implements MetaObjectHandler {
private final static String CREATE_TIME = "createTime";
private final static String CREATOR = "creator";
private final static String UPDATE_TIME = "updateTime";
private final static String UPDATER = "updater";
private final static String ORG_ID = "orgId";
private final static String VERSION = "version";
private final static String DELETED = "deleted";
@Override
public void insertFill(MetaObject metaObject) {
UserDetail user = SecurityUser.getUser();
LocalDateTime now = LocalDateTime.now();
// 用户字段填充
if (user != null) {
// 创建者
setFieldValByName(CREATOR, user.getId(), metaObject);
// 更新者
setFieldValByName(UPDATER, user.getId(), metaObject);
// 创建者所属机构
setFieldValByName(ORG_ID, user.getOrgId(), metaObject);
}
// 创建时间
setFieldValByName(CREATE_TIME, now, metaObject);
// 更新时间
setFieldValByName(UPDATE_TIME, now, metaObject);
// 版本号
setFieldValByName(VERSION, 0, metaObject);
// 删除标识
setFieldValByName(DELETED, 0, metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
// 更新者
setFieldValByName(UPDATER, SecurityUser.getUserId(), metaObject);
// 更新时间
setFieldValByName(UPDATE_TIME, LocalDateTime.now(), metaObject);
}
}

View File

@ -0,0 +1,17 @@
package com.bdzl.framework.mybatis.interceptor;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 数据范围
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
@AllArgsConstructor
public class DataScope {
private String sqlFilter;
}

View File

@ -0,0 +1,80 @@
package com.bdzl.framework.mybatis.interceptor;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.Select;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import java.util.Map;
/**
* 数据权限
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class DataScopeInnerInterceptor implements InnerInterceptor {
@Override
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {
DataScope scope = getDataScope(parameter);
// 不进行数据过滤
if (scope == null || StrUtil.isBlank(scope.getSqlFilter())) {
return;
}
// 拼接新SQL
String buildSql = getSelect(boundSql.getSql(), scope);
// 重写SQL
PluginUtils.mpBoundSql(boundSql).sql(buildSql);
}
private DataScope getDataScope(Object parameter) {
if (parameter == null) {
return null;
}
// 判断参数里是否有DataScope对象
if (parameter instanceof Map<?, ?> parameterMap) {
for (Map.Entry<?, ?> entry : parameterMap.entrySet()) {
if (entry.getValue() != null && entry.getValue() instanceof DataScope) {
return (DataScope) entry.getValue();
}
}
} else if (parameter instanceof DataScope) {
return (DataScope) parameter;
}
return null;
}
private String getSelect(String buildSql, DataScope scope) {
try {
Select select = (Select) CCJSqlParserUtil.parse(buildSql);
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
Expression expression = plainSelect.getWhere();
if (expression == null) {
plainSelect.setWhere(new StringValue(scope.getSqlFilter()));
} else {
AndExpression andExpression = new AndExpression(expression, new StringValue(scope.getSqlFilter()));
plainSelect.setWhere(andExpression);
}
return select.toString();
} catch (JSQLParserException e) {
return buildSql;
}
}
}

View File

@ -0,0 +1,108 @@
package com.bdzl.framework.mybatis.interceptor;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.ExpressionVisitor;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class StringValue extends ASTNodeAccessImpl implements Expression {
private String value = "";
private String prefix = null;
public static final List<String> ALLOWED_PREFIXES = Arrays.asList("N", "U", "E", "R", "B", "RB", "_utf8");
public StringValue() {
// empty constructor
}
public StringValue(String escapedValue) {
// removing "'" at the start and at the end
if (escapedValue.startsWith("'") && escapedValue.endsWith("'")) {
value = escapedValue.substring(1, escapedValue.length() - 1);
return;
}
if (escapedValue.length() > 2) {
for (String p : ALLOWED_PREFIXES) {
if (escapedValue.length() > p.length() && escapedValue.substring(0, p.length()).equalsIgnoreCase(p)
&& escapedValue.charAt(p.length()) == '\'') {
this.prefix = p;
value = escapedValue.substring(p.length() + 1, escapedValue.length() - 1);
return;
}
}
}
value = escapedValue;
}
public String getValue() {
return value;
}
public String getPrefix() {
return prefix;
}
public String getNotExcapedValue() {
StringBuilder buffer = new StringBuilder(value);
int index = 0;
int deletesNum = 0;
while ((index = value.indexOf("''", index)) != -1) {
buffer.deleteCharAt(index - deletesNum);
index += 2;
deletesNum++;
}
return buffer.toString();
}
public void setValue(String string) {
value = string;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
@Override
public void accept(ExpressionVisitor expressionVisitor) {
// expressionVisitor.visit(this);
}
@Override
public String toString() {
return (prefix != null ? prefix : "") + value;
}
public StringValue withPrefix(String prefix) {
this.setPrefix(prefix);
return this;
}
public StringValue withValue(String value) {
this.setValue(value);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
StringValue that = (StringValue) o;
return Objects.equals(value, that.value) && Objects.equals(prefix, that.prefix);
}
@Override
public int hashCode() {
return Objects.hash(value, prefix);
}
}

View File

@ -0,0 +1,14 @@
package com.bdzl.framework.mybatis.service;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 基础服务接口所有Service接口都要继承
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface BaseService<T> extends IService<T> {
}

View File

@ -0,0 +1,111 @@
package com.bdzl.framework.mybatis.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdzl.framework.common.constant.Constant;
import com.bdzl.framework.common.query.Query;
import com.bdzl.framework.mybatis.interceptor.DataScope;
import com.bdzl.framework.mybatis.service.BaseService;
import com.bdzl.framework.security.user.SecurityUser;
import com.bdzl.framework.security.user.UserDetail;
import java.util.List;
/**
* 基础服务类所有Service都要继承
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements BaseService<T> {
/**
* 获取分页对象
*
* @param query 分页参数
*/
protected IPage<T> getPage(Query query) {
Page<T> page = new Page<>(query.getPage(), query.getLimit());
// 排序
if (StringUtils.isNotBlank(query.getOrder())) {
if (query.isAsc()) {
return page.addOrder(OrderItem.asc(query.getOrder()));
} else {
return page.addOrder(OrderItem.desc(query.getOrder()));
}
}
return page;
}
/**
* MyBatis-Plus 数据权限
*/
protected void dataScopeWrapper(LambdaQueryWrapper<T> queryWrapper) {
DataScope dataScope = getDataScope(null, null);
if (dataScope != null) {
queryWrapper.apply(dataScope.getSqlFilter());
}
}
/**
* 原生SQL 数据权限
*
* @param tableAlias 表别名多表关联时需要填写表别名
* @param orgIdAlias 机构ID别名null表示org_id
* @return 返回数据权限
*/
protected DataScope getDataScope(String tableAlias, String orgIdAlias) {
UserDetail user = SecurityUser.getUser();
// 如果是超级管理员则不进行数据过滤
if (user.getSuperAdmin().equals(Constant.SUPER_ADMIN)) {
return null;
}
// 如果为null则设置成空字符串
if (tableAlias == null) {
tableAlias = "";
}
// 获取表的别名
if (StringUtils.isNotBlank(tableAlias)) {
tableAlias += ".";
}
StringBuilder sqlFilter = new StringBuilder();
sqlFilter.append(" (");
// 数据权限范围
List<Long> dataScopeList = user.getDataScopeList();
// 全部数据权限
if (dataScopeList == null) {
return null;
}
// 数据过滤
if (dataScopeList.size() > 0) {
if (StringUtils.isBlank(orgIdAlias)) {
orgIdAlias = "org_id";
}
sqlFilter.append(tableAlias).append(orgIdAlias);
sqlFilter.append(" in(").append(StrUtil.join(",", dataScopeList)).append(")");
sqlFilter.append(" or ");
}
// 查询本人数据
sqlFilter.append(tableAlias).append("creator").append("=").append(user.getId());
sqlFilter.append(")");
return new DataScope(sqlFilter.toString());
}
}

View File

@ -0,0 +1,33 @@
package com.bdzl.framework.operatelog.annotations;
import com.bdzl.framework.operatelog.enums.OperateTypeEnum;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 操作日志
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OperateLog {
/**
* 模块名
*/
String module() default "";
/**
* 操作名
*/
String name() default "";
/**
* 操作类型
*/
OperateTypeEnum[] type() default OperateTypeEnum.OTHER;
}

View File

@ -0,0 +1,172 @@
package com.bdzl.framework.operatelog.aspect;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import com.bdzl.framework.common.constant.Constant;
import com.bdzl.framework.common.utils.HttpContextUtils;
import com.bdzl.framework.common.utils.IpUtils;
import com.bdzl.framework.common.utils.JsonUtils;
import com.bdzl.framework.operatelog.annotations.OperateLog;
import com.bdzl.framework.operatelog.dto.OperateLogDTO;
import com.bdzl.framework.operatelog.service.OperateLogService;
import com.bdzl.framework.security.user.SecurityUser;
import com.bdzl.framework.security.user.UserDetail;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.validation.BindingResult;
import org.springframework.web.multipart.MultipartFile;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.IntStream;
/**
* 操作日志切面处理类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Aspect
@Component
@AllArgsConstructor
public class OperateLogAspect {
private final OperateLogService operateLogService;
@Around("@annotation(operateLog)")
public Object around(ProceedingJoinPoint joinPoint, OperateLog operateLog) throws Throwable {
// 记录开始时间
LocalDateTime startTime = LocalDateTime.now();
try {
//执行方法
Object result = joinPoint.proceed();
//保存日志
saveLog(joinPoint, operateLog, startTime, Constant.SUCCESS);
return result;
} catch (Exception e) {
//保存日志
saveLog(joinPoint, operateLog, startTime, Constant.FAIL);
throw e;
}
}
private void saveLog(ProceedingJoinPoint joinPoint, OperateLog operateLog, LocalDateTime startTime, Integer status) {
OperateLogDTO log = new OperateLogDTO();
// 执行时长
long duration = LocalDateTimeUtil.between(startTime, LocalDateTime.now()).toMillis();
log.setDuration((int) duration);
// 用户信息
UserDetail user = SecurityUser.getUser();
if (user != null) {
log.setUserId(user.getId());
log.setRealName(user.getRealName());
log.setTenantId(user.getTenantId());
}
// 操作类型
log.setOperateType(operateLog.type()[0].getValue());
// 设置module值
log.setModule(operateLog.module());
// 设置name值
log.setName(operateLog.name());
// 如果没有指定module值则从tag读取
if (StrUtil.isBlank(log.getModule())) {
Tag tag = getClassAnnotation(joinPoint, Tag.class);
if (tag != null) {
log.setModule(tag.name());
}
}
// 如果没有指定name值则从operation读取
if (StrUtil.isBlank(log.getName())) {
Operation operation = getMethodAnnotation(joinPoint, Operation.class);
if (operation != null) {
log.setName(operation.summary());
}
}
// 请求相关
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
if (request != null) {
log.setIp(IpUtils.getIpAddr(request));
log.setAddress(IpUtils.getAddressByIP(log.getIp()));
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setReqUri(request.getServletPath());
log.setReqMethod(request.getMethod());
}
log.setReqParams(obtainMethodArgs(joinPoint));
log.setStatus(status);
// 保存操作日志
operateLogService.saveLog(log);
}
private String obtainMethodArgs(ProceedingJoinPoint joinPoint) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
String[] argNames = methodSignature.getParameterNames();
Object[] argValues = joinPoint.getArgs();
// 拼接参数
Map<String, Object> args = MapUtil.newHashMap(argValues.length);
for (int i = 0; i < argNames.length; i++) {
String argName = argNames[i];
Object argValue = argValues[i];
args.put(argName, ignoreArgs(argValue) ? "[ignore]" : argValue);
}
return JsonUtils.toJsonString(args);
}
private static boolean ignoreArgs(Object object) {
Class<?> clazz = object.getClass();
// 处理数组
if (clazz.isArray()) {
return IntStream.range(0, Array.getLength(object))
.anyMatch(index -> ignoreArgs(Array.get(object, index)));
}
// 处理集合
if (Collection.class.isAssignableFrom(clazz)) {
return ((Collection<?>) object).stream()
.anyMatch((Predicate<Object>) OperateLogAspect::ignoreArgs);
}
// 处理Map
if (Map.class.isAssignableFrom(clazz)) {
return ignoreArgs(((Map<?, ?>) object).values());
}
return object instanceof MultipartFile
|| object instanceof HttpServletRequest
|| object instanceof HttpServletResponse
|| object instanceof BindingResult;
}
private static <T extends Annotation> T getMethodAnnotation(ProceedingJoinPoint joinPoint, Class<T> annotationClass) {
return ((MethodSignature) joinPoint.getSignature()).getMethod().getAnnotation(annotationClass);
}
private static <T extends Annotation> T getClassAnnotation(ProceedingJoinPoint joinPoint, Class<T> annotationClass) {
return ((MethodSignature) joinPoint.getSignature()).getMethod().getDeclaringClass().getAnnotation(annotationClass);
}
}

View File

@ -0,0 +1,88 @@
package com.bdzl.framework.operatelog.dto;
import lombok.Data;
/**
* 操作日志
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
public class OperateLogDTO {
/**
* 用户ID
*/
private Long userId;
/**
* 操作人
*/
private String realName;
/**
* 模块名
*/
private String module;
/**
* 操作名
*/
private String name;
/**
* 请求URI
*/
private String reqUri;
/**
* 请求方法
*/
private String reqMethod;
/**
* 请求参数
*/
private String reqParams;
/**
* 操作IP
*/
private String ip;
/**
* 登录地点
*/
private String address;
/**
* User Agent
*/
private String userAgent;
/**
* 操作类型
*/
private Integer operateType;
/**
* 执行时长
*/
private Integer duration;
/**
* 操作状态
*/
private Integer status;
/**
* 返回消息
*/
private String resultMsg;
/**
* 租户ID
*/
private Long tenantId;
}

View File

@ -0,0 +1,45 @@
package com.bdzl.framework.operatelog.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 操作类型
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Getter
@AllArgsConstructor
public enum OperateTypeEnum {
/**
* 查询
*/
GET(1),
/**
* 新增
*/
INSERT(2),
/**
* 修改
*/
UPDATE(3),
/**
* 删除
*/
DELETE(4),
/**
* 导出
*/
EXPORT(5),
/**
* 导入
*/
IMPORT(6),
/**
* 其它
*/
OTHER(0);
private final int value;
}

View File

@ -0,0 +1,28 @@
package com.bdzl.framework.operatelog.service;
import lombok.AllArgsConstructor;
import com.bdzl.framework.common.cache.RedisCache;
import com.bdzl.framework.common.cache.RedisKeys;
import com.bdzl.framework.operatelog.dto.OperateLogDTO;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
/**
* 操作日志服务
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Service
@AllArgsConstructor
public class OperateLogService {
private final RedisCache redisCache;
@Async
public void saveLog(OperateLogDTO log) {
String key = RedisKeys.getLogKey();
// 保存到Redis队列
redisCache.leftPush(key, log, RedisCache.NOT_EXPIRE);
}
}

View File

@ -0,0 +1,64 @@
package com.bdzl.framework.security.cache;
import cn.hutool.core.collection.ListUtil;
import lombok.AllArgsConstructor;
import com.bdzl.framework.common.cache.RedisCache;
import com.bdzl.framework.common.cache.RedisKeys;
import com.bdzl.framework.security.properties.SecurityProperties;
import com.bdzl.framework.security.user.UserDetail;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set;
/**
* 认证 Cache
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Component
@AllArgsConstructor
public class TokenStoreCache {
private final RedisCache redisCache;
private final SecurityProperties securityProperties;
public void saveUser(String accessToken, UserDetail user) {
String key = RedisKeys.getAccessTokenKey(accessToken);
redisCache.set(key, user, securityProperties.getAccessTokenExpire());
}
public void saveUser(String accessToken, UserDetail user, long expire) {
String key = RedisKeys.getAccessTokenKey(accessToken);
redisCache.set(key, user, expire);
}
public void updateUser(String accessToken, UserDetail user) {
String key = RedisKeys.getAccessTokenKey(accessToken);
Long expire = redisCache.getExpire(key);
redisCache.set(key, user, expire);
}
public Long getExpire(String accessToken) {
String key = RedisKeys.getAccessTokenKey(accessToken);
return redisCache.getExpire(key);
}
public UserDetail getUser(String accessToken) {
String key = RedisKeys.getAccessTokenKey(accessToken);
return (UserDetail) redisCache.get(key);
}
public void deleteUser(String accessToken) {
String key = RedisKeys.getAccessTokenKey(accessToken);
redisCache.delete(key);
}
public List<String> getUserKeyList() {
String pattern = RedisKeys.getAccessTokenKey("*");
Set<String> sets = redisCache.keys(pattern);
return ListUtil.toList(sets);
}
}

View File

@ -0,0 +1,24 @@
package com.bdzl.framework.security.config;
import com.bdzl.framework.security.crypto.Sm3PasswordEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.password.PasswordEncoder;
/**
* 加密配置
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Configuration
public class PasswordConfig {
@Bean
public PasswordEncoder passwordEncoder() {
// 使用国密SM3加密
return new Sm3PasswordEncoder();
// return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}
}

View File

@ -0,0 +1,60 @@
package com.bdzl.framework.security.config;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* 允许访问的资源
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Component
public class PermitResource {
/**
* 指定被 spring security 忽略的URL
*/
@SneakyThrows
public List<String> getPermitList() {
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources("classpath*:auth.yml");
String key = "auth.ignore_urls";
return getPropertiesList(key, resources);
}
private List<String> getPropertiesList(String key, Resource... resources) {
List<String> list = new ArrayList<>();
// 解析资源文件
for (Resource resource : resources) {
Properties properties = loadYamlProperties(resource);
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
String tmpKey = StringUtils.substringBefore(entry.getKey().toString(), "[");
if (tmpKey.equalsIgnoreCase(key)) {
list.add(entry.getValue().toString());
}
}
}
return list;
}
private Properties loadYamlProperties(Resource... resources) {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resources);
factory.afterPropertiesSet();
return factory.getObject();
}
}

View File

@ -0,0 +1,56 @@
package com.bdzl.framework.security.config;
import lombok.AllArgsConstructor;
import com.bdzl.framework.security.exception.SecurityAuthenticationEntryPoint;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.filter.OncePerRequestFilter;
import java.util.List;
/**
* Spring SecurityFilter 配置文件
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Configuration
@AllArgsConstructor
@EnableWebSecurity
@EnableMethodSecurity
public class SecurityFilterConfig {
private final OncePerRequestFilter authenticationTokenFilter;
private final PermitResource permitResource;
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// 忽略授权的地址列表
List<String> permitList = permitResource.getPermitList();
String[] permits = permitList.toArray(new String[0]);
http
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth
.requestMatchers(permits).permitAll()
.requestMatchers(HttpMethod.OPTIONS).permitAll()
.anyRequest().authenticated()
)
.exceptionHandling(exception -> exception.authenticationEntryPoint(new SecurityAuthenticationEntryPoint()))
.headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
.csrf(AbstractHttpConfigurer::disable)
;
return http.build();
}
}

View File

@ -0,0 +1,84 @@
package com.bdzl.framework.security.crypto;
import cn.hutool.core.util.HexUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.crypto.asymmetric.SM2;
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey;
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey;
import org.bouncycastle.util.encoders.Hex;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;
/**
* 国密SM2加密算法
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class Sm2Util {
/**
* 公钥
*/
private final static String PUBLIC_KEY = "3059301306072a8648ce3d020106082a811ccf5501822d034200040a302b5e4b961afb3908a4ae191266ac5866be100fc52e3b8dba9707c8620e64ae790ceffc3bfbf262dc098d293dd3e303356cb91b54861c767997799d2f0060";
/**
* 私钥
*/
private final static String PRIVATE_KEY = "308193020100301306072a8648ce3d020106082a811ccf5501822d047930770201010420d7840173df3d6cd72cad4040dfc7dbfcde539f5b490b54f3cd5c4125544b38aea00a06082a811ccf5501822da144034200040a302b5e4b961afb3908a4ae191266ac5866be100fc52e3b8dba9707c8620e64ae790ceffc3bfbf262dc098d293dd3e303356cb91b54861c767997799d2f0060";
private final static SM2 sm2;
static {
sm2 = SmUtil.sm2(PRIVATE_KEY, PUBLIC_KEY);
}
/**
* 加密
*
* @param data 明文
* @return 加密后的密文
*/
public static String encrypt(String data) {
return sm2.encryptBase64(data, KeyType.PublicKey);
}
/**
* 解密
*
* @param data 加密后的密文
* @return 解密后的明文
*/
public static String decrypt(String data) {
return sm2.decryptStr(data, KeyType.PrivateKey);
}
public static void main(String[] args) {
KeyPair keyPair = SecureUtil.generateKeyPair("SM2");
System.out.println("privateKey" + HexUtil.encodeHexStr(keyPair.getPrivate().getEncoded()));
System.out.println("publicKey" + HexUtil.encodeHexStr(keyPair.getPublic().getEncoded()));
PublicKey publicKey = keyPair.getPublic();
if (publicKey instanceof BCECPublicKey) {
// 获取65字节非压缩缩的十六进制公钥串(0x04)
String publicKeyHex = Hex.toHexString(((BCECPublicKey) publicKey).getQ().getEncoded(false));
System.out.println("SM2公钥" + publicKeyHex);
}
PrivateKey privateKey = keyPair.getPrivate();
if (privateKey instanceof BCECPrivateKey) {
// 获取32字节十六进制私钥串
String privateKeyHex = ((BCECPrivateKey) privateKey).getD().toString(16);
System.out.println("SM2私钥" + privateKeyHex);
}
String password = "admin";
String sm2Password = Sm2Util.encrypt(password);
System.out.println("sm2 加密:" + sm2Password);
System.out.println("sm2 解密:" + Sm2Util.decrypt(sm2Password));
System.out.println("sm3 解密:" + SmUtil.sm3("admin"));
}
}

View File

@ -0,0 +1,23 @@
package com.bdzl.framework.security.crypto;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SmUtil;
import org.springframework.security.crypto.password.PasswordEncoder;
/**
* 采用国密SM3加密算法对系统密码进行加密
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class Sm3PasswordEncoder implements PasswordEncoder {
@Override
public String encode(CharSequence rawPassword) {
return SmUtil.sm3(rawPassword.toString());
}
@Override
public boolean matches(CharSequence rawPassword, String encodedPassword) {
return StrUtil.equals(SmUtil.sm3(rawPassword.toString()), encodedPassword);
}
}

View File

@ -0,0 +1,30 @@
package com.bdzl.framework.security.exception;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import com.bdzl.framework.common.exception.ErrorCode;
import com.bdzl.framework.common.utils.HttpContextUtils;
import com.bdzl.framework.common.utils.JsonUtils;
import com.bdzl.framework.common.utils.Result;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import java.io.IOException;
/**
* 匿名用户(token不存在错误)异常处理器
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class SecurityAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
response.setContentType("application/json; charset=utf-8");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
response.getWriter().print(JsonUtils.toJsonString(Result.error(ErrorCode.UNAUTHORIZED)));
}
}

View File

@ -0,0 +1,58 @@
package com.bdzl.framework.security.filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import com.bdzl.framework.security.cache.TokenStoreCache;
import com.bdzl.framework.security.user.UserDetail;
import com.bdzl.framework.security.utils.TokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
/**
* 认证过滤器
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Component
@AllArgsConstructor
public class AuthenticationTokenFilter extends OncePerRequestFilter {
private final TokenStoreCache tokenStoreCache;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
String accessToken = TokenUtils.getAccessToken(request);
// accessToken为空表示未登录
if (StringUtils.isBlank(accessToken)) {
chain.doFilter(request, response);
return;
}
// 获取登录用户信息
UserDetail user = tokenStoreCache.getUser(accessToken);
if (user == null) {
chain.doFilter(request, response);
return;
}
// 用户存在
Authentication authentication = new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());
// 新建 SecurityContext
SecurityContext context = SecurityContextHolder.createEmptyContext();
context.setAuthentication(authentication);
SecurityContextHolder.setContext(context);
chain.doFilter(request, response);
}
}

View File

@ -0,0 +1,88 @@
package com.bdzl.framework.security.mobile;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceAware;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.util.Assert;
/**
* 手机短信登录 AuthenticationProvider
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class MobileAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private final GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
private final MobileUserDetailsService mobileUserDetailsService;
private final MobileVerifyCodeService mobileVerifyCodeService;
public MobileAuthenticationProvider(MobileUserDetailsService mobileUserDetailsService, MobileVerifyCodeService mobileVerifyCodeService) {
this.mobileUserDetailsService = mobileUserDetailsService;
this.mobileVerifyCodeService = mobileVerifyCodeService;
}
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Assert.isInstanceOf(MobileAuthenticationToken.class, authentication,
() -> messages.getMessage(
"MobileAuthenticationProvider.onlySupports",
"Only MobileAuthenticationProvider is supported"));
MobileAuthenticationToken authenticationToken = (MobileAuthenticationToken) authentication;
String mobile = authenticationToken.getName();
String code = (String) authenticationToken.getCredentials();
try {
UserDetails userDetails = mobileUserDetailsService.loadUserByMobile(mobile);
if (userDetails == null) {
throw new BadCredentialsException("Bad credentials");
}
// 短信验证码效验
if (mobileVerifyCodeService.verifyCode(mobile, code)) {
return createSuccessAuthentication(authentication, userDetails);
} else {
throw new BadCredentialsException("mobile code is not matched");
}
} catch (UsernameNotFoundException ex) {
throw new BadCredentialsException(this.messages
.getMessage("MobileAuthenticationProvider.badCredentials", "Bad credentials"));
}
}
protected Authentication createSuccessAuthentication(Authentication authentication, UserDetails user) {
MobileAuthenticationToken result = new MobileAuthenticationToken(user, null,
authoritiesMapper.mapAuthorities(user.getAuthorities()));
result.setDetails(authentication.getDetails());
return result;
}
@Override
public boolean supports(Class<?> authentication) {
return MobileAuthenticationToken.class.isAssignableFrom(authentication);
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(mobileUserDetailsService, "mobileUserDetailsService must not be null");
Assert.notNull(mobileVerifyCodeService, "mobileVerifyCodeService must not be null");
}
@Override
public void setMessageSource(MessageSource messageSource) {
this.messages = new MessageSourceAccessor(messageSource);
}
}

View File

@ -0,0 +1,57 @@
package com.bdzl.framework.security.mobile;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
import org.springframework.util.Assert;
import java.util.Collection;
/**
* 手机短信登录 AuthenticationToken
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class MobileAuthenticationToken extends AbstractAuthenticationToken {
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
private final Object principal;
private String code;
public MobileAuthenticationToken(Object principal, String code) {
super(null);
this.principal = principal;
this.code = code;
setAuthenticated(false);
}
public MobileAuthenticationToken(Object principal, String code, Collection<? extends GrantedAuthority> authorities) {
super(authorities);
this.principal = principal;
this.code = code;
super.setAuthenticated(true);
}
@Override
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
Assert.isTrue(!isAuthenticated,
"Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
super.setAuthenticated(false);
}
@Override
public Object getCredentials() {
return this.code;
}
@Override
public Object getPrincipal() {
return this.principal;
}
@Override
public void eraseCredentials() {
super.eraseCredentials();
this.code = null;
}
}

View File

@ -0,0 +1,22 @@
package com.bdzl.framework.security.mobile;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
/**
* 手机短信登录UserDetailsService
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface MobileUserDetailsService {
/**
* 通过手机号加载用户信息
*
* @param mobile 手机号
* @return 用户信息
* @throws UsernameNotFoundException 不存在异常
*/
UserDetails loadUserByMobile(String mobile) throws UsernameNotFoundException;
}

View File

@ -0,0 +1,12 @@
package com.bdzl.framework.security.mobile;
/**
* 手机短信登录验证码效验
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface MobileVerifyCodeService {
boolean verifyCode(String mobile, String code);
}

View File

@ -0,0 +1,25 @@
package com.bdzl.framework.security.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* 安全配置项
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "maku.security")
public class SecurityProperties {
/**
* accessToken 过期时间(单位)默认2小时
*/
private int accessTokenExpire = 60 * 60 * 2;
/**
* refreshToken 过期时间(单位)默认14天
*/
private int refreshTokenExpire = 60 * 60 * 24 * 14;
}

View File

@ -0,0 +1,85 @@
package com.bdzl.framework.security.third;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceAware;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.util.Assert;
/**
* 第三方登录 AuthenticationProvider
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class ThirdAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private final GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
private final ThirdUserDetailsService thirdUserDetailsService;
private final ThirdOpenIdService thirdOpenIdService;
public ThirdAuthenticationProvider(ThirdUserDetailsService thirdUserDetailsService, ThirdOpenIdService thirdOpenIdService) {
this.thirdUserDetailsService = thirdUserDetailsService;
this.thirdOpenIdService = thirdOpenIdService;
}
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Assert.isInstanceOf(ThirdAuthenticationToken.class, authentication,
() -> messages.getMessage(
"ThirdAuthenticationProvider.onlySupports",
"Only ThirdAuthenticationProvider is supported"));
ThirdAuthenticationToken authenticationToken = (ThirdAuthenticationToken) authentication;
ThirdLogin login = (ThirdLogin) authenticationToken.getPrincipal();
try {
// 获取用户 openId
String openId = thirdOpenIdService.getOpenId(login);
// 获取用户信息
UserDetails userDetails = thirdUserDetailsService.loadUserByOpenTypeAndOpenId(login.getOpenType(), openId);
if (userDetails == null) {
throw new BadCredentialsException("Bad credentials");
}
return createSuccessAuthentication(authentication, userDetails);
} catch (UsernameNotFoundException ex) {
throw new BadCredentialsException(this.messages
.getMessage("ThirdAuthenticationProvider.badCredentials", "Bad credentials"));
}
}
protected Authentication createSuccessAuthentication(Authentication authentication, UserDetails user) {
ThirdAuthenticationToken result = new ThirdAuthenticationToken(user,
authoritiesMapper.mapAuthorities(user.getAuthorities()));
result.setDetails(authentication.getDetails());
return result;
}
@Override
public boolean supports(Class<?> authentication) {
return ThirdAuthenticationToken.class.isAssignableFrom(authentication);
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(thirdUserDetailsService, "thirdUserDetailsService must not be null");
Assert.notNull(thirdOpenIdService, "thirdOpenIdService must not be null");
}
@Override
public void setMessageSource(MessageSource messageSource) {
this.messages = new MessageSourceAccessor(messageSource);
}
}

View File

@ -0,0 +1,55 @@
package com.bdzl.framework.security.third;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
import org.springframework.util.Assert;
import java.util.Collection;
/**
* 第三方登录 AuthenticationToken
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class ThirdAuthenticationToken extends AbstractAuthenticationToken {
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
private final Object principal;
private Object credentials;
public ThirdAuthenticationToken(Object principal) {
super(null);
this.principal = principal;
setAuthenticated(false);
}
public ThirdAuthenticationToken(Object principal, Collection<? extends GrantedAuthority> authorities) {
super(authorities);
this.principal = principal;
super.setAuthenticated(true);
}
@Override
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
Assert.isTrue(!isAuthenticated,
"Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
super.setAuthenticated(false);
}
@Override
public Object getCredentials() {
return this.credentials;
}
@Override
public Object getPrincipal() {
return this.principal;
}
@Override
public void eraseCredentials() {
super.eraseCredentials();
this.credentials = null;
}
}

View File

@ -0,0 +1,29 @@
package com.bdzl.framework.security.third;
import lombok.Data;
import java.io.Serializable;
/**
* 第三方登录 表单数据
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
public class ThirdLogin implements Serializable {
/**
* 开放平台类型
*/
private String openType;
/**
* 开放平台Code
*/
private String code;
/**
* state
*/
private String state;
}

View File

@ -0,0 +1,18 @@
package com.bdzl.framework.security.third;
/**
* 第三方登录通过code获取开放平台用户唯一标识
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface ThirdOpenIdService {
/**
* 通过code获取开放平台用户唯一标识
*
* @param login 第三方登录信息
* @return 开放平台用户唯一标识
*/
String getOpenId(ThirdLogin login);
}

View File

@ -0,0 +1,23 @@
package com.bdzl.framework.security.third;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
/**
* 第三方登录ThirdUserDetailsService
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public interface ThirdUserDetailsService {
/**
* 通过开放平台类型和唯一标识加载用户信息
*
* @param openType 开放平台类型
* @param openId 开放平台唯一标识
* @return 用户信息
* @throws UsernameNotFoundException 不存在异常
*/
UserDetails loadUserByOpenTypeAndOpenId(String openType, String openId) throws UsernameNotFoundException;
}

View File

@ -0,0 +1,51 @@
package com.bdzl.framework.security.user;
import org.springframework.security.core.context.SecurityContextHolder;
/**
* 用户
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class SecurityUser {
/**
* 获取用户信息
*/
public static UserDetail getUser() {
UserDetail user;
try {
user = (UserDetail) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
} catch (Exception e) {
return null;
}
return user;
}
/**
* 获取用户ID
*/
public static Long getUserId() {
UserDetail user = getUser();
if (user == null) {
return null;
}
return user.getId();
}
/**
* 获取机构ID
*/
public static Long getOrgId() {
UserDetail user = getUser();
if (user == null) {
return null;
}
return user.getOrgId();
}
}

View File

@ -0,0 +1,91 @@
package com.bdzl.framework.security.user;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 登录用户信息
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
@Data
public class UserDetail implements UserDetails {
private static final long serialVersionUID = 1L;
private Long id;
private String username;
private String password;
private String realName;
private String avatar;
private Integer gender;
private String email;
private String mobile;
private Long orgId;
private Integer status;
private Integer superAdmin;
private Long tenantId;
private LocalDateTime createTime;
/**
* 数据权限范围
* <p>
* null表示全部数据权限
*/
private List<Long> dataScopeList;
/**
* 帐户是否过期
*/
private boolean isAccountNonExpired = true;
/**
* 帐户是否被锁定
*/
private boolean isAccountNonLocked = true;
/**
* 密码是否过期
*/
private boolean isCredentialsNonExpired = true;
/**
* 帐户是否可用
*/
private boolean isEnabled = true;
/**
* 拥有权限集合
*/
private Set<String> authoritySet;
@Override
@JsonIgnore
public Collection<? extends GrantedAuthority> getAuthorities() {
return authoritySet.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toSet());
}
@Override
public boolean isAccountNonExpired() {
return this.isAccountNonExpired;
}
@Override
public boolean isAccountNonLocked() {
return this.isAccountNonLocked;
}
@Override
public boolean isCredentialsNonExpired() {
return this.isCredentialsNonExpired;
}
@Override
public boolean isEnabled() {
return this.isEnabled;
}
}

View File

@ -0,0 +1,53 @@
package com.bdzl.framework.security.utils;
import cn.hutool.extra.spring.SpringUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* SpringSecurity @PreAuthorize 注解 权限标识
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class PreAuthorizeUtil {
/**
* 获取 @PreAuthorize 注解的权限标识列表
*
* @return 权限标识列表
*/
public static List<String> getPreAuthorizeList() {
List<String> authorities = new ArrayList<>();
ApplicationContext context = SpringUtil.getApplicationContext();
String[] beanNames = context.getBeanNamesForAnnotation(Controller.class);
for (String beanName : beanNames) {
Object bean = context.getBean(beanName);
Method[] methods = bean.getClass().getDeclaredMethods();
for (Method method : methods) {
PreAuthorize preAuthorize = AnnotationUtils.findAnnotation(method, PreAuthorize.class);
if (preAuthorize != null) {
String value = preAuthorize.value();
// 使用正则表达式提取权限字符串
Pattern pattern = Pattern.compile("hasAuthority\\('([^']*)'\\)");
Matcher matcher = pattern.matcher(value);
while (matcher.find()) {
String authority = matcher.group(1);
authorities.add(authority);
}
}
}
}
return authorities;
}
}

View File

@ -0,0 +1,46 @@
package com.bdzl.framework.security.utils;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import jakarta.servlet.http.HttpServletRequest;
import com.bdzl.framework.common.utils.HttpContextUtils;
/**
* Token 工具类
*
* @author 阿沐 babamu@126.com
* <a href="https://maku.net">MAKU</a>
*/
public class TokenUtils {
/**
* 生成 AccessToken
*/
public static String generator() {
return UUID.fastUUID().toString(true);
}
/**
* 获取 AccessToken
*/
public static String getAccessToken() {
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
if (request == null) {
return null;
}
return getAccessToken(request);
}
/**
* 获取 AccessToken
*/
public static String getAccessToken(HttpServletRequest request) {
String accessToken = request.getHeader("Authorization");
if (StrUtil.isBlank(accessToken)) {
accessToken = request.getParameter("access_token");
}
return accessToken;
}
}

View File

@ -0,0 +1,11 @@
auth:
ignore_urls:
- /actuator/**
- /v3/api-docs/**
- /webjars/**
- /swagger/**
- /swagger-resources/**
- /swagger-ui.html
- /swagger-ui/**
- /doc.html
- /

Binary file not shown.

View File

@ -0,0 +1,21 @@
## 说明
drone-ops 是采用组件模式,扩展不同的业务功能,可以很方便的实现各种业务需求,且不会导致系统臃肿,若想使用某个组件,按需引入即可,反之亦然。
## 引入
如果需要使用对应的组件,如:`drone-ops-quartz`,则需要在`drone-ops/drone-ops-server/pom.xml`里面引入,如下所示:
```xml
<dependency>
<groupId>com.bdzl</groupId>
<artifactId>drone-ops-quartz</artifactId>
<version>${revision}</version>
</dependency>
```
## SQL语句
引入组件时还需要执行对应的SQL文件初始化表结构和菜单等。
如果使用的是MySQL数据库则需要执行以下SQL文件
```
drone-ops/db/mysql/module/maku-module-quartz.sql
```

View File

@ -0,0 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.bdzl</groupId>
<artifactId>drone-ops-module</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drone-ops-module-generator</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>net.maku</groupId>
<artifactId>maku-generator-pro-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,3 @@
auth:
ignore_urls:
- /maku-generator/**

View File

@ -0,0 +1,59 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.bdzl</groupId>
<artifactId>drone-ops-module</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drone-ops-module-iot</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.bdzl</groupId>
<artifactId>drone-ops-framework</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- JUnit 依赖 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- Mockito 依赖 -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
<!-- Spring Test 依赖(如果你使用 Spring 框架) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,18 @@
package com.bdzl.iot.communication.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 响应消息基础类
*
* @author eden on 2024/6/17
*/
@Data
public class BaseCommandResponseDTO extends BaseDeviceID {
/**
* 命令ID
*/
@Schema(description = "命令ID", required = true)
protected String commandId;
}

View File

@ -0,0 +1,17 @@
package com.bdzl.iot.communication.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 设备ID
*
* @author LSF maku_lsf@163.com
*/
@Data
@Schema(description = "设备ID")
public class BaseDeviceID {
@Schema(description = "设备ID")
protected String deviceId;
}

View File

@ -0,0 +1,96 @@
package com.bdzl.iot.communication.dto;
import lombok.extern.slf4j.Slf4j;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* 数据生产消费者通道
*/
@Slf4j
public class CommandResponseChan {
// 存储通道的 ConcurrentHashMap
private static final ConcurrentHashMap<String, CommandResponseChan> CHANNEL = new ConcurrentHashMap<>();
private final CompletableFuture<BaseCommandResponseDTO> future = new CompletableFuture<>();
private final Long DEFAULT_WAIT_MILLISECONDS = 5 * 1000L;
// 私有构造函数不允许外部直接实例化
private CommandResponseChan() {
}
/**
* 获取或创建通道实例
*
* @param commandId 通道标识
* @param isNeedCreate 是否需要创建新的通道实例
* @return 通道实例
*/
public static CommandResponseChan getInstance(String commandId, boolean isNeedCreate) {
if (!isNeedCreate) {
return CHANNEL.get(commandId);
}
return CHANNEL.computeIfAbsent(commandId, k -> new CommandResponseChan());
}
/**
* 从通道中获取数据默认超时时间为 5
*
* @param commandId 通道标识
* @return 获取的数据如果超时返回 null
*/
public BaseCommandResponseDTO get(String commandId) {
return get(commandId, DEFAULT_WAIT_MILLISECONDS);
}
/**
* 从通道中获取数据支持超时设置
*
* @param commandId 通道标识
* @param timeout 超时时间毫秒
* @return 获取的数据如果超时返回 null
*/
public BaseCommandResponseDTO get(String commandId, long timeout) {
CommandResponseChan channel = CHANNEL.get(commandId);
if (Objects.isNull(channel)) {
return null;
}
try {
return channel.future.get(timeout, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
// 超时异常处理
log.error("Device response timeout. {}", commandId);
return null;
} catch (Exception e) {
// 其他异常处理
e.printStackTrace();
return null;
} finally {
// 确保在获取数据后移除通道
CHANNEL.remove(commandId, channel);
}
}
/**
* 向通道中放入数据并唤醒可能正在等待数据的线程
*
* @param response 要放入的数据
*/
public void put(BaseCommandResponseDTO response) {
String commandId = response.getCommandId();
if (commandId == null) {
return;
}
CommandResponseChan channel = CHANNEL.get(commandId);
if (Objects.isNull(channel)) {
return;
}
channel.future.complete(response);
}
}

View File

@ -0,0 +1,32 @@
package com.bdzl.iot.communication.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import com.bdzl.iot.enums.DeviceCommandEnum;
/**
* 设备命令对象
*
* @author LSF maku_lsf@163.com
*/
@Data
@Schema(description = "设备命令对象")
public class DeviceCommandDTO extends BaseDeviceID {
/**
* 命令类型
*/
@Schema(description = "命令类型", required = true)
private DeviceCommandEnum command;
/**
* 命令id
*/
@Schema(description = "命令id", required = true)
private String id;
/**
* 命令内容
*/
@Schema(description = "命令内容")
private String payload;
}

Some files were not shown because too many files have changed in this diff Show More