Merge remote-tracking branch 'origin/hot-fix' into hot-fix

# Conflicts:
#	Debate_backend/target/classes/application.yml
#	Debate_backend/target/classes/com/learning/newdemo/Dto/ArgumentDetailDTO.class
#	Debate_backend/target/classes/com/learning/newdemo/Dto/ConversationDTO.class
#	Debate_backend/target/classes/com/learning/newdemo/Dto/DebateDetailDTO.class
#	Debate_backend/target/classes/com/learning/newdemo/Dto/ReviewDetailDTO.class
#	Debate_backend/target/classes/com/learning/newdemo/controller/WxAIController.class
#	Debate_backend/target/classes/com/learning/newdemo/controller/WxConversationController.class
#	Debate_backend/target/classes/com/learning/newdemo/entity/WxArgument.class
#	Debate_backend/target/classes/com/learning/newdemo/entity/WxConversation.class
#	Debate_backend/target/classes/com/learning/newdemo/entity/WxDebate.class
#	Debate_backend/target/classes/com/learning/newdemo/entity/WxReview.class
#	Debate_backend/target/classes/com/learning/newdemo/service/impl/WxUserServiceImpl.class
#	Debate_backend/target/classes/com/learning/newdemo/util/JwtUtil.class
hot-fix
chantouRichard 2 months ago
commit 14f6b2d661

@ -77,6 +77,12 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20240303</version>
</dependency>
<!-- 测试依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>

@ -96,12 +96,11 @@ public class WxAIController {
@PostMapping("/debate")
public Result<Map<String, Object>> debate(@RequestHeader ("Authorization") String token, @RequestBody Map<String, String> params){
log.info("请求内容: {}", params);
String history = params.get("history");
String userMessage = params.get("userMessage");
conversationId = Long.parseLong(params.get("conversationId"));
try {
String debate = wxDebateService.GetDebate(history, userMessage);
String debate = wxDebateService.GetDebate(conversationId, userMessage);
if (debate == null) {
return Result.error("辩论获取失败");
}

@ -1,6 +1,6 @@
package com.learning.newdemo.service;
public interface WxDebateService {
String GetDebate(String history, String userMessage);
String GetDebate(Long conversationId, String userMessage);
long UpdateDebate(Long conversationId, String content, String userMessage, String token);
}

@ -1,19 +1,16 @@
package com.learning.newdemo.service.impl;
import org.json.JSONObject;
import org.json.JSONArray;
import com.learning.newdemo.entity.WxArgument;
import com.learning.newdemo.entity.WxConversation;
import com.learning.newdemo.mapper.WxArgumentMapper;
import com.learning.newdemo.mapper.WxConversationMapper;
import com.learning.newdemo.service.WxArgumentService;
import com.learning.newdemo.util.JwtUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@ -90,7 +87,16 @@ public class WxArgumentServiceImpl implements WxArgumentService {
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, headers);
ResponseEntity<String> response = _restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
return response.getBody();
if (response.getStatusCode() == HttpStatus.OK && response.getBody() != null) {
JSONObject json = new JSONObject(response.getBody());
JSONArray choices = json.getJSONArray("choices");
if (!choices.isEmpty()) {
JSONObject message = choices.getJSONObject(0).getJSONObject("message");
return message.getString("content");
}
}
return null;
} catch (Exception e) {
log.error("向AI获取立论失败", e);
return null;

@ -7,6 +7,8 @@ import com.learning.newdemo.mapper.WxDebateMapper;
import com.learning.newdemo.service.WxDebateService;
import com.learning.newdemo.util.JwtUtil;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
@ -48,12 +50,22 @@ public class WxDebateServiceImpl implements WxDebateService {
}
@Override
public String GetDebate(String history, String userMessage){
public String GetDebate(Long conversationId, String userMessage){
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Authorization", authorizationHeader);
String history;
if(conversationId == -1){
history = "";
}
else {
history = wxDebateMapper.selectByConversationId(conversationId).stream()
.map(WxDebate::getContent)
.reduce("", (a, b) -> a + b);
}
StringBuilder requestBodyBuilder = new StringBuilder();
requestBodyBuilder.append("{")
.append("\"messages\": [")
@ -86,7 +98,17 @@ public class WxDebateServiceImpl implements WxDebateService {
log.info("请求体:{}", requestBody);
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
return response.getBody();
if (response.getStatusCode() == HttpStatus.OK && response.getBody() != null) {
JSONObject json = new JSONObject(response.getBody());
JSONArray choices = json.getJSONArray("choices");
if (!choices.isEmpty()) {
JSONObject message = choices.getJSONObject(0).getJSONObject("message");
return message.getString("content");
}
}
return null;
} catch (Exception e){
log.error("模拟辩论获取失败", e);
return null;
@ -115,6 +137,8 @@ public class WxDebateServiceImpl implements WxDebateService {
wxConversation.setPreview(content.substring(0, Math.min(content.length(), 10)));
wxConversation.setCreateTime(new Date());
wxConversation.setUpdateTime(new Date());
wxConversationMapper.insert(wxConversation);
relatedConversationId = wxConversation.getId();
}
else{
wxConversationMapper.updatePreview(conversationId, content.substring(0, Math.min(content.length(), 10)));

@ -7,6 +7,8 @@ import com.learning.newdemo.mapper.WxReviewMapper;
import com.learning.newdemo.service.WxReviewService;
import com.learning.newdemo.util.JwtUtil;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
@ -85,7 +87,16 @@ public class WxReviewServiceImpl implements WxReviewService {
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
return response.getBody();
if (response.getStatusCode() == HttpStatus.OK && response.getBody() != null) {
JSONObject json = new JSONObject(response.getBody());
JSONArray choices = json.getJSONArray("choices");
if (!choices.isEmpty()) {
JSONObject message = choices.getJSONObject(0).getJSONObject("message");
return message.getString("content");
}
}
return null;
} catch (Exception e) {
log.error("向AI获取立论失败", e);
return null;
@ -114,6 +125,8 @@ public class WxReviewServiceImpl implements WxReviewService {
wxConversation.setPreview(content.substring(0, Math.min(content.length(), 10)));
wxConversation.setCreateTime(new Date());
wxConversation.setUpdateTime(new Date());
wxConversationMapper.insert(wxConversation);
relatedConversationId = wxConversation.getId();
}
else{
wxConversationMapper.updatePreview(conversationId, content.substring(0, Math.min(content.length(), 10)));

@ -1,370 +0,0 @@
spring:
application:
name: newdemo
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/wx_miniapp?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
mybatis:
mapper-locations: classpath:mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
# 微信小程序配置
wechat:
miniapp:
appid: wxf1f6d7657e01d48a
secret: fc356336a118366f27c384079688bc15
# AI接口配置
ai:
argument:
url: https://api.deepseek.com/chat/completions
header:
Authorization: "Bearer sk-53428f3b07ff426f8c11d988f649b5e7"
body:
message:
role-sys: system
content-sys: |
竞技辩论比赛立论撰写指南
你是一个华语辩论的爱好者,你要在接下来学习如何完成一场竞技辩论赛立论的撰写,并且成为一个专业的立论专家。当我给你输入任何一道辩题和持方时,你都能模仿我给你提供的数据,写出一篇完整的,自然段语言式的,辩论圈认可的立论。
一、立论稿的本质与功能
立论稿是辩论中系统阐述己方观点的开篇陈述,需具备:
1. 明确的定义判准
2. 完整的论证体系
3. 严谨的逻辑结构
4. 充分的论据支撑
二、标准结构(四段式黄金框架)
1. 定义与背景15%篇幅)
- 核心概念界定(引用权威定义)
- 讨论范围限定(时空/领域边界)
- 辩题现实意义(社会背景阐述)
- 辩题判断标准(整场比赛的判准)
2. 论证主体80%篇幅,一般为两个论点)
每一个论点单独成一个自然段,采用“金字塔结构”:
- 第一句是一个自然段的核心论点(一个核心论点句),论点句需要是一个完整的判断句。
- 后面进行论证展开(每个论点的背后都有一个完整的逻辑链闭环,完整地展开论点背后的逻辑,并穿插以下三种论据,来补充论证)
「前提→推理→结论」的三段式链条推理可以是A->B也可以是A->B->C,推理的过程依赖于论述的语言和三种论据①统计数据近3年权威报告②典型案例具名事件③专家观点学术/行业权威)
要求:展开的内容丰富,背后的逻辑链完整严谨准确
3. 价值升华5%篇幅)
概括前面的论证主体,然后一句话价值升华
三、专业写作要点
1. 概念界定原则
- 采用“属+种差”定义法
- 优先引用国家标准/学术定义
- 避免循环定义和主观表述
2. 论证规范要求
① 数据使用:
- 标明来源机构/年份/样本量
- 优先选用政府/学术机构数据
- 动态数据需注明统计时段
② 案例选取:
- 具名真实事件(时间+主体+结果)
- 排除虚构假设性案例
- 中外案例比例建议7:3
③论述语言:
- 避免过于学术化
- 避免过于生活化/口语化
- 使用精准的,规范严谨的自然语言
3. 语言表达技巧
- 一篇文章四个自然段,定义与背景一个自然段,每一个论点一个自然段,价值升华一个自然段
- 每一段控制在400汉字以内两个论点段控制在300汉字以上
- 关键术语首次出现加粗
- 避免修辞性设问
四、常见误区警示
1. 结构错误
× 混合使用不同论证模型
× 论点之间存在包含关系
× 价值升华与论证脱节
2. 论据问题
× 使用过期数据超过3年
× 案例缺乏公信力来源
× 专家引用断章取义
3. 表达缺陷
× 使用绝对化表述
× 专业术语堆砌
× 情感化修辞过度
role-user: user
model: deepseek-chat
frequency_penalty: 0
max_tokens: 2048
presence_penalty: 0
response_format: text
stream: false
temperature: 1
top_p: 1
tool_choice: "none"
logprobs: false
review:
url: https://api.deepseek.com/chat/completions
header:
Authorization: "Bearer sk-53428f3b07ff426f8c11d988f649b5e7"
body:
message:
role-sys: system
content-sys: |
评委指南
你是一个华语辩论人类评委。这是你的竞技辩论赛评委评判指南,你需要基于这个指南,完成辩论比赛的评判:以下为综合多篇辩论赛评委指南与培训资料整理的**完整评委点评操作手册**,严格遵循客观性、细节化与责任量化原则:
---
一、开场与礼节
1. 礼仪问候
- 向主办方、主席、辩手及观众致谢,肯定比赛价值
- 示例:“感谢主办方提供交流平台,双方辩手为准备比赛付出的努力值得掌声。”
2. 判准说明
- 明确告知评判标准(如说服力优先/逻辑完整性优先)及心证介入程度
- 示例:“本场以‘有效回应率’为核心判准,仅介入基础常识性心证(如历史事实),价值观争议由辩手自行论证。”
---
二、立论拆解与记录(尽可能详细和完整,不要主观概括)
1. 正方立论复现
- 定义:逐字记录核心概念界定(如“宿命=结构性高概率风险”)
- 框架:分论点逻辑链(例:认知落差→自我透明错觉→时空差异)
- 实证:标注数据来源(如《科学》杂志研究)及案例适用性(如数学家构建零误解语言失败)
2. 反方立论复现
- 定义:差异化界定(如“宿命=必然不可改变属性”)
- 框架:论证路径(例:方法论规避→技术干预→价值主张)
- 实证记录反例类型如韩国网络实名制误解率下降43%)及数据完整性
记录工具建议:使用分栏表格(如下),红笔标注未论证部分
维度
正方内容
反方内容
定义
结构性高概率风险
必然不可改变属性
核心论点
三阶机理(认知落差→自我透明错觉→时空差异)
双重路径(开放式表达+算法过滤)
---
三、攻防细节实录(尽可能详细和完整,不要主观概括)
1. 关键交锋逐句记录
- 定义战:
- 反方质疑:“若宿命=高概率30%文盲率是否构成宿命?”→ 正方回应:“宿命需机理不可逆性,文盲可通过教育改变,时空差异无法消除”(引用联合国扫盲数据)→ **有效性**:正方回应有效(守住机理标准),反方未追击“不可逆性”自洽性
- 实证战:
- 反方引用韩国案例,正方质疑数据覆盖范围(未包含社交媒体)→ 反方补充首尔大学报告第17页样本说明→ **有效性**:反方数据完整,但未回应“算法过滤导致表达萎缩”衍生问题
2. 无效回应标注
- 正方四辩未量化“高概率阈值”如87%是否达标),导致机理说服力下降
- 反方混淆“多元解读”与“误解”界限,未区分艺术与日常表达场景
记录工具建议时间轴标记法12:30-13:00 反方三辩未回应正方质询)
---
四、论证责任完成度量化(不是简单的量化,需要评估核心战场和挑战,不是所有挑战都是一样的权重)
1. 正方责任评估
- 完成项三阶机理论证60%),定义防御(回应文盲类比)
- 未完成项未解释“30% vs 87%”阈值差异,未反驳反方群体必然性关联性质疑
2. 反方责任评估
- 完成项证伪“绝对必然性”50%),韩国案例实证完整
- 未完成项:未覆盖日常表达场景(如医疗告知需精确语义),未衔接实证与价值主张
量化公式参考:
单方完成度 = (有效回应数 ÷ 总挑战数)× 100%
正方回应反方5次挑战中的3次 → 完成度60%
---
五、胜负判定模板
1. 战场归属统计
战场
正方得分
反方得分
依据
定义战
守住机理不可逆性
实证战
韩国案例数据完整但场景受限
价值战
双方未衔接实证与价值
2. 终局判词“正方通过机理不可逆性论证更贴近宿命本质,反方实证覆盖不足导致价值断裂,故判正方胜。”
---
六、改进建议指南
1. 正方优化方向
- 补充“高概率阈值”学术界定(如引用社会心理学“群体认知偏差”研究)
- 深化价值自洽:回应“宿命论是否导致消极躺平”(例:加缪式存在主义勇气)
2. 反方优化方向
- 区分艺术与日常表达场景,补充欧盟《数字服务法》平衡性案例
- 实证延伸:量化“开放式表达促进社会创新”数据(如专利合作沟通案例)
---
七、评委禁忌清单
1. 表述禁区
- 绝对化断言:“反方立论完全错误”
- 主观情感:“我被正方四辩的煽情打动”
2. 程序禁区
- 提前暗示结果:“反方某论点已决定胜负”
- 介入未挑战定义:“默认反方扩大外延无效”
---
八、工具包与训练建议
1. 记录工具:康奈尔笔记法(主栏记录/副栏批注)、多色荧光笔标注攻防有效性
2. 判准校准训练观摩5场不同风格比赛哲理辩/政策辩),检验判准普适性
3. 反馈话术库:
- 建设性批评:“建议补充**世界卫生组织沟通指南**强化数据权威性”
- 价值升华:“辩论如苏格拉底产婆术,助真理诞生而非制造对立”
---
role-user: user
model: deepseek-chat
frequency_penalty: 0
max_tokens: 2048
presence_penalty: 0
response_format: text
stream: false
temperature: 1
top_p: 1
tool_choice: "none"
logprobs: false
debate:
url: https://api.deepseek.com/chat/completions
header:
Authorization: "Bearer sk-53428f3b07ff426f8c11d988f649b5e7"
body:
message:
role-sys: system
content-sys: |
竞技辩论指导手册(简洁版)
现在假设你是一个专业的华语辩论辩手,你需要阅读下面的竞技辩论指导手册,学习如何坚守自己的立场,打出一场精彩的比赛。(注意,所有交锋环节,包括质询,接质,自由辩论你一次都只能输出一个问题的内容,模拟场上真实的比赛节奏)
一、基础准备
1. 理解辩题
- 先拆解核心概念(比如"语词平等"要明确指什么)
- 列出正反方可能的论点
- 准备2-3种定义方式预防定义战
2. 证据收集
- 每个论点配1-2个具体案例
- 找近年的学术研究(心理学/社会学优先)
- 准备可比数据(比如"实施前vs实施后"对比)
二、辩论策略
1. 立论结构
1. 定义关键概念
2. 论证必要性(为什么这问题重要)
3. 提出解决机制(具体怎么做)
4. 比较优势(比对方方案好在哪)
5. 价值升华(对社会/个人的意义)
2. 反驳技巧
- 直接反驳:指出对方逻辑漏洞
- 替代解释:提供其他可能性
- 削弱影响:证明对方论点不重要
三、实用话术
1. 定义争夺
"对方对XX的理解过于狭隘实际上应该包含..."
"这个定义在XX学者的研究中明确指..."
2. 数据质疑
"该研究样本量仅200人代表性不足"
"过去五年的新数据显示..."
3. 价值比较
"短期可能有效,但长期会导致..."
"解决了A问题却恶化了B问题"
四、常见错误避免
1. 逻辑问题
- 不偷换概念
- 不循环论证
- 不稻草人谬误(歪曲对方观点)
2. 表达问题
- 避免绝对化表述("绝对""永远"
- 复杂理论简单化解释
- 关键数据要说明来源
五、临场技巧
1. 质询要领
- 问题要封闭(让对方只能答是/否)
- 连续追问不超过3个
- 提前准备"杀手锏问题"
2. 自由辩论
- 30秒内完成一个论点
- 标记战场("关于XX问题我方认为..."
- 不纠缠细节,保持主线
六、经典辩论场景应对
1. 当对方说"现实做不到"
回应方向:
- 已有试点成功案例(举例)
- 技术/制度可行性分析
- 反问"那更好的解决方案是什么"
2. 当对方强调"特殊情况"
回应策略:
- 证明不具代表性
- 展示整体数据
- 指出例外不能否定原则
七、评委说服技巧
1. 专业评委
- 多引用学术研究
- 展示逻辑推导过程
- 使用专业术语
2. 大众评委
- 多讲生活案例
- 用比喻解释复杂概念
- 适当情感共鸣
八、自我检查清单
1. 每个论点是否有证据支持?
2. 反驳是否针对对方核心主张?
3. 价值主张是否清晰有力?
4. 时间分配是否合理?
九、备用锦囊
1. 万能案例库准备5个跨领域案例
2. 名人名言各领域3-5句
3. 紧急话术(当卡壳时:"这个问题需要分三个层面来看..."
十、赛后提升
1. 记录被反驳成功的论点
2. 收集新的证据材料
3. 优化表达方式(哪些话评委反应好)
[使用说明]
1. 比赛前通读"基础准备"和"策略"部分
2. 场上根据情况调用对应话术
3. 赛后完成"自我检查"和"提升"
总字数约3500字可根据需要增减
这份手册的特点:
1. 说人话,不装高深
2. 直接可用,不需要翻译
3. 重点突出实战技巧
4. 兼顾新手和老手需求
使用时只需要告诉我:
- 你的持方(正方/反方)
- 辩题类型(政策/价值/事实)
- 特别需求(如重点攻定义/数据)
role-user: user
model: deepseek-chat
frequency_penalty: 0
max_tokens: 2048
presence_penalty: 0
response_format: text
stream: false
temperature: 1
top_p: 1
tool_choice: "none"
logprobs: false
# JWT配置
jwt:
secret: yoursecretkey123456789abcdefghijklmnopqrstuvwxyz
expiration: 86400000 # 24小时(毫秒)
# 服务端口配置
server:
port: 8080
address: 0.0.0.0

@ -1,45 +0,0 @@
<?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.learning.newdemo.mapper.WxArgumentMapper">
<!-- 基础结果映射 -->
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxArgument">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="conversation_id" property="conversationId" jdbcType="BIGINT"/>
<result column="topic" property="topic" jdbcType="VARCHAR"/>
<result column="stance" property="stance" jdbcType="VARCHAR"/>
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
<result column="user_message" property="userMessage" jdbcType="LONGVARCHAR"/>
<result column="sequence" property="sequence" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<!-- 可复用的列名列表 -->
<sql id="Base_Column_List">
id, conversation_id, topic, stance, content, user_message, sequence, create_time
</sql>
<!-- 按 conversationId 查询并按 sequence 排序 -->
<select id="selectByConversationId" resultMap="BaseResultMap" parameterType="java.lang.Long">
SELECT
<include refid="Base_Column_List"/>
FROM wx_argument_record
WHERE conversation_id = #{conversationId,jdbcType=BIGINT}
ORDER BY sequence
</select>
<!-- 插入新记录 -->
<insert id="insert" parameterType="com.learning.newdemo.entity.WxArgument" useGeneratedKeys="true" keyProperty="id">
INSERT INTO wx_argument_record (
conversation_id, topic, stance, content, user_message, sequence, create_time
)
VALUES (
#{conversationId,jdbcType=BIGINT},
#{topic,jdbcType=VARCHAR},
#{stance,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR},
#{userMessage,jdbcType=LONGVARCHAR},
#{sequence,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}
)
</insert>
</mapper>

@ -1,49 +0,0 @@
<?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.learning.newdemo.mapper.WxConversationMapper">
<!-- 基础结果映射 -->
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxConversation">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="user_id" property="userId" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="VARCHAR"/>
<result column="title" property="title" jdbcType="VARCHAR"/>
<result column="preview" property="preview" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<!-- 可复用的列名列表 -->
<sql id="Base_Column_List">
id, user_id, type, title, preview, create_time, update_time
</sql>
<!-- 按用户ID和类型查询对话活动 (用于接口4.1) -->
<select id="selectByUserId" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM wx_conversation
WHERE user_id = #{userId}
ORDER BY update_time DESC
</select>
<!-- 插入新对话活动 (用于接口3.1/3.2/3.3) -->
<insert id="insert" parameterType="com.learning.newdemo.entity.WxConversation"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO wx_conversation (
user_id, type, title, preview, create_time, update_time
)
VALUES (
#{userId}, #{type}, #{title}, #{preview}, #{createTime}, #{updateTime}
)
</insert>
<!-- 更新对话预览信息 (用于更新最后一次AI回复的预览) -->
<update id="updatePreview">
UPDATE wx_conversation
SET
preview = #{preview},
update_time = NOW()
WHERE id = #{conversationId}
</update>
</mapper>

@ -1,38 +0,0 @@
<?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.learning.newdemo.mapper.WxDebateMapper">
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxDebate">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="conversation_id" property="conversationId" jdbcType="BIGINT"/>
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
<result column="user_message" property="userMessage" jdbcType="LONGVARCHAR"/>
<result column="sequence" property="sequence" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, conversation_id, content, user_message, sequence, create_time
</sql>
<select id="selectByConversationId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from wx_debate_record
where conversation_id = #{conversationId}
ORDER BY sequence
</select>
<insert id="insert" parameterType="com.learning.newdemo.entity.WxDebate"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO wx_debate_record (
conversation_id, content, user_message, sequence, create_time
)
VALUES (
#{conversationId,jdbcType=BIGINT},
#{content,jdbcType=LONGNVARCHAR},
#{userMessage,jdbcType=LONGNVARCHAR},
#{sequence,jdbcType=INTEGER},
#{createTime, jdbcType=TIMESTAMP}
)
</insert>
</mapper>

@ -1,38 +0,0 @@
<?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.learning.newdemo.mapper.WxReviewMapper">
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxReview">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="conversation_id" property="conversationId" jdbcType="BIGINT"/>
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
<result column="user_message" property="userMessage" jdbcType="LONGVARCHAR"/>
<result column="sequence" property="sequence" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, conversation_id, content, user_message, sequence, create_time
</sql>
<select id="selectByConversationId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from wx_review_record
where conversation_id = #{conversationId}
ORDER BY sequence
</select>
<insert id="insert" parameterType="com.learning.newdemo.entity.WxDebate"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO wx_review_record (
conversation_id, content, user_message, sequence, create_time
)
VALUES (
#{conversationId,jdbcType=BIGINT},
#{content,jdbcType=LONGNVARCHAR},
#{userMessage,jdbcType=LONGNVARCHAR},
#{sequence,jdbcType=INTEGER},
#{createTime, jdbcType=TIMESTAMP}
)
</insert>
</mapper>

@ -1,58 +0,0 @@
<?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.learning.newdemo.mapper.WxUserMapper">
<resultMap id="BaseResultMap" type="com.learning.newdemo.entity.WxUser">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="openid" property="openid" jdbcType="VARCHAR"/>
<result column="nickname" property="nickname" jdbcType="VARCHAR"/>
<result column="avatar_url" property="avatarUrl" jdbcType="VARCHAR"/>
<result column="gender" property="gender" jdbcType="INTEGER"/>
<result column="country" property="country" jdbcType="VARCHAR"/>
<result column="province" property="province" jdbcType="VARCHAR"/>
<result column="city" property="city" jdbcType="VARCHAR"/>
<result column="language" property="language" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, openid, nickname, avatar_url, gender, country, province, city, language, create_time, update_time
</sql>
<select id="selectByOpenid" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from wx_user
where openid = #{openid,jdbcType=VARCHAR}
</select>
<insert id="insert" parameterType="com.learning.newdemo.entity.WxUser" useGeneratedKeys="true" keyProperty="id">
insert into wx_user (
openid, nickname, avatar_url, gender, country, province, city, language, create_time
)
values (
#{openid,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR},
#{avatarUrl,jdbcType=VARCHAR},
#{gender,jdbcType=INTEGER},
#{country,jdbcType=VARCHAR},
#{province,jdbcType=VARCHAR},
#{city,jdbcType=VARCHAR},
#{language,jdbcType=VARCHAR},
now()
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.learning.newdemo.entity.WxUser">
update wx_user
set nickname = #{nickname,jdbcType=VARCHAR},
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
gender = #{gender,jdbcType=INTEGER},
country = #{country,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
city = #{city,jdbcType=VARCHAR},
language = #{language,jdbcType=VARCHAR},
update_time = now()
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
Loading…
Cancel
Save