serv-初始mapper
This commit is contained in:
85
schoolNewsServ/ai/pom.xml
Normal file
85
schoolNewsServ/ai/pom.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>school-news</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>ai</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>ai</name>
|
||||
<description>智能体模块</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>api-ai</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>common-all</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.xyzh.common.dto.ai.TbAiAgentConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 智能体配置数据访问层
|
||||
* @filename AiAgentConfigMapper.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiAgentConfigMapper extends BaseMapper<TbAiAgentConfig> {
|
||||
|
||||
/**
|
||||
* @description 查询智能体配置列表
|
||||
* @param filter 过滤条件
|
||||
* @return List<TbAiAgentConfig> 智能体配置列表
|
||||
* @author system
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAiAgentConfig> selectAiAgentConfigs(TbAiAgentConfig filter);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.xyzh.common.dto.ai.TbAiConversation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 对话会话数据访问层
|
||||
* @filename AiConversationMapper.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiConversationMapper extends BaseMapper<TbAiConversation> {
|
||||
|
||||
/**
|
||||
* @description 查询对话会话列表
|
||||
* @param filter 过滤条件
|
||||
* @return List<TbAiConversation> 对话会话列表
|
||||
* @author system
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAiConversation> selectAiConversations(TbAiConversation filter);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.xyzh.common.dto.ai.TbAiKnowledge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 知识库数据访问层
|
||||
* @filename AiKnowledgeMapper.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiKnowledgeMapper extends BaseMapper<TbAiKnowledge> {
|
||||
|
||||
/**
|
||||
* @description 查询知识库列表
|
||||
* @param filter 过滤条件
|
||||
* @return List<TbAiKnowledge> 知识库列表
|
||||
* @author system
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAiKnowledge> selectAiKnowledges(TbAiKnowledge filter);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.xyzh.common.dto.ai.TbAiMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 对话消息数据访问层
|
||||
* @filename AiMessageMapper.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiMessageMapper extends BaseMapper<TbAiMessage> {
|
||||
|
||||
/**
|
||||
* @description 查询对话消息列表
|
||||
* @param filter 过滤条件
|
||||
* @return List<TbAiMessage> 对话消息列表
|
||||
* @author system
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAiMessage> selectAiMessages(TbAiMessage filter);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.xyzh.common.dto.ai.TbAiUploadFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 上传文件数据访问层
|
||||
* @filename AiUploadFileMapper.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiUploadFileMapper extends BaseMapper<TbAiUploadFile> {
|
||||
|
||||
/**
|
||||
* @description 查询上传文件列表
|
||||
* @param filter 过滤条件
|
||||
* @return List<TbAiUploadFile> 上传文件列表
|
||||
* @author system
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAiUploadFile> selectAiUploadFiles(TbAiUploadFile filter);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.ai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.xyzh.common.dto.ai.TbAiUsageStatistics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description AI使用统计数据访问层
|
||||
* @filename AiUsageStatisticsMapper.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiUsageStatisticsMapper extends BaseMapper<TbAiUsageStatistics> {
|
||||
|
||||
/**
|
||||
* @description 查询AI使用统计列表
|
||||
* @param filter 过滤条件
|
||||
* @return List<TbAiUsageStatistics> AI使用统计列表
|
||||
* @author system
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAiUsageStatistics> selectAiUsageStatistics(TbAiUsageStatistics filter);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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="org.xyzh.ai.mapper.AiAgentConfigMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiAgentConfig">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="name" property="name" jdbcType="VARCHAR"/>
|
||||
<result column="avatar" property="avatar" jdbcType="VARCHAR"/>
|
||||
<result column="system_prompt" property="systemPrompt" jdbcType="LONGVARCHAR"/>
|
||||
<result column="model_name" property="modelName" jdbcType="VARCHAR"/>
|
||||
<result column="model_provider" property="modelProvider" jdbcType="VARCHAR"/>
|
||||
<result column="temperature" property="temperature" jdbcType="DECIMAL"/>
|
||||
<result column="max_tokens" property="maxTokens" jdbcType="INTEGER"/>
|
||||
<result column="top_p" property="topP" jdbcType="DECIMAL"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="deleted" property="deleted" jdbcType="BOOLEAN"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, name, avatar, system_prompt, model_name, model_provider, temperature,
|
||||
max_tokens, top_p, status, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="name != null and name != ''">
|
||||
AND name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="modelName != null and modelName != ''">
|
||||
AND model_name = #{modelName}
|
||||
</if>
|
||||
<if test="modelProvider != null and modelProvider != ''">
|
||||
AND model_provider = #{modelProvider}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAiAgentConfigs -->
|
||||
<select id="selectAiAgentConfigs" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_ai_agent_config
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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="org.xyzh.ai.mapper.AiConversationMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiConversation">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="title" property="title" jdbcType="VARCHAR"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
|
||||
<result column="last_message_time" property="lastMessageTime" jdbcType="TIMESTAMP"/>
|
||||
<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, title, status, message_count, last_message_time,
|
||||
create_time, update_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
AND title LIKE CONCAT('%', #{title}, '%')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAiConversations -->
|
||||
<select id="selectAiConversations" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_ai_conversation
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY last_message_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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="org.xyzh.ai.mapper.AiKnowledgeMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiKnowledge">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="title" property="title" jdbcType="VARCHAR"/>
|
||||
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
|
||||
<result column="source_type" property="sourceType" jdbcType="INTEGER"/>
|
||||
<result column="source_id" property="sourceID" jdbcType="VARCHAR"/>
|
||||
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
|
||||
<result column="file_path" property="filePath" jdbcType="VARCHAR"/>
|
||||
<result column="category" property="category" jdbcType="VARCHAR"/>
|
||||
<result column="tags" property="tags" jdbcType="VARCHAR"/>
|
||||
<result column="vector_id" property="vectorID" jdbcType="VARCHAR"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="deleted" property="deleted" jdbcType="BOOLEAN"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, title, content, source_type, source_id, file_name, file_path,
|
||||
category, tags, vector_id, status, creator, updater, create_time,
|
||||
update_time, delete_time, deleted
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="title != null and title != ''">
|
||||
AND title LIKE CONCAT('%', #{title}, '%')
|
||||
</if>
|
||||
<if test="sourceType != null">
|
||||
AND source_type = #{sourceType}
|
||||
</if>
|
||||
<if test="sourceID != null and sourceID != ''">
|
||||
AND source_id = #{sourceID}
|
||||
</if>
|
||||
<if test="category != null and category != ''">
|
||||
AND category = #{category}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAiKnowledges -->
|
||||
<select id="selectAiKnowledges" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_ai_knowledge
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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="org.xyzh.ai.mapper.AiMessageMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiMessage">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="conversation_id" property="conversationID" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="role" property="role" jdbcType="VARCHAR"/>
|
||||
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
|
||||
<result column="file_ids" property="fileIDs" jdbcType="VARCHAR"/>
|
||||
<result column="knowledge_ids" property="knowledgeIDs" jdbcType="VARCHAR"/>
|
||||
<result column="token_count" property="tokenCount" jdbcType="INTEGER"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, conversation_id, user_id, role, content, file_ids, knowledge_ids,
|
||||
token_count, create_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<where>
|
||||
<if test="conversationID != null and conversationID != ''">
|
||||
AND conversation_id = #{conversationID}
|
||||
</if>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="role != null and role != ''">
|
||||
AND role = #{role}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAiMessages -->
|
||||
<select id="selectAiMessages" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_ai_message
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY create_time ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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="org.xyzh.ai.mapper.AiUploadFileMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiUploadFile">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="conversation_id" property="conversationID" jdbcType="VARCHAR"/>
|
||||
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
|
||||
<result column="file_path" property="filePath" jdbcType="VARCHAR"/>
|
||||
<result column="file_size" property="fileSize" jdbcType="BIGINT"/>
|
||||
<result column="file_type" property="fileType" jdbcType="VARCHAR"/>
|
||||
<result column="mime_type" property="mimeType" jdbcType="VARCHAR"/>
|
||||
<result column="extracted_text" property="extractedText" jdbcType="LONGVARCHAR"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<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, conversation_id, file_name, file_path, file_size,
|
||||
file_type, mime_type, extracted_text, status, create_time, update_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="conversationID != null and conversationID != ''">
|
||||
AND conversation_id = #{conversationID}
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
AND file_name LIKE CONCAT('%', #{fileName}, '%')
|
||||
</if>
|
||||
<if test="fileType != null and fileType != ''">
|
||||
AND file_type = #{fileType}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAiUploadFiles -->
|
||||
<select id="selectAiUploadFiles" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_ai_upload_file
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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="org.xyzh.ai.mapper.AiUsageStatisticsMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiUsageStatistics">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="stat_date" property="statDate" jdbcType="DATE"/>
|
||||
<result column="conversation_count" property="conversationCount" jdbcType="INTEGER"/>
|
||||
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
|
||||
<result column="total_tokens" property="totalTokens" jdbcType="INTEGER"/>
|
||||
<result column="file_count" property="fileCount" jdbcType="INTEGER"/>
|
||||
<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, stat_date, conversation_count, message_count,
|
||||
total_tokens, file_count, create_time, update_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="statDate != null">
|
||||
AND stat_date = #{statDate}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAiUsageStatistics -->
|
||||
<select id="selectAiUsageStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_ai_usage_statistics
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY stat_date DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user