Skip to content

Commit a6ea0de

Browse files
authored
feat: app template and login API (#273)
1 parent 0854dde commit a6ea0de

File tree

74 files changed

+3582
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3582
-259
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ COPY --from=build /app/documents /app/documents
1818
COPY --from=build /app/all-MiniLM-L6-v2 /app/all-MiniLM-L6-v2
1919
# 设置环境变量
2020
ENV FOLDER_PATH="/app/documents"
21-
# 替换为自己的域名接口路径
22-
ENV TINY_ENGINE_URL="https://agent.opentiny.design/material-center/api/resource/download"
21+
2322
ENTRYPOINT ["java", "-jar", "tiny-engine-app.jar", "--spring.profiles.active=alpha"]
2423
EXPOSE 9090
2524

app/src/main/java/com/tinyengine/it/config/context/DefaultLoginUserContext.java

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
drop table if exists `t_permission_role`;
2+
3+
create table `t_permission_role`
4+
(
5+
`id` int not null auto_increment comment '主键id',
6+
`name` varchar(255) not null comment '名称',
7+
`description` varchar(2000) comment '描述',
8+
`created_by` varchar(60) not null comment '创建人',
9+
`created_time` timestamp not null default current_timestamp comment '创建时间',
10+
`last_updated_by` varchar(60) not null comment '最后修改人',
11+
`last_updated_time` timestamp not null default current_timestamp comment '更新时间',
12+
primary key (`id`) using btree,
13+
unique index `u_idx_permission_role` (`name`) using btree
14+
) engine = innodb comment = '';
15+
16+
drop table if exists `r_auth_users_units_roles`;
17+
18+
create table `r_auth_users_units_roles`
19+
(
20+
`id` int not null auto_increment comment '主键id',
21+
`user_id` int not null comment '用户',
22+
`unit_id` int not null comment '业务单元',
23+
`unit_type` varchar(60) not null comment '业务单元类型',
24+
`tenant_id` int not null comment '组织id',
25+
`role_id` int not null comment '角色id',
26+
`expired_time` timestamp comment '过期时间',
27+
`created_by` varchar(60) not null comment '创建人',
28+
`created_time` timestamp not null default current_timestamp comment '创建时间',
29+
`last_updated_by` varchar(60) not null comment '最后修改人',
30+
`last_updated_time` timestamp not null default current_timestamp comment '更新时间',
31+
primary key (`id`) using btree,
32+
unique index `u_idx_auth_users_units_roles` (`user_id`, `unit_id`, `unit_type`) using btree
33+
) engine = innodb comment = '';
34+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (1, 'personnelAdministration', '人事行政', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
2+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (2, 'projectManagement', '项目管理', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
3+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (3, 'procurementManagement', '采购管理', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
4+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (4, 'financialReimbursement', '财务报销', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
5+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (5, 'equipmentInspection', '设备巡检', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
6+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (6, 'afterSales', '工单售后', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
7+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (7, 'manufacturing', '制造业', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
8+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (8, 'educationIndustry', '教育行业', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
9+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (9, 'tradeRetail', '贸易零售', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
10+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (10, 'constructionIndustry', '建筑行业', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
11+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (11, 'governmentAgency', '政府机构', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
12+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (12, 'Internet', '互联网', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
13+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (13, 'serviceTraining', '服务培训', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (1, 'Tinybuilder_Admin', '超级管理员', '1', '2025-10-29 01:37:10', '1', '2025-10-29 01:37:10');
2+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (2, 'Tinybuilder_Tenant_Admin', '组织管理员', '1', '2025-10-29 01:37:36', '1', '2025-10-29 01:37:36');
3+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (3, 'Tinybuilder_Platform_Admin', '设计器管理员', '1', '2025-10-29 01:38:00', '1', '2025-10-29 01:38:00');
4+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (4, 'Tinybuilder_App_Admin', '应用管理员', '1', '2025-10-29 01:39:06', '1', '2025-10-29 01:39:06');
5+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (5, 'Tinybuilder_App_Developer', '应用开发者', '1', '2025-10-29 01:39:26', '1', '2025-10-29 01:39:26');
6+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (6, 'Guest', '游客', '1', '2025-10-29 01:39:38', '1', '2025-10-29 01:39:38');
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ALTER TABLE t_app
2+
ADD COLUMN is_template VARCHAR(100) AFTER is_default;
3+
ALTER TABLE t_app
4+
ADD COLUMN industry_id INT AFTER platform_id;
5+
ALTER TABLE t_app
6+
ADD COLUMN scene_id INT AFTER industry_id;
7+
8+
ALTER TABLE t_app DROP INDEX u_idx_app;
9+
ALTER TABLE t_app
10+
ADD INDEX u_idx_app (`tenant_id`, `platform_id`, `name`, `is_template`);
11+
12+
ALTER TABLE t_business_category
13+
ADD COLUMN business_group VARCHAR(100) AFTER `name`;
14+
15+
ALTER TABLE t_datasource DROP INDEX u_idx_datasource;
16+
ALTER TABLE t_datasource
17+
ADD INDEX u_idx_datasource (`tenant_id`, `platform_id`, `name`, `app_id`);
18+
19+
ALTER TABLE t_app_extension
20+
ADD COLUMN platform_id INT AFTER app_id;
21+
ALTER TABLE t_app_extension DROP INDEX u_idx_app_extension;
22+
ALTER TABLE t_app_extension
23+
ADD INDEX u_idx_app_extension (`tenant_id`, `platform_id`, `name`, `app_id`);
24+
25+
ALTER TABLE t_model
26+
ADD COLUMN app_id INT AFTER id;
27+
ALTER TABLE t_model
28+
ADD COLUMN platform_id INT AFTER app_id;
29+
ALTER TABLE t_model DROP INDEX u_idx_model;
30+
ALTER TABLE t_model
31+
ADD INDEX u_idx_model (`tenant_id`, `platform_id`, `app_id`, `name_cn`,`version`);
32+
33+
ALTER TABLE t_user DROP COLUMN email, DROP COLUMN tenant_id, DROP COLUMN site_id,DROP COLUMN renter_id,DROP COLUMN created_by,DROP COLUMN last_updated_by;
34+
35+
36+
ALTER TABLE t_user
37+
ADD COLUMN password VARCHAR(200) AFTER username;
38+
ALTER TABLE t_user
39+
ADD COLUMN email VARCHAR(200) AFTER password;
40+
ALTER TABLE t_user
41+
ADD COLUMN salt VARCHAR(200) AFTER password;
42+
ALTER TABLE t_user
43+
ADD COLUMN public_key VARCHAR(200) AFTER salt;
44+
ALTER TABLE t_user
45+
ADD COLUMN private_key VARCHAR(200) AFTER public_key;
46+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
drop table if exists `t_permission_role`;
2+
3+
create table `t_permission_role`
4+
(
5+
`id` int not null auto_increment comment '主键id',
6+
`name` varchar(255) not null comment '名称',
7+
`description` varchar(2000) comment '描述',
8+
`created_by` varchar(60) not null comment '创建人',
9+
`created_time` timestamp not null default current_timestamp comment '创建时间',
10+
`last_updated_by` varchar(60) not null comment '最后修改人',
11+
`last_updated_time` timestamp not null default current_timestamp comment '更新时间',
12+
primary key (`id`) using btree,
13+
unique index `u_idx_permission_role` (`name`) using btree
14+
) engine = innodb comment = '';
15+
16+
drop table if exists `r_auth_users_units_roles`;
17+
18+
create table `r_auth_users_units_roles`
19+
(
20+
`id` int not null auto_increment comment '主键id',
21+
`user_id` int not null comment '用户',
22+
`unit_id` int not null comment '业务单元',
23+
`unit_type` varchar(60) not null comment '业务单元类型',
24+
`tenant_id` int not null comment '组织id',
25+
`role_id` int not null comment '角色id',
26+
`expired_time` timestamp comment '过期时间',
27+
`created_by` varchar(60) not null comment '创建人',
28+
`created_time` timestamp not null default current_timestamp comment '创建时间',
29+
`last_updated_by` varchar(60) not null comment '最后修改人',
30+
`last_updated_time` timestamp not null default current_timestamp comment '更新时间',
31+
primary key (`id`) using btree,
32+
unique index `u_idx_auth_users_units_roles` (`user_id`, `unit_id`, `unit_type`) using btree
33+
) engine = innodb comment = '';
34+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (1, 'personnelAdministration', '人事行政', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
2+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (2, 'projectManagement', '项目管理', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
3+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (3, 'procurementManagement', '采购管理', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
4+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (4, 'financialReimbursement', '财务报销', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
5+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (5, 'equipmentInspection', '设备巡检', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
6+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (6, 'afterSales', '工单售后', '场景', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
7+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (7, 'manufacturing', '制造业', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
8+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (8, 'educationIndustry', '教育行业', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
9+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (9, 'tradeRetail', '贸易零售', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
10+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (10, 'constructionIndustry', '建筑行业', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
11+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (11, 'governmentAgency', '政府机构', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
12+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (12, 'Internet', '互联网', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
13+
INSERT INTO `t_business_category` (`id`, `code`, `name`, `business_group`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (13, 'serviceTraining', '服务培训', '行业', '1', '1', '1', '1', '2025-10-14 00:26:27', '1', '2025-10-14 00:26:27');
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (1, 'Tinybuilder_Admin', '超级管理员', '1', '2025-10-29 01:37:10', '1', '2025-10-29 01:37:10');
2+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (2, 'Tinybuilder_Tenant_Admin', '组织管理员', '1', '2025-10-29 01:37:36', '1', '2025-10-29 01:37:36');
3+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (3, 'Tinybuilder_Platform_Admin', '设计器管理员', '1', '2025-10-29 01:38:00', '1', '2025-10-29 01:38:00');
4+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (4, 'Tinybuilder_App_Admin', '应用管理员', '1', '2025-10-29 01:39:06', '1', '2025-10-29 01:39:06');
5+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (5, 'Tinybuilder_App_Developer', '应用开发者', '1', '2025-10-29 01:39:26', '1', '2025-10-29 01:39:26');
6+
INSERT INTO `t_permission_role` (`id`, `name`, `description`, `created_by`, `created_time`, `last_updated_by`, `last_updated_time`) VALUES (6, 'Guest', '游客', '1', '2025-10-29 01:39:38', '1', '2025-10-29 01:39:38');
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ALTER TABLE t_app
2+
ADD COLUMN is_template VARCHAR(100) AFTER is_default;
3+
ALTER TABLE t_app
4+
ADD COLUMN industry_id INT AFTER platform_id;
5+
ALTER TABLE t_app
6+
ADD COLUMN scene_id INT AFTER industry_id;
7+
8+
ALTER TABLE t_app DROP INDEX u_idx_app;
9+
ALTER TABLE t_app
10+
ADD INDEX u_idx_app (`tenant_id`, `platform_id`, `name`, `is_template`);
11+
12+
ALTER TABLE t_business_category
13+
ADD COLUMN business_group VARCHAR(100) AFTER `name`;
14+
15+
ALTER TABLE t_datasource DROP INDEX u_idx_datasource;
16+
ALTER TABLE t_datasource
17+
ADD INDEX u_idx_datasource (`tenant_id`, `platform_id`, `name`, `app_id`);
18+
19+
ALTER TABLE t_app_extension
20+
ADD COLUMN platform_id INT AFTER app_id;
21+
ALTER TABLE t_app_extension DROP INDEX u_idx_app_extension;
22+
ALTER TABLE t_app_extension
23+
ADD INDEX u_idx_app_extension (`tenant_id`, `platform_id`, `name`, `app_id`);
24+
25+
ALTER TABLE t_model
26+
ADD COLUMN app_id INT AFTER id;
27+
ALTER TABLE t_model
28+
ADD COLUMN platform_id INT AFTER app_id;
29+
ALTER TABLE t_model DROP INDEX u_idx_model;
30+
ALTER TABLE t_model
31+
ADD INDEX u_idx_model (`tenant_id`, `platform_id`, `app_id`, `name_cn`,`version`);
32+
33+
ALTER TABLE t_user DROP COLUMN email, DROP COLUMN tenant_id, DROP COLUMN site_id,DROP COLUMN renter_id,DROP COLUMN created_by,DROP COLUMN last_updated_by;
34+
35+
36+
ALTER TABLE t_user
37+
ADD COLUMN password VARCHAR(200) AFTER username;
38+
ALTER TABLE t_user
39+
ADD COLUMN email VARCHAR(200) AFTER password;
40+
ALTER TABLE t_user
41+
ADD COLUMN salt VARCHAR(200) AFTER password;
42+
ALTER TABLE t_user
43+
ADD COLUMN public_key VARCHAR(200) AFTER salt;
44+
ALTER TABLE t_user
45+
ADD COLUMN private_key VARCHAR(200) AFTER public_key;
46+

0 commit comments

Comments
 (0)