(improvement) Move out the datasource and merge the datasource with the model, and adapt the chat module (#423)

Co-authored-by: jolunoluo <jolunoluo@tencent.com>
This commit is contained in:
jipeli
2023-11-27 11:05:24 +08:00
committed by GitHub
parent 0534053ff9
commit 27bb1b322e
190 changed files with 3900 additions and 10561 deletions

View File

@@ -1,480 +0,0 @@
<?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.semantic.model.infrastructure.mapper.ModelDOMapper">
<resultMap id="BaseResultMap" type="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<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" />
<result column="admin_org" jdbcType="VARCHAR" property="adminOrg" />
<result column="is_open" jdbcType="INTEGER" property="isOpen" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<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" />
</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="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.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, 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
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDOExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from s2_model
<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.semantic.model.domain.dataobject.ModelDOExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from s2_model
<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_model
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from s2_model
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
insert into s2_model (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, entity
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
#{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
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="bizName != null">
biz_name,
</if>
<if test="domainId != null">
domain_id,
</if>
<if test="alias != null">
alias,
</if>
<if test="description != null">
description,
</if>
<if test="viewer != null">
viewer,
</if>
<if test="viewOrg != null">
view_org,
</if>
<if test="admin != null">
admin,
</if>
<if test="adminOrg != null">
admin_org,
</if>
<if test="isOpen != null">
is_open,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="drillDownDimensions != null">
drill_down_dimensions,
</if>
<if test="status != null">
status,
</if>
<if test="entity != null">
entity,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
#{bizName,jdbcType=VARCHAR},
</if>
<if test="domainId != null">
#{domainId,jdbcType=BIGINT},
</if>
<if test="alias != null">
#{alias,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="viewer != null">
#{viewer,jdbcType=VARCHAR},
</if>
<if test="viewOrg != null">
#{viewOrg,jdbcType=VARCHAR},
</if>
<if test="admin != null">
#{admin,jdbcType=VARCHAR},
</if>
<if test="adminOrg != null">
#{adminOrg,jdbcType=VARCHAR},
</if>
<if test="isOpen != null">
#{isOpen,jdbcType=INTEGER},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="drillDownDimensions != null">
#{drillDownDimensions,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="entity != null">
#{entity,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDOExample" resultType="java.lang.Long">
select count(*) from s2_model
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update s2_model
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.bizName != null">
biz_name = #{record.bizName,jdbcType=VARCHAR},
</if>
<if test="record.domainId != null">
domain_id = #{record.domainId,jdbcType=BIGINT},
</if>
<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>
<if test="record.viewOrg != null">
view_org = #{record.viewOrg,jdbcType=VARCHAR},
</if>
<if test="record.admin != null">
admin = #{record.admin,jdbcType=VARCHAR},
</if>
<if test="record.adminOrg != null">
admin_org = #{record.adminOrg,jdbcType=VARCHAR},
</if>
<if test="record.isOpen != null">
is_open = #{record.isOpen,jdbcType=INTEGER},
</if>
<if test="record.createdBy != null">
created_by = #{record.createdBy,jdbcType=VARCHAR},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedBy != null">
updated_by = #{record.updatedBy,jdbcType=VARCHAR},
</if>
<if test="record.updatedAt != null">
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
</if>
<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>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update s2_model
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
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},
admin_org = #{record.adminOrg,jdbcType=VARCHAR},
is_open = #{record.isOpen,jdbcType=INTEGER},
created_by = #{record.createdBy,jdbcType=VARCHAR},
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},
status = #{record.status,jdbcType=INTEGER},
entity = #{record.entity,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update s2_model
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
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},
admin_org = #{record.adminOrg,jdbcType=VARCHAR},
is_open = #{record.isOpen,jdbcType=INTEGER},
created_by = #{record.createdBy,jdbcType=VARCHAR},
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},
status = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
update s2_model
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
biz_name = #{bizName,jdbcType=VARCHAR},
</if>
<if test="domainId != null">
domain_id = #{domainId,jdbcType=BIGINT},
</if>
<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>
<if test="viewOrg != null">
view_org = #{viewOrg,jdbcType=VARCHAR},
</if>
<if test="admin != null">
admin = #{admin,jdbcType=VARCHAR},
</if>
<if test="adminOrg != null">
admin_org = #{adminOrg,jdbcType=VARCHAR},
</if>
<if test="isOpen != null">
is_open = #{isOpen,jdbcType=INTEGER},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<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>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
update s2_model
set name = #{name,jdbcType=VARCHAR},
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},
admin_org = #{adminOrg,jdbcType=VARCHAR},
is_open = #{isOpen,jdbcType=INTEGER},
created_by = #{createdBy,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
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>
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO">
update s2_model
set name = #{name,jdbcType=VARCHAR},
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},
admin_org = #{adminOrg,jdbcType=VARCHAR},
is_open = #{isOpen,jdbcType=INTEGER},
created_by = #{createdBy,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
drill_down_dimensions = #{drillDownDimensions,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -5,7 +5,6 @@
<resultMap id="BaseResultMap" type="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="model_id" jdbcType="BIGINT" property="modelId" />
<result column="datasource_id" jdbcType="BIGINT" property="datasourceId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
<result column="description" jdbcType="VARCHAR" property="description" />
@@ -67,8 +66,7 @@
<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,
datasource_id, created_at, created_by,
type, type_params, expr,created_at, created_by,
updated_by, updated_at, semantic_type,sensitive_level, is_tag)
values
<foreach collection="list" item="dimension" separator=",">
@@ -76,8 +74,7 @@
#{dimension.description,jdbcType=VARCHAR}, #{dimension.status,jdbcType=INTEGER},
#{dimension.modelId,jdbcType=BIGINT},
#{dimension.type,jdbcType=VARCHAR}, #{dimension.typeParams,jdbcType=VARCHAR},
#{dimension.expr,jdbcType=VARCHAR},
#{dimension.datasourceId,jdbcType=BIGINT}, #{dimension.createdAt,jdbcType=TIMESTAMP},
#{dimension.expr,jdbcType=VARCHAR}, #{dimension.createdAt,jdbcType=TIMESTAMP},
#{dimension.createdBy,jdbcType=VARCHAR},
#{dimension.updatedBy,jdbcType=VARCHAR}, #{dimension.updatedAt,jdbcType=TIMESTAMP},
#{dimension.semanticType,jdbcType=VARCHAR},
@@ -161,9 +158,6 @@
<if test="createdBy != null">
and created_by = #{createdBy}
</if>
<if test="datasourceId != null">
and datasource_id = #{datasourceId}
</if>
<if test="isTag != null and isTag == 1">
and is_tag = 1
</if>

View File

@@ -0,0 +1,18 @@
<?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.semantic.model.infrastructure.mapper.ModelDOCustomMapper">
<update id="batchUpdateStatus" parameterType="java.util.List">
<foreach collection="list" item="dimension" separator=";">
update s2_model
set
status = #{model.status,jdbcType=INTEGER},
updated_by = #{model.updatedBy,jdbcType=VARCHAR},
updated_at = #{model.updatedAt,jdbcType=TIMESTAMP}
where id = #{model.id,jdbcType=BIGINT}
</foreach>
</update>
</mapper>