初始化dev

This commit is contained in:
2025-09-08 14:23:44 +08:00
parent 0ea0e0c5d4
commit e56a2e7873
98 changed files with 4670 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
dashscope:
api-key: sk-58d6fed688c54e8db02e6a7ffbfc7a5f
deepseek:
api-url: https://api.deepseek.com/chat/completions
api-key: sk-faaa2a1b485442ccbf115ff1271a3480
spring:
datasource:
url: jdbc:mysql://gz-cynosdbmysql-grp-5ai5zw7r.sql.tencentcdb.com:24944/ai_interview?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
username: qingqiu
password: 020979hP
driver-class-name: com.mysql.cj.jdbc.Driver
# ai:
# openai:
# api-key: sk-faaa2a1b485442ccbf115ff1271a3480
# base-url: https://api.deepseek.com
# chat:
# options:
# model: deepseek-chat
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-field: deleted # 全局逻辑删除字段名
logic-delete-value: 1 # 逻辑已删除值。可选,默认值为 1
logic-not-delete-value: 0 # 逻辑未删除值。可选,默认值为 0

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qingqiu.interview.mapper.InterviewSessionMapper">
<select id="selectBySessionId" resultType="com.qingqiu.interview.entity.InterviewSession">
SELECT * FROM interview_session
WHERE session_id = #{sessionId} AND deleted = 0
</select>
<select id="selectActiveSessionsByModel" resultType="com.qingqiu.interview.entity.InterviewSession">
SELECT * FROM interview_session
WHERE ai_model = #{aiModel} AND status = 'ACTIVE' AND deleted = 0
ORDER BY created_time DESC
</select>
<update id="updateSessionStatus">
UPDATE interview_session
SET status = #{status}, updated_time = NOW()
WHERE session_id = #{sessionId}
</update>
<select id="countRecentInterviews" resultType="com.qingqiu.interview.dto.DashboardStatsResponse$DailyStat">
SELECT DATE(created_time) as date, COUNT(*) as count
FROM interview_session
WHERE created_time >= DATE_SUB(NOW(), INTERVAL #{days} DAY)
GROUP BY DATE(created_time)
ORDER BY date ASC
</select>
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qingqiu.interview.mapper.AiSessionLogMapper">
</mapper>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qingqiu.interview.mapper.InterviewEvaluationMapper">
<select id="selectBySessionId" resultType="com.qingqiu.interview.entity.InterviewEvaluation">
SELECT * FROM interview_evaluation
WHERE session_id = #{sessionId}
ORDER BY created_time ASC
</select>
<select id="selectBySessionIdAndQuestionId" resultType="com.qingqiu.interview.entity.InterviewEvaluation">
SELECT * FROM interview_evaluation
WHERE session_id = #{sessionId} AND question_id = #{questionId}
LIMIT 1
</select>
</mapper>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qingqiu.interview.mapper.InterviewMessageMapper">
<select id="selectBySessionIdOrderByOrder" resultType="com.qingqiu.interview.entity.InterviewMessage">
SELECT * FROM interview_message
WHERE session_id = #{sessionId}
ORDER BY message_order ASC
</select>
<select id="selectLatestBySessionId" resultType="com.qingqiu.interview.entity.InterviewMessage">
SELECT * FROM interview_message
WHERE session_id = #{sessionId}
ORDER BY message_order DESC
LIMIT 1
</select>
<select id="selectMaxOrderBySessionId" resultType="int">
SELECT COALESCE(MAX(message_order), 0) FROM interview_message
WHERE session_id = #{sessionId}
</select>
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qingqiu.interview.mapper.InterviewQuestionProgressMapper">
</mapper>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qingqiu.interview.mapper.QuestionMapper">
<select id="selectByCategory" resultType="com.qingqiu.interview.entity.Question">
SELECT *
FROM question
WHERE category = #{category} AND deleted = 0
ORDER BY created_time DESC
</select>
<select id="selectByCategories" resultType="com.qingqiu.interview.entity.Question">
SELECT *
FROM question
WHERE category IN
<foreach collection="categories" item="category" open="(" separator="," close=")">
#{category}
</foreach>
AND deleted = 0
ORDER BY created_time DESC
</select>
<select id="selectRandomByCategories" resultType="com.qingqiu.interview.entity.Question">
SELECT *
FROM question
WHERE category IN
<foreach collection="categories" item="category" open="(" separator="," close=")">
#{category}
</foreach>
AND deleted = 0
ORDER BY RAND()
LIMIT #{limit}
</select>
<select id="selectByContent" resultType="com.qingqiu.interview.entity.Question">
SELECT *
FROM question
WHERE content = #{content} AND deleted = 0
LIMIT 1
</select>
<select id="countByCategory" resultType="com.qingqiu.interview.dto.DashboardStatsResponse$CategoryStat">
SELECT category as name, COUNT(*) as value
FROM question
WHERE deleted = 0
GROUP BY category
ORDER BY value DESC
</select>
</mapper>

View File

@@ -0,0 +1,57 @@
-- 题库表
CREATE TABLE IF NOT EXISTS question (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
content TEXT NOT NULL COMMENT '题目内容',
category VARCHAR(100) NOT NULL COMMENT '题目分类',
difficulty VARCHAR(20) NOT NULL COMMENT '难度等级',
tags VARCHAR(500) COMMENT '标签,逗号分隔',
created_time DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted TINYINT DEFAULT 0 COMMENT '逻辑删除标记'
);
-- 面试会话表
CREATE TABLE IF NOT EXISTS interview_session (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
session_id VARCHAR(64) UNIQUE NOT NULL COMMENT '会话唯一标识',
candidate_name VARCHAR(100) COMMENT '候选人姓名',
resume_content TEXT COMMENT '简历内容',
extracted_skills TEXT COMMENT '提取的技能JSON格式',
ai_model VARCHAR(50) NOT NULL COMMENT '使用的AI模型',
status VARCHAR(20) DEFAULT 'ACTIVE' COMMENT '会话状态ACTIVE, COMPLETED, TERMINATED',
total_questions INT DEFAULT 0 COMMENT '总问题数',
current_question_index INT DEFAULT 0 COMMENT '当前问题索引',
score DECIMAL(5,2) COMMENT '面试评分',
selected_question_ids TEXT COMMENT 'AI选择的题目ID列表JSON格式',
final_report TEXT COMMENT 'AI生成的最终面试报告JSON格式',
created_time DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
deleted TINYINT DEFAULT 0
);
-- 面试消息记录表
CREATE TABLE IF NOT EXISTS interview_message (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
session_id VARCHAR(64) NOT NULL COMMENT '会话ID',
message_type VARCHAR(20) NOT NULL COMMENT '消息类型QUESTION, ANSWER, SYSTEM',
sender VARCHAR(20) NOT NULL COMMENT '发送者AI, USER, SYSTEM',
content TEXT NOT NULL COMMENT '消息内容',
question_id BIGINT COMMENT '关联的题目ID',
message_order INT NOT NULL COMMENT '消息顺序',
created_time DATETIME DEFAULT CURRENT_TIMESTAMP,
INDEX idx_session_id (session_id),
INDEX idx_session_order (session_id, message_order)
);
-- 面试评估表
CREATE TABLE IF NOT EXISTS interview_evaluation (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
session_id VARCHAR(64) NOT NULL COMMENT '会话ID',
question_id BIGINT COMMENT '题目ID',
user_answer TEXT COMMENT '用户回答',
ai_feedback TEXT COMMENT 'AI反馈',
score DECIMAL(3,1) COMMENT '单题得分',
evaluation_criteria TEXT COMMENT '评估标准JSON格式',
created_time DATETIME DEFAULT CURRENT_TIMESTAMP,
INDEX idx_session_id (session_id)
);