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

mappers.InlongStreamFieldEntityMapper.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.InlongStreamFieldEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongStreamFieldEntity">
        <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="is_predefined_field" jdbcType="INTEGER" property="isPredefinedField"/>
        <result column="field_name" jdbcType="VARCHAR" property="fieldName"/>
        <result column="field_value" jdbcType="VARCHAR" property="fieldValue"/>
        <result column="pre_expression" jdbcType="VARCHAR" property="preExpression"/>
        <result column="field_type" jdbcType="VARCHAR" property="fieldType"/>
        <result column="field_comment" jdbcType="VARCHAR" property="fieldComment"/>
        <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="rank_num" jdbcType="INTEGER" property="rankNum"/>
        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, inlong_group_id, inlong_stream_id, is_predefined_field, field_name, field_value, pre_expression,
        field_type, field_comment, is_meta_field, meta_field_name, field_format, rank_num, is_deleted
    </sql>

    <insert id="insert" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamFieldEntity">
        insert into inlong_stream_field (id, inlong_group_id, inlong_stream_id,
                                         is_predefined_field, field_name, field_value,
                                         pre_expression, field_type, field_comment,
                                         is_meta_field, meta_field_name, field_format,
                                         rank_num, is_deleted)
        values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR}, #{inlongStreamId,jdbcType=VARCHAR},
                #{isPredefinedField,jdbcType=INTEGER}, #{fieldName,jdbcType=VARCHAR}, #{fieldValue,jdbcType=VARCHAR},
                #{preExpression,jdbcType=VARCHAR}, #{fieldType,jdbcType=VARCHAR}, #{fieldComment,jdbcType=VARCHAR},
                #{isMetaField,jdbcType=SMALLINT}, #{metaFieldName,jdbcType=VARCHAR}, #{fieldFormat,jdbcType=VARCHAR},
                #{rankNum,jdbcType=SMALLINT}, #{isDeleted,jdbcType=INTEGER})
    </insert>
    <!-- Bulk insert, update if it exists -->
    <insert id="insertAll" parameterType="java.util.List">
        insert into inlong_stream_field (
        id, inlong_group_id, inlong_stream_id, is_predefined_field,
        field_name, field_value, pre_expression, field_type,
        field_comment, is_meta_field, meta_field_name, field_format,
        rank_num, is_deleted
        )
        values
        <foreach collection="fieldList" index="index" item="item" separator=",">
            (
            #{item.id}, #{item.inlongGroupId}, #{item.inlongStreamId}, #{item.isPredefinedField},
            #{item.fieldName}, #{item.fieldValue}, #{item.preExpression}, #{item.fieldType},
            #{item.fieldComment}, #{item.isMetaField}, #{item.metaFieldName}, #{item.fieldFormat},
            #{item.rankNum}, #{item.isDeleted}
            )
        </foreach>
        ON DUPLICATE KEY UPDATE
        id = values(id),
        inlong_group_id = values(inlong_group_id),
        inlong_stream_id = values(inlong_stream_id),
        is_predefined_field = values(is_predefined_field),
        field_name = values(field_name),
        field_value = values(field_value),
        pre_expression = values(pre_expression),
        field_type = values(field_type),
        is_meta_field = values(is_meta_field),
        meta_field_name = values(meta_field_name),
        field_format = values(field_format),
        field_comment = values(field_comment),
        rank_num = values(rank_num),
        is_deleted = values(is_deleted)
    </insert>

    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from inlong_stream_field
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="selectByIdentifier" resultType="org.apache.inlong.manager.dao.entity.InlongStreamFieldEntity">
        select
        <include refid="Base_Column_List"/>
        from inlong_stream_field
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
        <if test="streamId != null and streamId != ''">
            and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
        </if>
        and is_deleted = 0
        order by id asc
    </select>

    <update id="logicDeleteAllByIdentifier">
        update inlong_stream_field
        set is_deleted = id
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
          and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
          and is_deleted = 0
    </update>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from inlong_stream_field
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <delete id="deleteAllByIdentifier">
        delete
        from inlong_stream_field
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
          and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
          and is_deleted = 0
    </delete>
    <delete id="deleteByInlongGroupIds">
        delete
        from inlong_stream_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