You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.1 KiB
46 lines
2.1 KiB
<?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>
|