Feature/model data embedding for chat and support status for metric and dimension (#311)

* (improvement)(semantic) add offline status for metric and dimension

* (improvement)(chat) add metric recall

---------

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-11-02 18:44:58 +08:00
committed by GitHub
parent f4e3922f47
commit ad20380283
89 changed files with 1572 additions and 896 deletions

View File

@@ -8,14 +8,15 @@
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="database_id" jdbcType="BIGINT" property="databaseId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="depends" jdbcType="VARCHAR" property="depends" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
<result column="datasource_detail" jdbcType="LONGVARCHAR" property="datasourceDetail" />
<result column="depends" jdbcType="LONGVARCHAR" property="depends" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@@ -47,11 +48,11 @@
</where>
</sql>
<sql id="Base_Column_List">
id, model_id, name, biz_name, description, database_id, created_at, created_by, updated_at,
updated_by,depends
id, model_id, name, biz_name, description, database_id, status, created_at, created_by,
updated_at, updated_by
</sql>
<sql id="Blob_Column_List">
datasource_detail
datasource_detail, depends
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDOExample" resultMap="ResultMapWithBLOBs">
select
@@ -98,15 +99,17 @@
delete from s2_datasource
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO" useGeneratedKeys="true" keyProperty="id">
insert into s2_datasource (id, model_id, name,
biz_name, description, database_id,
created_at, created_by, updated_at,
updated_by, datasource_detail)
status, created_at, created_by,
updated_at, updated_by, datasource_detail,
depends)
values (#{id,jdbcType=BIGINT}, #{modelId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{bizName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{databaseId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR}, #{datasourceDetail,jdbcType=LONGVARCHAR})
#{status,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{datasourceDetail,jdbcType=LONGVARCHAR},
#{depends,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
insert into s2_datasource
@@ -129,6 +132,9 @@
<if test="databaseId != null">
database_id,
</if>
<if test="status != null">
status,
</if>
<if test="createdAt != null">
created_at,
</if>
@@ -144,6 +150,9 @@
<if test="datasourceDetail != null">
datasource_detail,
</if>
<if test="depends != null">
depends,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -164,6 +173,9 @@
<if test="databaseId != null">
#{databaseId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
@@ -179,6 +191,9 @@
<if test="datasourceDetail != null">
#{datasourceDetail,jdbcType=LONGVARCHAR},
</if>
<if test="depends != null">
#{depends,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDOExample" resultType="java.lang.Long">
@@ -205,6 +220,9 @@
<if test="databaseId != null">
database_id = #{databaseId,jdbcType=BIGINT},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
@@ -220,6 +238,9 @@
<if test="datasourceDetail != null">
datasource_detail = #{datasourceDetail,jdbcType=LONGVARCHAR},
</if>
<if test="depends != null">
depends = #{depends,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@@ -230,11 +251,13 @@
biz_name = #{bizName,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
database_id = #{databaseId,jdbcType=BIGINT},
status = #{status,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
datasource_detail = #{datasourceDetail,jdbcType=LONGVARCHAR}
datasource_detail = #{datasourceDetail,jdbcType=LONGVARCHAR},
depends = #{depends,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
@@ -244,6 +267,7 @@
biz_name = #{bizName,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
database_id = #{databaseId,jdbcType=BIGINT},
status = #{status,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},

View File

@@ -107,7 +107,7 @@
delete from s2_dimension
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO" useGeneratedKeys="true" keyProperty="id">
insert into s2_dimension (id, model_id, datasource_id,
name, biz_name, description,
status, sensitive_level, type,

View File

@@ -104,7 +104,7 @@
delete from s2_metric
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO">
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO" useGeneratedKeys="true" keyProperty="id">
insert into s2_metric (id, model_id, name,
biz_name, description, status,
sensitive_level, type, created_at,

View File

@@ -7,6 +7,7 @@
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
<result column="domain_id" jdbcType="BIGINT" property="domainId" />
<result column="alias" jdbcType="VARCHAR" property="alias" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="viewer" jdbcType="VARCHAR" property="viewer" />
<result column="view_org" jdbcType="VARCHAR" property="viewOrg" />
<result column="admin" jdbcType="VARCHAR" property="admin" />
@@ -17,6 +18,7 @@
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="drill_down_dimensions" jdbcType="VARCHAR" property="drillDownDimensions" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
<result column="entity" jdbcType="LONGVARCHAR" property="entity" />
@@ -80,8 +82,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, biz_name, domain_id, alias, viewer, view_org, admin, admin_org, is_open,
created_by, created_at, updated_by, updated_at, drill_down_dimensions
id, name, biz_name, domain_id, alias, description, viewer, view_org, admin, admin_org,
is_open, created_by, created_at, updated_by, updated_at, drill_down_dimensions, status
</sql>
<sql id="Blob_Column_List">
entity
@@ -133,17 +135,19 @@
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
insert into s2_model (id, name, biz_name,
domain_id, alias, viewer,
view_org, admin, admin_org,
is_open, created_by, created_at,
updated_by, updated_at, drill_down_dimensions,
entity)
domain_id, alias, description,
viewer, view_org, admin,
admin_org, is_open, created_by,
created_at, updated_by, updated_at,
drill_down_dimensions, status, entity
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
#{domainId,jdbcType=BIGINT}, #{alias,jdbcType=VARCHAR}, #{viewer,jdbcType=VARCHAR},
#{viewOrg,jdbcType=VARCHAR}, #{admin,jdbcType=VARCHAR}, #{adminOrg,jdbcType=VARCHAR},
#{isOpen,jdbcType=INTEGER}, #{createdBy,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, #{drillDownDimensions,jdbcType=VARCHAR},
#{entity,jdbcType=LONGVARCHAR})
#{domainId,jdbcType=BIGINT}, #{alias,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{viewer,jdbcType=VARCHAR}, #{viewOrg,jdbcType=VARCHAR}, #{admin,jdbcType=VARCHAR},
#{adminOrg,jdbcType=VARCHAR}, #{isOpen,jdbcType=INTEGER}, #{createdBy,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP},
#{drillDownDimensions,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{entity,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
insert into s2_model
@@ -163,6 +167,9 @@
<if test="alias != null">
alias,
</if>
<if test="description != null">
description,
</if>
<if test="viewer != null">
viewer,
</if>
@@ -193,6 +200,9 @@
<if test="drillDownDimensions != null">
drill_down_dimensions,
</if>
<if test="status != null">
status,
</if>
<if test="entity != null">
entity,
</if>
@@ -213,6 +223,9 @@
<if test="alias != null">
#{alias,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="viewer != null">
#{viewer,jdbcType=VARCHAR},
</if>
@@ -243,6 +256,9 @@
<if test="drillDownDimensions != null">
#{drillDownDimensions,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="entity != null">
#{entity,jdbcType=LONGVARCHAR},
</if>
@@ -272,6 +288,9 @@
<if test="record.alias != null">
alias = #{record.alias,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.viewer != null">
viewer = #{record.viewer,jdbcType=VARCHAR},
</if>
@@ -302,6 +321,9 @@
<if test="record.drillDownDimensions != null">
drill_down_dimensions = #{record.drillDownDimensions,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.entity != null">
entity = #{record.entity,jdbcType=LONGVARCHAR},
</if>
@@ -317,6 +339,7 @@
biz_name = #{record.bizName,jdbcType=VARCHAR},
domain_id = #{record.domainId,jdbcType=BIGINT},
alias = #{record.alias,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
viewer = #{record.viewer,jdbcType=VARCHAR},
view_org = #{record.viewOrg,jdbcType=VARCHAR},
admin = #{record.admin,jdbcType=VARCHAR},
@@ -327,6 +350,7 @@
updated_by = #{record.updatedBy,jdbcType=VARCHAR},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
drill_down_dimensions = #{record.drillDownDimensions,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
entity = #{record.entity,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -339,6 +363,7 @@
biz_name = #{record.bizName,jdbcType=VARCHAR},
domain_id = #{record.domainId,jdbcType=BIGINT},
alias = #{record.alias,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
viewer = #{record.viewer,jdbcType=VARCHAR},
view_org = #{record.viewOrg,jdbcType=VARCHAR},
admin = #{record.admin,jdbcType=VARCHAR},
@@ -348,7 +373,8 @@
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_by = #{record.updatedBy,jdbcType=VARCHAR},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
drill_down_dimensions = #{record.drillDownDimensions,jdbcType=VARCHAR}
drill_down_dimensions = #{record.drillDownDimensions,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -368,6 +394,9 @@
<if test="alias != null">
alias = #{alias,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="viewer != null">
viewer = #{viewer,jdbcType=VARCHAR},
</if>
@@ -398,6 +427,9 @@
<if test="drillDownDimensions != null">
drill_down_dimensions = #{drillDownDimensions,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="entity != null">
entity = #{entity,jdbcType=LONGVARCHAR},
</if>
@@ -410,6 +442,7 @@
biz_name = #{bizName,jdbcType=VARCHAR},
domain_id = #{domainId,jdbcType=BIGINT},
alias = #{alias,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
viewer = #{viewer,jdbcType=VARCHAR},
view_org = #{viewOrg,jdbcType=VARCHAR},
admin = #{admin,jdbcType=VARCHAR},
@@ -420,6 +453,7 @@
updated_by = #{updatedBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
drill_down_dimensions = #{drillDownDimensions,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
entity = #{entity,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
@@ -429,6 +463,7 @@
biz_name = #{bizName,jdbcType=VARCHAR},
domain_id = #{domainId,jdbcType=BIGINT},
alias = #{alias,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
viewer = #{viewer,jdbcType=VARCHAR},
view_org = #{viewOrg,jdbcType=VARCHAR},
admin = #{admin,jdbcType=VARCHAR},
@@ -438,7 +473,8 @@
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
drill_down_dimensions = #{drillDownDimensions,jdbcType=VARCHAR}
drill_down_dimensions = #{drillDownDimensions,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -64,7 +64,7 @@
created_at, created_by, updated_by, updated_at, semantic_type
</sql>
<insert id="batchInsert" parameterType="java.util.List">
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into s2_dimension (name, biz_name,
description, status, model_id,
type, type_params, expr,
@@ -107,10 +107,21 @@
</foreach>
</update>
<update id="batchUpdateStatus" parameterType="java.util.List">
<foreach collection="list" item="dimension" separator=";">
update s2_dimension
set
status = #{dimension.status,jdbcType=INTEGER},
updated_by = #{dimension.updatedBy,jdbcType=VARCHAR},
updated_at = #{dimension.updatedAt,jdbcType=TIMESTAMP}
where id = #{dimension.id,jdbcType=BIGINT}
</foreach>
</update>
<select id="query" resultMap="ResultMapWithBLOBs">
select *
from s2_dimension
where 1=1
where status != 3
<if test="key != null and key != ''">
and ( id like CONCAT('%',#{key , jdbcType=VARCHAR},'%') or
name like CONCAT('%',#{key , jdbcType=VARCHAR},'%') or
@@ -130,6 +141,9 @@
<if test="sensitiveLevel != null">
and sensitive_level = #{sensitiveLevel}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="modelIds != null and modelIds.size >0">
and model_id in
<foreach collection="modelIds" index="index" item="model" open="(" close=")"
@@ -140,6 +154,9 @@
<if test="createdBy != null">
and created_by = #{createdBy}
</if>
<if test="datasourceId != null">
and datasource_id = #{datasourceId}
</if>
</select>

View File

@@ -62,7 +62,7 @@
type_params
</sql>
<insert id="batchInsert" parameterType="java.util.List">
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into s2_metric (model_id, name,
biz_name, description, type,status,sensitive_level,
created_at, created_by, updated_at,
@@ -100,10 +100,20 @@
</foreach>
</update>
<update id="batchUpdateStatus" parameterType="java.util.List">
<foreach collection="list" item="metric" separator=";">
update s2_metric
set status = #{metric.status,jdbcType=INTEGER},
updated_at = #{metric.updatedAt,jdbcType=TIMESTAMP},
updated_by = #{metric.updatedBy,jdbcType=VARCHAR}
where id = #{metric.id,jdbcType=BIGINT}
</foreach>
</update>
<select id="query" resultMap="ResultMapWithBLOBs">
select *
from s2_metric
where 1=1
where status != 3
<if test="type != null and type != ''">
and type = #{type}
</if>
@@ -127,6 +137,9 @@
<if test="sensitiveLevel != null">
and sensitive_level = #{sensitiveLevel}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="modelIds != null and modelIds.size >0">
and model_id in
<foreach collection="modelIds" index="index" item="model" open="(" close=")"
@@ -134,6 +147,13 @@
#{model}
</foreach>
</if>
<if test="ids != null and ids.size >0">
and id in
<foreach collection="ids" index="index" item="id" open="(" close=")"
separator=",">
#{id}
</foreach>
</if>
<if test="createdBy != null">
and created_by = #{createdBy}
</if>