61 lines
3.3 KiB
XML
61 lines
3.3 KiB
XML
|
|
<?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.inspur.llm.chat.gpt.mapper.KnowledgeBaseMapper">
|
||
|
|
|
||
|
|
<!-- 通用查询映射结果 -->
|
||
|
|
<resultMap id="BaseResultMap" type="com.inspur.llm.chat.gpt.pojo.entity.KnowledgeBase" >
|
||
|
|
<result column="id" property="id"/>
|
||
|
|
<result column="create_user" property="createUser"/>
|
||
|
|
<result column="create_time" property="createTime"/>
|
||
|
|
<result column="update_user" property="updateUser"/>
|
||
|
|
<result column="update_time" property="updateTime"/>
|
||
|
|
<result column="name" property="name"/>
|
||
|
|
<result column="icon" property="icon"/>
|
||
|
|
<result column="tag" property="tag"/>
|
||
|
|
<result column="description" property="description"/>
|
||
|
|
<result column="uid" property="uid"/>
|
||
|
|
<result column="sort" property="sort"/>
|
||
|
|
<result column="llm_name" property="llmName"/>
|
||
|
|
<result column="status" property="status"/>
|
||
|
|
<result column="user_id" property="userId"/>
|
||
|
|
<result column="deleted" property="deleted"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 通用查询结果列 -->
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
t.id, t.create_user, t.create_time, t.update_user, t.update_time, t.name, t.icon, t.tag,
|
||
|
|
t.description, t.uid, t.user_id, t.status, t.sort, t.llm_name , t.deleted
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<!-- 通用查询条件 -->
|
||
|
|
<sql id="BaseSelect">
|
||
|
|
select <include refid="Base_Column_List"></include>
|
||
|
|
from gpt_knowledge_base t
|
||
|
|
<where>
|
||
|
|
t.deleted = 0
|
||
|
|
<if test="q.id != null and q.id != ''"> and t.id = #{q.id} </if>
|
||
|
|
<if test="q.name != null and q.title != ''"> and t.name = #{q.name}</if>
|
||
|
|
<if test="q.patentId != null and q.patentId != ''"> and t.patent_id = #{q.patentId}</if>
|
||
|
|
<if test="q.userId != null"> and t.user_id = #{q.userId}</if>
|
||
|
|
<if test="q.llmName != null"> and t.llm_name = #{q.llmName}</if>
|
||
|
|
<if test="q.knowledgeBaseId != null"> and t.knowledge_base_id = #{q.knowledgeBaseId}</if>
|
||
|
|
<if test="q.tag != null and q.tag != ''"> and t.tag = #{q.tag}</if>
|
||
|
|
<if test="q.typeId != null and q.typeId != -1"> and t.type_id = #{q.typeId}</if>
|
||
|
|
<if test="q.mainModel != null"> and t.main_model = #{q.mainModel}</if>
|
||
|
|
<if test="q.sort != null"> and t.sort = #{q.sort}</if>
|
||
|
|
<if test="q.status != null"> and t.status = #{q.status}</if>
|
||
|
|
<if test="q.keyword != null and q.keyword != ''"> and t.name like CONCAT('%', #{q.keyword}, '%') </if>
|
||
|
|
<if test="q.description != null and q.description != ''"> and t.description = #{q.description}</if>
|
||
|
|
<if test="q.startDate != null and q.startDate != ''"> and date_format(t.create_time,'%Y-%m-%d') >= #{q.startDate} </if>
|
||
|
|
<if test="q.endDate != null and q.endDate != ''"> and date_format(t.create_time,'%Y-%m-%d') <= #{q.endDate} </if>
|
||
|
|
<if test="q.dataScope != null and q.dataScope != ''"> ${q.dataScope} </if>
|
||
|
|
</where>
|
||
|
|
order by t.sort desc, t.id desc
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="listKnowledgeBase" resultType="com.inspur.llm.chat.gpt.pojo.vo.KnowledgeBaseVO">
|
||
|
|
<include refid="BaseSelect"></include>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|