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

mappers.StreamSinkEntityMapper.xml Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show 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.StreamSinkEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        <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_type" jdbcType="VARCHAR" property="sinkType"/>
        <result column="sink_name" jdbcType="VARCHAR" property="sinkName"/>
        <result column="description" jdbcType="INTEGER" property="description"/>
        <result column="enable_create_resource" jdbcType="TINYINT" property="enableCreateResource"/>
        <result column="inlong_cluster_name" jdbcType="VARCHAR" property="inlongClusterName"/>
        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
        <result column="operate_log" jdbcType="VARCHAR" property="operateLog"/>

        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="previous_status" jdbcType="INTEGER" property="previousStatus"/>
        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
        <result column="creator" jdbcType="VARCHAR" property="creator"/>
        <result column="modifier" jdbcType="VARCHAR" property="modifier"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, inlong_group_id, inlong_stream_id, sink_type, sink_name, description, enable_create_resource,
        inlong_cluster_name, data_node_name, sort_task_name, sort_consumer_group, ext_params, operate_log,
        status, previous_status, is_deleted, creator, modifier, create_time, modify_time
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from stream_sink
        where id = #{id,jdbcType=INTEGER}
        and is_deleted = 0
    </select>
    <select id="selectCount" resultType="java.lang.Integer">
        select count(1)
        from stream_sink
        <where>
            is_deleted = 0
            <if test="groupId != null and groupId != ''">
                and inlong_group_id = #{groupId, jdbcType=VARCHAR}
            </if>
            <if test="streamId != null and streamId != ''">
                and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
            </if>
        </where>
    </select>
    <select id="selectByCondition"
            parameterType="org.apache.inlong.manager.common.pojo.sink.SinkPageRequest"
            resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from stream_sink
        <where>
            is_deleted = 0
            <if test="request.sinkType != null and request.sinkType != ''">
                and sink_type = #{request.sinkType, jdbcType=VARCHAR}
            </if>
            and inlong_group_id = #{request.inlongGroupId, jdbcType=VARCHAR}
            <if test="request.inlongStreamId != null and request.inlongStreamId != ''">
                and inlong_stream_id = #{request.inlongStreamId, jdbcType=VARCHAR}
            </if>
            <if test="request.keyword != null and request.keyword != ''">
                and (
                inlong_group_id like CONCAT('%', #{request.keyword}, '%')
                or inlong_stream_id like CONCAT('%', #{request.keyword}, '%')
                or sink_name like CONCAT('%', #{request.keyword}, '%')
                )
            </if>
            <if test="request.status != null and request.status != ''">
                and status = #{request.status, jdbcType=INTEGER}
            </if>
            <if test="request.inlongClusterName != null and request.inlongClusterName != ''">
                and inlong_cluster_name = #{request.inlongClusterName, jdbcType=VARCHAR}
            </if>
            <if test="request.dataNodeName != null and request.dataNodeName != ''">
                and data_node_name = #{request.dataNodeName, jdbcType=VARCHAR}
            </if>
            <if test="request.sortTaskName != null and request.sortTaskName != ''">
                and sort_task_name = #{request.sortTaskName, jdbcType=VARCHAR}
            </if>
            <if test="request.sortConsumerGroup != null and request.sortConsumerGroup != ''">
                and sort_consumer_group = #{request.sortConsumerGroup, jdbcType=VARCHAR}
            </if>
            order by modify_time desc
        </where>
    </select>
    <select id="selectSummary"
            resultType="org.apache.inlong.manager.common.pojo.sink.SinkBriefResponse">
        select s.id,
               s.inlong_group_id,
               s.inlong_stream_id,
               s.sink_type,
               s.sink_name
        from stream_sink s
        where s.is_deleted = 0
          and s.inlong_group_id = #{groupId, jdbcType=VARCHAR}
          and s.inlong_stream_id = #{streamId, jdbcType=VARCHAR}
    </select>
    <select id="selectByRelatedId" resultType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        select
        <include refid="Base_Column_List"/>
        from stream_sink
        <where>
            is_deleted = 0
            and inlong_group_id = #{groupId, jdbcType=VARCHAR}
            <if test="streamId != null and streamId != ''">
                and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
            </if>
            <if test="sinkName != null and sinkName != ''">
                and sink_name = #{sinkName, jdbcType=VARCHAR}
            </if>
        </where>
    </select>
    <select id="selectByIdAndType" resultType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        select
        <include refid="Base_Column_List"/>
        from stream_sink
        <where>
            is_deleted = 0
            and inlong_group_id = #{groupId, jdbcType=VARCHAR}
            <if test="streamId != null and streamId != ''">
                and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
            </if>
            <if test="sinkType != null and sinkType != ''">
                and sink_type = #{sinkType, jdbcType=VARCHAR}
            </if>
        </where>
    </select>
    <select id="selectExistsStreamId" resultType="java.lang.String">
        select inlong_stream_id
        from stream_sink
        <where>
            inlong_group_id = #{groupId, jdbcType=VARCHAR}
            and sink_type = #{sinkType, jdbcType=VARCHAR}
            and is_deleted = 0
            and inlong_stream_id in
            <foreach collection="streamIdList" open="(" close=")" separator="," index="index" item="item">
                #{item}
            </foreach>
        </where>
    </select>
    <select id="selectSinkType" resultType="java.lang.String">
        select distinct (sink_type)
        from stream_sink
        <where>
            is_deleted = 0
            <if test="groupId != null and groupId != ''">
                and inlong_group_id = #{groupId, jdbcType=VARCHAR}
            </if>
            <if test="streamId != null and streamId != ''">
                and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
            </if>
        </where>
    </select>
    <select id="selectAllConfig" resultType="org.apache.inlong.manager.common.pojo.sink.SinkInfo">
        select sink.id,
        sink.inlong_group_id,
        sink.inlong_stream_id,
        sink.sink_type,
        sink.description,
        sink.enable_create_resource,
        sink.ext_params,
        sink.status,
        sink.creator,
        sink.sink_name,
        stream.mq_resource,
        stream.data_type,
        stream.data_separator as sourceSeparator,
        stream.data_escape_char
        from inlong_stream stream, stream_sink sink
        <where>
            stream.is_deleted = 0
            and sink.is_deleted = 0
            and stream.inlong_group_id = sink.inlong_group_id
            and stream.inlong_stream_id = sink.inlong_stream_id
            and stream.inlong_group_id = #{groupId, jdbcType=VARCHAR}
            <if test="idList != null and idList.size() > 0">
                and stream.inlong_stream_id in
                <foreach collection="idList" open="(" close=")" separator="," index="index" item="item">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from stream_sink
        where id = #{id,jdbcType=INTEGER}
    </delete>

    <insert id="insert" useGeneratedKeys="true" keyProperty="id"
            parameterType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        insert into stream_sink (id, inlong_group_id, inlong_stream_id,
                                 sink_type, sink_name, description,
                                 enable_create_resource, inlong_cluster_name,
                                 data_node_name, sort_task_name,
                                 sort_consumer_group, ext_params,
                                 operate_log, status, previous_status,
                                 is_deleted, creator, modifier,
                                 create_time, modify_time)
        values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR}, #{inlongStreamId,jdbcType=VARCHAR},
                #{sinkType,jdbcType=VARCHAR}, #{sinkName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
                #{enableCreateResource,jdbcType=TINYINT}, #{inlongClusterName,jdbcType=VARCHAR},
                #{dataNodeName,jdbcType=VARCHAR}, #{sortTaskName,jdbcType=VARCHAR},
                #{sortConsumerGroup,jdbcType=VARCHAR}, #{extParams,jdbcType=VARCHAR},
                #{operateLog,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{previousStatus,jdbcType=INTEGER},
                #{isDeleted,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR},
                #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"
            parameterType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        insert into stream_sink
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="inlongGroupId != null">
                inlong_group_id,
            </if>
            <if test="inlongStreamId != null">
                inlong_stream_id,
            </if>
            <if test="sinkType != null">
                sink_type,
            </if>
            <if test="sinkName != null">
                sink_name,
            </if>
            <if test="description != null">
                description,
            </if>
            <if test="enableCreateResource != null">
                enable_create_resource,
            </if>
            <if test="inlongClusterName != null">
                inlong_cluster_name,
            </if>
            <if test="dataNodeName != null">
                data_node_name,
            </if>
            <if test="sortTaskName != null">
                sort_task_name,
            </if>
            <if test="sortConsumerGroup != null">
                sort_consumer_group,
            </if>
            <if test="extParams != null">
                ext_params,
            </if>
            <if test="operateLog != null">
                operate_log,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="previousStatus != null">
                previous_status,
            </if>
            <if test="isDeleted != null">
                is_deleted,
            </if>
            <if test="creator != null">
                creator,
            </if>
            <if test="modifier != null">
                modifier,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="modifyTime != null">
                modify_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="inlongGroupId != null">
                #{inlongGroupId,jdbcType=VARCHAR},
            </if>
            <if test="inlongStreamId != null">
                #{inlongStreamId,jdbcType=VARCHAR},
            </if>
            <if test="sinkType != null">
                #{sinkType,jdbcType=VARCHAR},
            </if>
            <if test="sinkName != null">
                #{sinkName,jdbcType=VARCHAR},
            </if>
            <if test="description != null">
                #{description,jdbcType=VARCHAR},
            </if>
            <if test="enableCreateResource != null">
                #{enableCreateResource,jdbcType=TINYINT},
            </if>
            <if test="inlongClusterName != null">
                #{inlongClusterName,jdbcType=VARCHAR},
            </if>
            <if test="dataNodeName != null">
                #{dataNodeName,jdbcType=VARCHAR},
            </if>
            <if test="sortTaskName != null">
                #{sortTaskName,jdbcType=VARCHAR},
            </if>
            <if test="sortConsumerGroup != null">
                #{sortConsumerGroup,jdbcType=VARCHAR},
            </if>
            <if test="extParams != null">
                #{extParams,jdbcType=VARCHAR},
            </if>
            <if test="operateLog != null">
                #{operateLog,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="previousStatus != null">
                #{previousStatus,jdbcType=INTEGER},
            </if>
            <if test="isDeleted != null">
                #{isDeleted,jdbcType=INTEGER},
            </if>
            <if test="creator != null">
                #{creator,jdbcType=VARCHAR},
            </if>
            <if test="modifier != null">
                #{modifier,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="modifyTime != null">
                #{modifyTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective"
            parameterType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        update stream_sink
        <set>
            <if test="inlongGroupId != null">
                inlong_group_id = #{inlongGroupId,jdbcType=VARCHAR},
            </if>
            <if test="inlongStreamId != null">
                inlong_stream_id = #{inlongStreamId,jdbcType=VARCHAR},
            </if>
            <if test="description != null">
                description = #{description,jdbcType=VARCHAR},
            </if>
            <if test="sinkType != null">
                sink_type = #{sinkType,jdbcType=VARCHAR},
            </if>
            <if test="sinkName != null">
                sink_name = #{sinkName,jdbcType=VARCHAR},
            </if>
            <if test="enableCreateResource != null">
                enable_create_resource = #{enableCreateResource,jdbcType=TINYINT},
            </if>
            <if test="inlongClusterName != null">
                inlong_cluster_name = #{inlongClusterName,jdbcType=VARCHAR},
            </if>
            <if test="dataNodeName != null">
                data_node_name = #{dataNodeName,jdbcType=VARCHAR},
            </if>
            <if test="sortTaskName != null">
                sort_task_name = #{sortTaskName,jdbcType=VARCHAR},
            </if>
            <if test="sortConsumerGroup != null">
                sort_consumer_group = #{sortConsumerGroup,jdbcType=VARCHAR},
            </if>
            <if test="extParams != null">
                ext_params = #{extParams,jdbcType=VARCHAR},
            </if>
            <if test="operateLog != null">
                operate_log = #{operateLog,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="previousStatus != null">
                previous_status = #{previousStatus,jdbcType=INTEGER},
            </if>
            <if test="isDeleted != null">
                is_deleted = #{isDeleted,jdbcType=INTEGER},
            </if>
            <if test="creator != null">
                creator = #{creator,jdbcType=VARCHAR},
            </if>
            <if test="modifier != null">
                modifier = #{modifier,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="modifyTime != null">
                modify_time = #{modifyTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        update stream_sink
        set inlong_group_id        = #{inlongGroupId,jdbcType=VARCHAR},
            inlong_stream_id       = #{inlongStreamId,jdbcType=VARCHAR},
            sink_type              = #{sinkType,jdbcType=VARCHAR},
            sink_name              = #{sinkName,jdbcType=VARCHAR},
            description            = #{description,jdbcType=VARCHAR},
            enable_create_resource = #{enableCreateResource,jdbcType=TINYINT},
            inlong_cluster_name    = #{inlongClusterName,jdbcType=VARCHAR},
            data_node_name         = #{dataNodeName,jdbcType=VARCHAR},
            sort_task_name         = #{sortTaskName,jdbcType=VARCHAR},
            sort_consumer_group    = #{sortConsumerGroup,jdbcType=VARCHAR},
            ext_params             = #{extParams,jdbcType=VARCHAR},
            operate_log            = #{operateLog,jdbcType=VARCHAR},
            status                 = #{status,jdbcType=INTEGER},
            previous_status        = #{previousStatus,jdbcType=INTEGER},
            is_deleted             = #{isDeleted,jdbcType=INTEGER},
            creator                = #{creator,jdbcType=VARCHAR},
            modifier               = #{modifier,jdbcType=VARCHAR},
            create_time            = #{createTime,jdbcType=TIMESTAMP},
            modify_time            = #{modifyTime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateStatus" parameterType="org.apache.inlong.manager.dao.entity.StreamSinkEntity">
        update stream_sink
        set status          = #{status,jdbcType=INTEGER},
            previous_status = status,
            operate_log     = #{operateLog,jdbcType=VARCHAR},
            modify_time     = now()
        where id = #{id,jdbcType=INTEGER}
    </update>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy