mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-01-06 09:23:02 +08:00
[release][project] supersonic 0.7.3 version backend update (#40)
* [improvement] add some features * [improvement] revise CHANGELOG --------- Co-authored-by: zuopengge <hwzuopengge@tencent.com>
This commit is contained in:
35
chat/core/src/main/resources/mapper/ChatParseMapper.xml
Normal file
35
chat/core/src/main/resources/mapper/ChatParseMapper.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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.tencent.supersonic.chat.persistence.mapper.ChatParseMapper">
|
||||
|
||||
<resultMap id="ChatParse" type="com.tencent.supersonic.chat.persistence.dataobject.ChatParseDO">
|
||||
<id column="question_id" property="questionId"/>
|
||||
<result column="chat_id" property="chatId"/>
|
||||
<result column="parse_id" property="parseId"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="query_text" property="queryText"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="parse_info" property="parseInfo"/>
|
||||
<result column="is_candidate" property="isCandidate"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="batchSaveParseInfo" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatParseDO">
|
||||
insert into s2_chat_parse
|
||||
(question_id, chat_id, parse_id, create_time, query_text, user_name, parse_info,is_candidate)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.questionId}, #{item.chatId}, #{item.parseId}, #{item.createTime}, #{item.queryText}, #{item.userName}, #{item.parseInfo}, #{item.isCandidate})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getParseInfo" resultMap="ChatParse">
|
||||
select *
|
||||
from s2_chat_parse
|
||||
where question_id = #{questionId} and user_name = #{userName}
|
||||
and parse_id = #{parseId} and is_candidate = 0 limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,246 +1,244 @@
|
||||
<?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">
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tencent.supersonic.chat.persistence.mapper.ChatQueryDOMapper">
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
<id column="question_id" jdbcType="BIGINT" property="questionId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName"/>
|
||||
<result column="query_state" jdbcType="INTEGER" property="queryState"/>
|
||||
<result column="chat_id" jdbcType="BIGINT" property="chatId"/>
|
||||
<result column="score" jdbcType="INTEGER" property="score"/>
|
||||
<result column="feedback" jdbcType="VARCHAR" property="feedback"/>
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
|
||||
type="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
<result column="query_text" jdbcType="LONGVARCHAR" property="queryText"/>
|
||||
<result column="query_response" jdbcType="LONGVARCHAR" property="queryResult"/>
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and
|
||||
#{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem"
|
||||
open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
<id column="question_id" jdbcType="BIGINT" property="questionId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="query_state" jdbcType="INTEGER" property="queryState" />
|
||||
<result column="chat_id" jdbcType="BIGINT" property="chatId" />
|
||||
<result column="score" jdbcType="INTEGER" property="score" />
|
||||
<result column="feedback" jdbcType="VARCHAR" property="feedback" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
<result column="query_text" jdbcType="LONGVARCHAR" property="queryText" />
|
||||
<result column="query_result" jdbcType="LONGVARCHAR" property="queryResult" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
question_id
|
||||
, create_time, user_name, query_state, chat_id, score, feedback
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
query_text
|
||||
, query_response
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDOExample"
|
||||
resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</trim>
|
||||
</if>
|
||||
<include refid="Base_Column_List"/>
|
||||
,
|
||||
<include refid="Blob_Column_List"/>
|
||||
from s2_chat_query
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDOExample"
|
||||
resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List"/>
|
||||
from s2_chat_query
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limitStart != null and limitStart>=0">
|
||||
limit #{limitStart} , #{limitEnd}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
,
|
||||
<include refid="Blob_Column_List"/>
|
||||
from s2_chat_query
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete
|
||||
from s2_chat_query
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
insert into s2_chat_query (question_id, create_time, user_name,
|
||||
query_state, chat_id, score,
|
||||
feedback, query_text, query_response)
|
||||
values (#{questionId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
#{queryState,jdbcType=INTEGER}, #{chatId,jdbcType=BIGINT},
|
||||
#{score,jdbcType=INTEGER},
|
||||
#{feedback,jdbcType=VARCHAR}, #{queryText,jdbcType=LONGVARCHAR},
|
||||
#{queryResult,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
insert into s2_chat_query
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="questionId != null">
|
||||
question_id,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
user_name,
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
query_state,
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
chat_id,
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score,
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
feedback,
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
query_text,
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
query_response,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="questionId != null">
|
||||
#{questionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
#{queryState,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
#{chatId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
#{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
#{feedback,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
#{queryText,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
#{queryResult,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDOExample"
|
||||
resultType="java.lang.Long">
|
||||
select count(*) from s2_chat_query
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
update s2_chat_query
|
||||
<set>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
query_state = #{queryState,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
chat_id = #{chatId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
feedback = #{feedback,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
query_text = #{queryText,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
query_response = #{queryResult,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
update s2_chat_query
|
||||
set create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
query_state = #{queryState,jdbcType=INTEGER},
|
||||
chat_id = #{chatId,jdbcType=BIGINT},
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
feedback = #{feedback,jdbcType=VARCHAR},
|
||||
query_text = #{queryText,jdbcType=LONGVARCHAR},
|
||||
query_response = #{queryResult,jdbcType=LONGVARCHAR}
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey"
|
||||
parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
update s2_chat_query
|
||||
set create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
query_state = #{queryState,jdbcType=INTEGER},
|
||||
chat_id = #{chatId,jdbcType=BIGINT},
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
feedback = #{feedback,jdbcType=VARCHAR}
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
question_id, create_time, user_name, query_state, chat_id, score, feedback
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
query_text, query_result
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDOExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from s2_chat_query
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDOExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from s2_chat_query
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limitStart != null and limitStart>=0">
|
||||
limit #{limitStart} , #{limitEnd}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from s2_chat_query
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from s2_chat_query
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
insert into s2_chat_query (question_id, create_time, user_name,
|
||||
query_state, chat_id, score,
|
||||
feedback, query_text, query_result
|
||||
)
|
||||
values (#{questionId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{userName,jdbcType=VARCHAR},
|
||||
#{queryState,jdbcType=INTEGER}, #{chatId,jdbcType=BIGINT}, #{score,jdbcType=INTEGER},
|
||||
#{feedback,jdbcType=VARCHAR}, #{queryText,jdbcType=LONGVARCHAR}, #{queryResult,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
insert into s2_chat_query
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="questionId != null">
|
||||
question_id,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
user_name,
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
query_state,
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
chat_id,
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score,
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
feedback,
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
query_text,
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
query_result,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="questionId != null">
|
||||
#{questionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
#{queryState,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
#{chatId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
#{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
#{feedback,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
#{queryText,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
#{queryResult,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDOExample" resultType="java.lang.Long">
|
||||
select count(*) from s2_chat_query
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
update s2_chat_query
|
||||
<set>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
query_state = #{queryState,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
chat_id = #{chatId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
feedback = #{feedback,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
query_text = #{queryText,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
query_result = #{queryResult,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
update s2_chat_query
|
||||
<set>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryState != null">
|
||||
query_state = #{queryState,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="chatId != null">
|
||||
chat_id = #{chatId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="feedback != null">
|
||||
feedback = #{feedback,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="queryText != null">
|
||||
query_text = #{queryText,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="queryResult != null">
|
||||
query_result = #{queryResult,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
update s2_chat_query
|
||||
set create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
query_state = #{queryState,jdbcType=INTEGER},
|
||||
chat_id = #{chatId,jdbcType=BIGINT},
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
feedback = #{feedback,jdbcType=VARCHAR}
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
35
chat/core/src/main/resources/mapper/StatisticsMapper.xml
Normal file
35
chat/core/src/main/resources/mapper/StatisticsMapper.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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.tencent.supersonic.chat.persistence.mapper.StatisticsMapper">
|
||||
|
||||
<resultMap id="Statistics" type="com.tencent.supersonic.chat.persistence.dataobject.StatisticsDO">
|
||||
<id column="question_id" property="questionId"/>
|
||||
<result column="chat_id" property="chatId"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="query_text" property="queryText"/>
|
||||
<result column="interface_name" property="interfaceName"/>
|
||||
<result column="cost" property="cost"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="batchSaveStatistics" parameterType="com.tencent.supersonic.chat.persistence.dataobject.StatisticsDO">
|
||||
insert into s2_chat_statistics
|
||||
(question_id,chat_id, user_name, query_text, interface_name,cost,type ,create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.questionId}, #{item.chatId}, #{item.userName}, #{item.queryText}, #{item.interfaceName}, #{item.cost}, #{item.type},#{item.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getStatistics" resultMap="Statistics">
|
||||
select *
|
||||
from s2_chat_statistics
|
||||
where question_id = #{questionId} and user_name = #{userName}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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.tencent.supersonic.chat.persistence.mapper.custom.ShowCaseCustomMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
<id column="question_id" jdbcType="BIGINT" property="questionId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="query_state" jdbcType="INTEGER" property="queryState" />
|
||||
<result column="chat_id" jdbcType="BIGINT" property="chatId" />
|
||||
<result column="score" jdbcType="INTEGER" property="score" />
|
||||
<result column="feedback" jdbcType="VARCHAR" property="feedback" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.chat.persistence.dataobject.ChatQueryDO">
|
||||
<result column="query_text" jdbcType="LONGVARCHAR" property="queryText" />
|
||||
<result column="query_result" jdbcType="LONGVARCHAR" property="queryResult" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and
|
||||
#{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem"
|
||||
open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, model_id, name, biz_name, description, type, created_at, created_by, updated_at, updated_by
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
typeParams
|
||||
</sql>
|
||||
|
||||
<select id="queryShowCase" resultMap="ResultMapWithBLOBs">
|
||||
select q1.*
|
||||
from s2_chat_query q1
|
||||
join (
|
||||
select distinct chat_id
|
||||
from s2_chat_query
|
||||
where query_state = 0 and agent_id = ${agentId}
|
||||
order by chat_id desc
|
||||
limit #{start}, #{limit}
|
||||
) q2
|
||||
on q1.chat_id = q2.chat_id
|
||||
where agent_id = ${agentId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user