mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-19 04:44:19 +08:00
first commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
com.tencent.supersonic.knowledge.domain.FileHandler=\
|
||||
com.tencent.supersonic.knowledge.domain.LocalFileHandler
|
||||
53
chat/knowledge/src/main/resources/mapper/DictConfMapper.xml
Normal file
53
chat/knowledge/src/main/resources/mapper/DictConfMapper.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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.knowledge.infrastructure.custom.DictConfMapper">
|
||||
|
||||
<resultMap id="DictConfPO"
|
||||
type="com.tencent.supersonic.knowledge.domain.dataobject.DictConfPO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="domain_id" property="domainId"/>
|
||||
<result column="dim_value_infos" property="dimValueInfos"/>
|
||||
<result column="created_at" property="createdAt"/>
|
||||
<result column="updated_at" property="updatedAt"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="updated_by" property="updatedBy"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="createDictConf">
|
||||
insert into s2_dictionary
|
||||
(`domain_id`, dim_value_infos, created_at, updated_at, created_by, updated_by)
|
||||
values
|
||||
(#{domainId}, #{dimValueInfos}, #{createdAt}, #{updatedAt}, #{createdBy}, #{updatedBy})
|
||||
</insert>
|
||||
|
||||
<insert id="upsertDictInfo">
|
||||
insert into s2_dictionary
|
||||
(`domain_id`, dim_value_infos, created_at, updated_at, created_by, updated_by)
|
||||
values
|
||||
(#{domainId}, #{dimValueInfos}, #{createdAt}, #{updatedAt}, #{createdBy}, #{updatedBy})
|
||||
on duplicate key update
|
||||
dim_value_infos = #{dimValueInfos},
|
||||
updated_at = #{updatedAt},
|
||||
updated_by = #{updatedBy}
|
||||
</insert>
|
||||
|
||||
<update id="editDictConf">
|
||||
update s2_dictionary
|
||||
set dim_value_infos = #{dimValueInfos},
|
||||
updated_at = #{updatedAt},
|
||||
updated_by = #{updatedBy}
|
||||
where domain_id = #{domainId}
|
||||
and status = 0
|
||||
</update>
|
||||
|
||||
<select id="getDictInfoByDomainId" resultMap="DictConfPO">
|
||||
select *
|
||||
from s2_dictionary
|
||||
where domain_id = #{domainId}
|
||||
and status = 0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
71
chat/knowledge/src/main/resources/mapper/DictTaskMapper.xml
Normal file
71
chat/knowledge/src/main/resources/mapper/DictTaskMapper.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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.knowledge.infrastructure.custom.DictTaskMapper">
|
||||
|
||||
<resultMap id="DimValueDictTaskPO"
|
||||
type="com.tencent.supersonic.knowledge.domain.dataobject.DimValueDictTaskPO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="command" property="command"/>
|
||||
<result column="command_md5" property="commandMd5"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="created_at" property="createdAt"/>
|
||||
<result column="progress" property="progress"/>
|
||||
<result column="elapsed_ms" property="elapsedMs"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="createDimValueTask">
|
||||
insert into s2_dictionary_task
|
||||
(`name`, description, command, command_md5, status, created_by, progress, elapsed_ms)
|
||||
values
|
||||
(#{name}, #{description}, #{command}, #{commandMd5}, #{status}, #{createdBy}, #{progress}, #{elapsedMs})
|
||||
</insert>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
update s2_dictionary_task
|
||||
<set>
|
||||
<if test="description != null and description !=''">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="progress != null">
|
||||
progress = #{progress},
|
||||
</if>
|
||||
<if test="elapsedMs != null">
|
||||
elapsed_ms = #{elapsedMs},
|
||||
</if>
|
||||
|
||||
</set>
|
||||
where name = #{name}
|
||||
and status = 0
|
||||
</update>
|
||||
|
||||
<select id="searchDictTaskList" resultMap="DimValueDictTaskPO">
|
||||
select *
|
||||
from s2_dictionary_task
|
||||
<where>
|
||||
<if test="id != null and id != ''">
|
||||
and id >= #{id}
|
||||
</if>
|
||||
<if test="name != null and name !=''">
|
||||
and `name` like "%"#{name}"%"
|
||||
</if>
|
||||
<if test="createdBy != null and createdBy !=''">
|
||||
and created_by = #{createdBy}
|
||||
</if>
|
||||
<if test="createdAt != null and createdAt !=''">
|
||||
and created_at >= #{createdAt}
|
||||
</if>
|
||||
<if test="status != null and status !=''">
|
||||
and status= #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
15
chat/knowledge/src/main/resources/sql.ddl/s2_dictionary.sql
Normal file
15
chat/knowledge/src/main/resources/sql.ddl/s2_dictionary.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE IF NOT EXISTS `s2_dictionary` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`item_id` bigint(20) DEFAULT NULL COMMENT '对应维度id、指标id等',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '对应维度、指标等',
|
||||
`black_list` mediumtext COMMENT '字典黑名单',
|
||||
`white_list` mediumtext COMMENT '字典白名单',
|
||||
`rule_list` mediumtext COMMENT '字典规则',
|
||||
`is_dict_Info` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-开启写入字典,0-不开启',
|
||||
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||
`updated_by` varchar(100) DEFAULT NULL COMMENT '更新人',
|
||||
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-删除,0-可用',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT='字典配置信息表'
|
||||
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL COMMENT '任务名称',
|
||||
`description` varchar(255) NOT NULL COMMENT '任务描述',
|
||||
`command` mediumtext NOT NULL COMMENT '任务请求参数',
|
||||
`status` int(10) NOT NULL COMMENT '任务最终运行状态',
|
||||
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT '任务耗时',
|
||||
PRIMARY KEY (`id`)
|
||||
)COMMENT='字典任务信息表'
|
||||
Reference in New Issue
Block a user