chore: 初始化docker构建仓库

This commit is contained in:
BenjaminNH 2025-08-06 21:44:03 +08:00
commit e7aaaf3af8
13 changed files with 1461 additions and 0 deletions

39
Dockerfile Normal file
View File

@ -0,0 +1,39 @@
# 基于mysql官方镜像debian版本自带apt-get方便安装其他环境
FROM mysql:8.0.43-debian
# 设置中文和UTF-8编码
RUN apt-get update && \
apt-get install -y locales && \
sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen zh_CN.UTF-8 && \
echo 'LANG=zh_CN.UTF-8' > /etc/locale.conf
ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
# 1. 安装 nginx 与 openjdk-17
RUN apt-get update && \
apt-get install -y --no-install-recommends nginx openjdk-17-jre-headless && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# 2. 复制文件
COPY equip-reserve-backend.jar /app/equip-reserve-backend.jar
COPY dist /usr/share/nginx/html
COPY db/*.sql /docker-entrypoint-initdb.d/
COPY nginx.conf /etc/nginx/nginx.conf
# 声明数据卷
VOLUME ["/equip-reserve", "/mysql_data", "/device_image", "/logs"]
# 设置数据库相关环境变量
ENV MYSQL_ROOT_PASSWORD=root123
ENV MYSQL_DATABASE=equip_reserve
ENV MYSQL_USER=equip
ENV MYSQL_PASSWORD=equip123
# 复制启动入口脚本
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
EXPOSE 5173
ENTRYPOINT ["/docker-entrypoint.sh"]

56
README.md Normal file
View File

@ -0,0 +1,56 @@
<h1>电科院材料所实验室仪器设备预约系统-Docker镜像构建</h1>
由于客户的服务器只能内网使用,所以在开发机构建并导出好一个单体镜像,再由客户导入到服务器上运行更为方便。相关文件内均有详细注释
# 镜像构建
## 1. 镜像构建目录结构
```
./
├─ Dockerfile
├─ docker-entrypoint.sh
├─ nginx.conf
├─ equip-reserve-backend.jar
└─ dist/ # 前端构建产物
├─ index.html
├─ db/ # 数据库初始化脚本,按文件名顺序执行
├─ 01_schema.sql
└─ 02_data.sql
```
## 2. 构建及导出镜像
1. 构建
```shell
docker build -t equip-reserve .
```
2. 导出镜像
```shell
docker save equip-reserve:latest -o equip-reserve-latest.tar
```
# 镜像运行
## 宿主机目录结构
```
deploy/
├─ equip-reserve-latest.tar
├─ deploy.sh # 一键启动脚本
└─ equip-reserve/ # 挂载卷目录
├─ dist/ # 前端构建产物,替换重启容器即可更新
├─ equip-reserve-backend.jar # 后端jar包
├─ device_image/ # 设备图片挂载目录
├─ logs/ # 后端日志挂载目录
└─ mysql_data # 数据库数据挂载目录
```
## 宿主机运行
```shell
chmod +x deploy.sh
./deploy.sh
```

82
db/01_schema.sql Normal file
View File

@ -0,0 +1,82 @@
-- 创建数据库
CREATE DATABASE IF NOT EXISTS equip_reserve DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `equip_reserve`;
-- 用户表
CREATE TABLE users
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
name VARCHAR(50),
phone VARCHAR(20),
team_id BIGINT,
enabled BOOLEAN DEFAULT TRUE,
created_time DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- 角色表
CREATE TABLE roles
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
code VARCHAR(30) NOT NULL UNIQUE,
name VARCHAR(50) NOT NULL
);
-- 用户-角色关联表
CREATE TABLE user_roles
(
user_id BIGINT NOT NULL,
role_id BIGINT NOT NULL,
PRIMARY KEY (user_id, role_id)
);
-- 团队表
CREATE TABLE teams
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
created_time DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- 设备表
CREATE TABLE devices
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
usage_requirement TEXT,
location VARCHAR(255),
image_path VARCHAR(255),
status VARCHAR(20) NOT NULL default 'AVAILABLE',
team_id BIGINT NOT NULL,
device_admin_id BIGINT,
created_time DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- 预约记录表
CREATE TABLE reservations
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
device_id BIGINT NOT NULL,
user_id BIGINT NOT NULL,
start_time DATE NOT NULL,
end_time DATE NOT NULL,
applicant_name VARCHAR(50) NOT NULL,
applicant_team VARCHAR(50),
applicant_contact VARCHAR(50),
status VARCHAR(30) NOT NULL,
device_admin_id BIGINT,
created_time DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- 审批记录表
CREATE TABLE approvals
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
reservation_id BIGINT NOT NULL,
step TINYINT NOT NULL,
approver_id BIGINT NOT NULL,
decision TINYINT NOT NULL,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
);

6
db/02_data_role.sql Normal file
View File

@ -0,0 +1,6 @@
-- 初始角色数据
INSERT INTO roles (id, code, name)
VALUES (1, 'ADMIN', '系统管理员'),
(2, 'LEADER', '团队负责人'),
(3, 'DEVICE_ADMIN', '设备管理员'),
(4, 'USER', '用户');

9
db/03_data_teams.sql Normal file
View File

@ -0,0 +1,9 @@
INSERT INTO teams (id, name) VALUES (1, '绝缘(电缆)');
INSERT INTO teams (id, name) VALUES (2, '绝缘(电容器)');
INSERT INTO teams (id, name) VALUES (3, '磁性(超薄硅钢)');
INSERT INTO teams (id, name) VALUES (4, '磁性(高磁感硅钢)');
INSERT INTO teams (id, name) VALUES (5, '导体');
INSERT INTO teams (id, name) VALUES (6, '防护(降噪)');
INSERT INTO teams (id, name) VALUES (7, '防护(腐蚀)');
INSERT INTO teams (id, name) VALUES (8, '交叉(实验室)');
INSERT INTO teams (id, name) VALUES (9, '交叉(环氧)');

610
db/04_data_users.sql Normal file
View File

@ -0,0 +1,610 @@
START TRANSACTION;
-- 用户数据与角色关联
-- 管理员
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('admin', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '总管理员', '', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 1);
-- 用户: 李文鹏
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liwenpeng', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '李文鹏', '15300341553', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 史晓宁
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('shixiaoning', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '史晓宁', '18611951666', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 赵维佳
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhaoweijia', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '赵维佳', '13693020532', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 李石琨
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('lishikun', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '李石琨', '13020095677', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘英健
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liuyingjian', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘英健', '18810085301', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 周洋
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhouyang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '周洋', '15910777276', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 毕舒馨
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('bishuxin', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '毕舒馨', '17888803487', 1);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 邢照亮
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('xingzhaoliang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '邢照亮', '15811444029', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 郭少玮
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('guoshaowei', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '郭少玮', '18810702981', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 苏尧天
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('suyaotian', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '苏尧天', '15369275910', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘炬阳
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liujuyang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘炬阳', '17602637613', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 王博
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('wangbo', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '王博', '13621001394', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 杨博
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('yangbo', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '杨博', '15510260661', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张兆天
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangzhaotian', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张兆天', '19912458230', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘天兴
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liutianxing', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘天兴', '13466589533', 2);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 杨富尧
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('yangfuyao', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '杨富尧', '18612978836', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 高洁
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('gaojie', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '高洁', '18500972707', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 刘洋
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liuyang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘洋', '18612694337', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 王聪
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('wangcong', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '王聪', '13264467237', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 孙浩
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('sunhao', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '孙浩', '15101136606', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘成宇
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liuchengyu', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘成宇', '13840525697', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 李伟
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liwei', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '李伟', '18660898500', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 尚以磊
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('shangyilei', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '尚以磊', '15998820462', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 时宇新
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('shiyuxin', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '时宇新', '15321306918', 3);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 马光
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('maguang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '马光', '13811679926', 4);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 何承绪
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('hechengxu', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '何承绪', '18813056867', 4);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 田丛宽
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('tiancongkuan', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '田丛宽', '18810561393', 4);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 邓凯伟
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('dengkaiwei', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '邓凯伟', '13613213772', 4);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 丁一
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('dingyi', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '丁一', '13693265696', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 陈保安
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('chenbaoan', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '陈保安', '15001236907', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘倓
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liutan', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘倓', '15201243807', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 庞震
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('pangzhen', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '庞震', '17810288985', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 高健峰
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('gaojianfeng', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '高健峰', '18801251185', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 赵兴雨
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhaoxingyu', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '赵兴雨', '18611572588', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张丛睿
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangcongrui', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张丛睿', '18613838958', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 李梦琳
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('limenglin1', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '李梦琳', '18811505739', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张捷欣
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangjiexin', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张捷欣', '15071109936', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘文杰
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liuwenjie', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘文杰', '18810393772', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 陈瑞
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('chenrui1', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '陈瑞', '18801183169', 5);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 聂京凯
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('niejingkai1', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '聂京凯', '13811205510', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 何强
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('heqiang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '何强', '15810868821', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张一铭
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangyiming', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张一铭', '18519696605', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 田一
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('tianyi', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '田一', '18501949381', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 樊超
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('fanchao', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '樊超', '13681563658', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘晓圣
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liuxiaosheng', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘晓圣', '18811345505', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 侯东
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('houdong', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '侯东', '15101052027', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 姬军
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('jijun', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '姬军', '15201457665', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 刘浩
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('liuhao', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '刘浩', '17716537109', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 尹航
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('yinhang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '尹航', '18500738660', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张世乘
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangshicheng', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张世乘', '13231339242', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 田辰
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('tianchen', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '田辰', '13844645059', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张陈博凡
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangchen', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张陈博凡', '13284227163', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 何兴
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('hexing', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '何兴', '17717154888', 6);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张强
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangqiang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张强', '13601210056', 7);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 王晓芳
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('wangxiaofang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '王晓芳', '13811432198', 7);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 陈云
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('chenyun', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '陈云', '13651214286', 7);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 杨丙坤
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('yangbingkun', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '杨丙坤', '15711469923', 7);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 卢壹梁
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('luyiliang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '卢壹梁', '15270852029', 7);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 赵广耀
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhaoguangyao', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '赵广耀', '15210674244', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 潘学东
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('panxuedong', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '潘学东', '13426432632', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 姚佳康
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('yaojiakang', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '姚佳康', '15226501286', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 郭玉龙
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('guoyulong', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '郭玉龙', '13146654667', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 赵蕊
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhaorui1', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '赵蕊', '13621012074', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 肖永明
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('xiaoyongming', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '肖永明', '15901504096', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 杨立新
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('yanglixin', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '杨立新', '13488882505', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 程娜
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('chengna', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '程娜', '15201461257', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 赵哲惠
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhaozhehui', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '赵哲惠', '18101123770', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 张思行
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhangsixing', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '张思行', '15521305044', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 李震
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('lzh', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '李震', '18612978848', 8);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 崔惠泽
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('cuihuize', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '崔惠泽', '13669234892', 9);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 2);
-- 用户: 陈铄
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('chenshuo', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '陈铄', '18222779112', 9);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 3);
-- 用户: 郭瑞鲁
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('guoruilu', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '郭瑞鲁', '18810663757', 9);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 罗楚濛
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('luochumeng', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '罗楚濛', '18810793857', 9);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 赵超锋
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('zhaochaofeng', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '赵超锋', '18810078180', 9);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
-- 用户: 顾雯雯
INSERT INTO users (username, password, name, phone, team_id)
VALUES ('guwenwen', '$2a$10$U64Wy8Yz4BlrtmrZG8xXSu9r/NUuoGv2ZVqu.A.gUqNolxZgDHGtq', '顾雯雯', '13141308181', 9);
INSERT INTO user_roles (user_id, role_id)
VALUES (LAST_INSERT_ID(), 4);
COMMIT;

66
deploy/deploy.sh Normal file
View File

@ -0,0 +1,66 @@
#!/bin/bash
set -e
# ========= 可配置常量 =========
IMG_TAR="equip-reserve-latest.tar"
CONTAINER_NAME="equip-reserve"
HOST_PORT=5173
# 脚本所在目录作为根目录
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
# 各挂载子目录
EQ_DIR="${BASE_DIR}/equip-reserve"
MYSQL_DATA_DIR="${EQ_DIR}/mysql_data"
DEVICE_IMG_DIR="${EQ_DIR}/device_image"
LOGS_DIR="${EQ_DIR}/logs"
# ==============================
echo "=== Equip-Reserve 一键部署 ==="
echo "脚本目录: ${BASE_DIR}"
# ===== 防火墙配置 =====
echo "正在配置防火墙..."
if command -v ufw >/dev/null 2>&1; then
# Ubuntu 默认 ufw
echo "使用ufw配置防火墙"
ufw allow 5173/tcp comment "equip-reserve web"
ufw reload
elif command -v firewall-cmd >/dev/null 2>&1; then
# CentOS/RHEL 7+
echo "使用firewall配置防火墙"
firewall-cmd --permanent --add-port=5173/tcp
firewall-cmd --reload
else
# 纯 iptables 保底
echo "暂时使用保底iptables配置持久化需安装 iptables-persistent"
iptables -C INPUT -p tcp --dport 5173 -j ACCEPT 2>/dev/null || \
iptables -I INPUT -p tcp --dport 5173 -j ACCEPT
# 如有需要保存规则Ubuntu 18 默认无持久化,需安装 iptables-persistent
fi
echo "防火墙 5173 端口已放行"
echo "开启启动设备管理系统"
# 1. 导入镜像(如果已存在则跳过)
if ! docker images | grep -q "equip-reserve"; then
echo "正在导入离线镜像..."
docker load -i "${BASE_DIR}/${IMG_TAR}"
else
echo "镜像已存在,跳过导入"
fi
# 2. 如果旧容器还在,先停掉并删除
docker rm -f "${CONTAINER_NAME}" 2>/dev/null || true
# 3. 启动容器
echo "正在启动容器..."
docker run -d \
--name "${CONTAINER_NAME}" \
-p "${HOST_PORT}:5173" \
-v "${EQ_DIR}":/equip-reserve \
-v "${MYSQL_DATA_DIR}":/var/lib/mysql \
-v "${DEVICE_IMG_DIR}":/device_image \
-v "${LOGS_DIR}":/logs \
-e TZ=Asia/Shanghai \
equip-reserve:latest
echo "系统已启动!"
echo "浏览器访问http://<离线机IP>:${HOST_PORT}"

521
dist/assets/index-D1eq4NRT.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/assets/index-y5rd0Sgy.css vendored Normal file
View File

@ -0,0 +1 @@
/*! tailwindcss v4.1.10 | MIT License | https://tailwindcss.com */@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-600:oklch(57.7% .245 27.325);--color-gray-800:oklch(27.8% .033 256.848);--spacing:.25rem;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.m-4{margin:calc(var(--spacing)*4)}.m-6{margin:calc(var(--spacing)*6)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.flex{display:flex}.inline{display:inline}.h-screen{height:100vh}.w-1\/4{width:25%}.w-screen{width:100vw}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-6{padding-right:calc(var(--spacing)*6)}.font-mono{font-family:var(--font-mono)}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-gray-800{color:var(--color-gray-800)}.text-red-600{color:var(--color-red-600)}}

14
dist/index.html vendored Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>电科院材料所实验室仪器设备预约系统</title>
<script type="module" crossorigin src="/assets/index-D1eq4NRT.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-y5rd0Sgy.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

22
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
# 1. 如果宿主机 /equip-reserve 目录里提供了新 jar / dist则覆盖镜像内的
[ -f /equip-reserve/equip-reserve-backend.jar ] && cp -f /equip-reserve/equip-reserve-backend.jar /app/equip-reserve-backend.jar
[ -d /equip-reserve/dist ] && cp -rf /equip-reserve/dist/* /usr/share/nginx/html/
# 2. 启动 mysql执行官方镜像中的启动脚本
# 官方镜像会按字母顺序执行/docker-entrypoint-initdb.d/下的脚本,实现数据初始化
docker-entrypoint.sh mysqld &
# 3. 等待 mysql 就绪
until mysqladmin ping -hlocalhost -P3306 --silent; do
echo "waiting for mysql..."
sleep 1
done
# 4. 启动 nginx
nginx
# 5. 启动 spring boot
exec java -jar /app/equip-reserve-backend.jar --spring.profiles.active=prod > /dev/null 2>&1

BIN
equip-reserve-backend.jar Normal file

Binary file not shown.

35
nginx.conf Normal file
View File

@ -0,0 +1,35 @@
user root;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
server {
listen 5173;
root /usr/share/nginx/html;
index index.html;
client_max_body_size 20M;
location / {
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}