本节介绍本项目后端项目的开发工具及基础项目的搭建,包括开发工具介绍及后端项目的创建和依赖框架的引入及对应配置。
源码下载: 点击下载
讲解视频:
Uniapp+Springboot+Kimi实现模拟面试小程序-Springboot项目创建
一.开发工具
1.1 开发工具
- 前端: Visual Studio Code
- 后端: IntelliJ IDEA Community Edition 2024.2.1
- 移动端: HBuilderX/微信开发者工具
1.2 运行环境
- 前端:
- nodejs v20.17.0
- npm 10.8.2
- vue3
- 后端:
- jdk8
- mysql 8.0
- springboot 3.4.0
- 移动端:
- uniapp
- 微信小程序
1.3 第三方资源
使用kimi开发者平台,网址:https://platform.moonshot.cn/docs/api/chat#公开的服务地址
需注册账号并创建项目:
创建apikey:
二.项目搭建
2.1 项目创建
使用spring官网工具创建maven项目,路径:https://start.spring.io/
添加依赖项:
添加完依赖后导出pom文件:
导出后将项目导入idea,并进行maven导入:
2.2 依赖库引入
项目依赖maven创建,具体如下:
xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.junjunjun</groupId>
<artifactId>aiwork</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>aiwork</name>
<description>人工智能模拟面试小工具</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.0.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.9</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-jsqlparser</artifactId>
<version>3.5.9</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.25</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-sse</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
<source>src/main/api</source>
<source>src/main/dao</source>
<source>src/main/entity</source>
<source>src/main/sdk</source>
<source>src/main/vo</source>
<source>src/main/service</source>
<!-- 你可以添加更多的源代码目录 -->
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <source>17</source>-->
<!-- <target>17</target>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
2.3 项目结构
创建相关项目包,包括api/service/dao/vo/entity/等项目包,具体项目结构如下:
2.4 数据库表
sql
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80028
Source Host : localhost:3306
Source Schema : ai_work
Target Server Type : MySQL
Target Server Version : 80028
File Encoding : 65001
Date: 11/07/2025 21:12:48
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for junjunjun_interview
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_interview`;
CREATE TABLE `junjunjun_interview` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0',
`date` datetime NOT NULL,
`job` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`user` bigint NULL DEFAULT NULL,
`resume` bigint NULL DEFAULT NULL,
`result` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`scope` double NULL DEFAULT 0,
`status` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '1',
`type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_account`(`date` ASC) USING BTREE,
INDEX `user`(`user` ASC) USING BTREE,
INDEX `resume`(`resume` ASC) USING BTREE,
CONSTRAINT `junjunjun_interview_ibfk_1` FOREIGN KEY (`user`) REFERENCES `junjunjun_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `junjunjun_interview_ibfk_2` FOREIGN KEY (`resume`) REFERENCES `junjunjun_resume` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 128 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_log
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_log`;
CREATE TABLE `junjunjun_log` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`date` datetime NOT NULL,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`username` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`param` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`target` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`ip` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`requestmethod` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 151 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_menu
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_menu`;
CREATE TABLE `junjunjun_menu` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`compontent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`type` varchar(2) CHARACTER SET utf16le COLLATE utf16le_general_ci NULL DEFAULT NULL,
`sort_` int NULL DEFAULT NULL,
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`parent_id` bigint NULL DEFAULT NULL,
`permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `parent_id`(`parent_id` ASC) USING BTREE,
CONSTRAINT `junjunjun_menu_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `junjunjun_menu` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_question_item
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_question_item`;
CREATE TABLE `junjunjun_question_item` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`question` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`interview` bigint NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `junjunjun_question_item_ibfk_1`(`interview` ASC) USING BTREE,
CONSTRAINT `junjunjun_question_item_ibfk_1` FOREIGN KEY (`interview`) REFERENCES `junjunjun_interview` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 110 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_resume
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_resume`;
CREATE TABLE `junjunjun_resume` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`file` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`tag` varchar(255) CHARACTER SET utf16le COLLATE utf16le_general_ci NULL DEFAULT NULL,
`create_date` datetime NULL DEFAULT NULL,
`user_id` bigint NULL DEFAULT NULL,
`fileinfo` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_account`(`file` ASC) USING BTREE,
INDEX `junjunjun_resume_ibfk_1`(`user_id` ASC) USING BTREE,
CONSTRAINT `junjunjun_resume_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `junjunjun_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_role
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_role`;
CREATE TABLE `junjunjun_role` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_role_menu_item
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_role_menu_item`;
CREATE TABLE `junjunjun_role_menu_item` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`menu_id` bigint NOT NULL,
`role_id` bigint NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_roel`(`menu_id` ASC, `role_id` ASC) USING BTREE,
INDEX `role_id`(`role_id` ASC) USING BTREE,
CONSTRAINT `junjunjun_role_menu_item_ibfk_1` FOREIGN KEY (`menu_id`) REFERENCES `junjunjun_menu` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `junjunjun_role_menu_item_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `junjunjun_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 87 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_setting
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_setting`;
CREATE TABLE `junjunjun_setting` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`key_` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_user
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_user`;
CREATE TABLE `junjunjun_user` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`account` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`header` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`sex` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`openid` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_account`(`account` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 36 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for junjunjun_user_role_item
-- ----------------------------
DROP TABLE IF EXISTS `junjunjun_user_role_item`;
CREATE TABLE `junjunjun_user_role_item` (
`id` bigint NOT NULL AUTO_INCREMENT,
`deleted` int NOT NULL DEFAULT 0,
`user_id` bigint NOT NULL,
`role_id` bigint NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_roel`(`user_id` ASC, `role_id` ASC) USING BTREE,
INDEX `role_id`(`role_id` ASC) USING BTREE,
CONSTRAINT `junjunjun_user_role_item_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `junjunjun_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `junjunjun_user_role_item_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `junjunjun_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;