All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mappers.StreamSinkFieldEntityMapper.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements. See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership. The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.apache.inlong.manager.dao.mapper.StreamSinkFieldEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
        <result column="sink_id" jdbcType="INTEGER" property="sinkId"/>
        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
        <result column="field_name" jdbcType="VARCHAR" property="fieldName"/>
        <result column="field_type" jdbcType="VARCHAR" property="fieldType"/>
        <result column="field_comment" jdbcType="VARCHAR" property="fieldComment"/>
        <result column="source_field_name" jdbcType="VARCHAR" property="sourceFieldName"/>
        <result column="source_field_type" jdbcType="VARCHAR" property="sourceFieldType"/>
        <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/>
        <result column="is_meta_field" jdbcType="SMALLINT" property="isMetaField"/>
        <result column="meta_field_name" jdbcType="VARCHAR" property="metaFieldName"/>
        <result column="field_format" jdbcType="VARCHAR" property="fieldFormat"/>
        <result column="origin_node_name" jdbcType="VARCHAR" property="originNodeName"/>
        <result column="origin_field_name" jdbcType="VARCHAR" property="originFieldName"/>
        <result column="rank_num" jdbcType="SMALLINT" property="rankNum"/>
        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, sink_id, field_name, field_type, field_comment, source_field_name, source_field_type,
        ext_params, is_meta_field, meta_field_name, field_format, origin_node_name, origin_field_name,
        rank_num, is_deleted
    </sql>

    <insert id="insert" useGeneratedKeys="true" keyProperty="id"
            parameterType="org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity">
        insert into stream_sink_field (id, inlong_group_id,
                                       inlong_stream_id, sink_id,
                                       sink_type, field_name,
                                       field_type, field_comment,
                                       source_field_name, source_field_type,
                                       ext_params, is_meta_field,
                                       meta_field_name, field_format,
                                       origin_node_name, origin_field_name,
                                       rank_num, is_deleted )
        values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR},
                #{inlongStreamId,jdbcType=VARCHAR}, #{sinkId,jdbcType=INTEGER},
                #{sinkType,jdbcType=VARCHAR}, #{fieldName,jdbcType=VARCHAR},
                #{fieldType,jdbcType=VARCHAR}, #{fieldComment,jdbcType=VARCHAR},
                #{sourceFieldName,jdbcType=VARCHAR}, #{sourceFieldType,jdbcType=VARCHAR},
                #{extParams,jdbcType=LONGVARCHAR}, #{isMetaField,jdbcType=SMALLINT},
                #{metaFieldName,jdbcType=VARCHAR}, #{fieldFormat,jdbcType=VARCHAR},
                #{originNodeName,jdbcType=VARCHAR}, #{originFieldName,jdbcType=VARCHAR},
                #{rankNum,jdbcType=SMALLINT}, #{isDeleted,jdbcType=INTEGER})
    </insert>
    <insert id="insertAll">
        insert into stream_sink_field (
        inlong_group_id,
        inlong_stream_id, sink_id,
        sink_type, field_name,
        field_type, field_comment,
        source_field_name, source_field_type,
        ext_params, is_meta_field,
        meta_field_name, field_format,
        origin_node_name, origin_field_name,
        rank_num, is_deleted
        )
        values
        <foreach collection="list" index="index" item="item" separator=",">
            (
            #{item.inlongGroupId,jdbcType=VARCHAR},
            #{item.inlongStreamId,jdbcType=VARCHAR}, #{item.sinkId,jdbcType=INTEGER},
            #{item.sinkType,jdbcType=VARCHAR}, #{item.fieldName,jdbcType=VARCHAR},
            #{item.fieldType,jdbcType=VARCHAR}, #{item.fieldComment,jdbcType=VARCHAR},
            #{item.sourceFieldName,jdbcType=VARCHAR}, #{item.sourceFieldType,jdbcType=VARCHAR},
            #{item.extParams,jdbcType=LONGVARCHAR}, #{item.isMetaField,jdbcType=SMALLINT},
            #{item.metaFieldName,jdbcType=VARCHAR}, #{item.fieldFormat,jdbcType=VARCHAR},
            #{item.originNodeName,jdbcType=VARCHAR}, #{item.originFieldName,jdbcType=VARCHAR},
            #{item.rankNum,jdbcType=SMALLINT}, #{item.isDeleted,jdbcType=INTEGER}
            )
        </foreach>
    </insert>

    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from stream_sink_field
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="selectBySinkId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from stream_sink_field
        where sink_id = #{sinkId, jdbcType=INTEGER}
        and is_deleted = 0
        order by id asc
    </select>
    <select id="selectFields" resultMap="BaseResultMap">
        select field.*
        from stream_sink_field field,
             stream_sink sink
        where sink.inlong_group_id = #{groupId, jdbcType=VARCHAR}
          and sink.inlong_stream_id = #{streamId, jdbcType=VARCHAR}
          and field.sink_id = sink.id
          and field.is_deleted = 0
          and sink.is_deleted = 0
    </select>
    <select id="selectAllFields" resultType="org.apache.inlong.manager.pojo.sort.standalone.SortFieldInfo">
        select
            inlong_group_id,
            inlong_stream_id,
            sink_id,
            field_name
        from stream_sink_field
        where is_deleted = 0
        order by id asc
    </select>
    <update id="logicDeleteAll">
        update stream_sink_field
        set is_deleted = id
        where sink_id = #{sinkId, jdbcType=INTEGER}
          and is_deleted = 0
    </update>

    <delete id="deleteAll">
        delete
        from stream_sink_field
        where sink_id = #{sinkId,jdbcType=INTEGER}
    </delete>
    <delete id="deleteByInlongGroupIds">
        delete
        from stream_sink_field
        where inlong_group_id in
        <foreach item="item" index="index" collection="groupIdList" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </delete>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy