Files
supersonic/headless/materialization/src/main/resources/mapper/MaterializationElementDOMapper.xml

291 lines
12 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.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationElementDOMapper">
<resultMap id="BaseResultMap" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDO">
<id column="id" jdbcType="BIGINT" property="id" />
<id column="type" jdbcType="VARCHAR" property="type" />
<id column="materialization_id" jdbcType="BIGINT" property="materializationId" />
<result column="element_type" jdbcType="VARCHAR" property="elementType" />
<result column="default_value" jdbcType="VARCHAR" property="defaultValue" />
<result column="outlier" jdbcType="VARCHAR" property="outlier" />
<result column="frequency" jdbcType="VARCHAR" property="frequency" />
<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="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
<result column="depends" jdbcType="LONGVARCHAR" property="depends" />
<result column="description" jdbcType="LONGVARCHAR" property="description" />
</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="Base_Column_List">
id, type, materialization_id, element_type, default_value, outlier, frequency, created_at,
created_by, updated_at, updated_by, status
</sql>
<sql id="Blob_Column_List">
depends, description
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from s2_materialization_element
<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.headless.materialization.domain.dataobject.MaterializationElementDOExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from s2_materialization_element
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOKey" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from s2_materialization_element
where id = #{id,jdbcType=BIGINT}
and type = #{type,jdbcType=VARCHAR}
and materialization_id = #{materializationId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOKey">
delete from s2_materialization_element
where id = #{id,jdbcType=BIGINT}
and type = #{type,jdbcType=VARCHAR}
and materialization_id = #{materializationId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
insert into s2_materialization_element (id, type, materialization_id,
element_type, default_value, outlier,
frequency, created_at, created_by,
updated_at, updated_by, status,
depends, description)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{materializationId,jdbcType=BIGINT},
#{elementType,jdbcType=VARCHAR}, #{defaultValue,jdbcType=VARCHAR}, #{outlier,jdbcType=VARCHAR},
#{frequency,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{depends,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
insert into s2_materialization_element
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="type != null">
type,
</if>
<if test="materializationId != null">
materialization_id,
</if>
<if test="elementType != null">
element_type,
</if>
<if test="defaultValue != null">
default_value,
</if>
<if test="outlier != null">
outlier,
</if>
<if test="frequency != null">
frequency,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="status != null">
status,
</if>
<if test="depends != null">
depends,
</if>
<if test="description != null">
description,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="materializationId != null">
#{materializationId,jdbcType=BIGINT},
</if>
<if test="elementType != null">
#{elementType,jdbcType=VARCHAR},
</if>
<if test="defaultValue != null">
#{defaultValue,jdbcType=VARCHAR},
</if>
<if test="outlier != null">
#{outlier,jdbcType=VARCHAR},
</if>
<if test="frequency != null">
#{frequency,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="depends != null">
#{depends,jdbcType=LONGVARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample" resultType="java.lang.Long">
select count(*) from s2_materialization_element
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
update s2_materialization_element
<set>
<if test="elementType != null">
element_type = #{elementType,jdbcType=VARCHAR},
</if>
<if test="defaultValue != null">
default_value = #{defaultValue,jdbcType=VARCHAR},
</if>
<if test="outlier != null">
outlier = #{outlier,jdbcType=VARCHAR},
</if>
<if test="frequency != null">
frequency = #{frequency,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="depends != null">
depends = #{depends,jdbcType=LONGVARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
and type = #{type,jdbcType=VARCHAR}
and materialization_id = #{materializationId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
update s2_materialization_element
set element_type = #{elementType,jdbcType=VARCHAR},
default_value = #{defaultValue,jdbcType=VARCHAR},
outlier = #{outlier,jdbcType=VARCHAR},
frequency = #{frequency,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
depends = #{depends,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
and type = #{type,jdbcType=VARCHAR}
and materialization_id = #{materializationId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDO">
update s2_materialization_element
set element_type = #{elementType,jdbcType=VARCHAR},
default_value = #{defaultValue,jdbcType=VARCHAR},
outlier = #{outlier,jdbcType=VARCHAR},
frequency = #{frequency,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
and type = #{type,jdbcType=VARCHAR}
and materialization_id = #{materializationId,jdbcType=BIGINT}
</update>
<update id="cleanMaterializationElement">
delete from s2_materialization_element
where materialization_id = #{materializationId}
</update>
</mapper>