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

mappers.InlongGroupExtEntityMapper.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.InlongGroupExtEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
        <result column="key_name" jdbcType="VARCHAR" property="keyName"/>
        <result column="key_value" jdbcType="VARCHAR" property="keyValue"/>
        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
        <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, inlong_group_id, key_name, key_value, is_deleted, modify_time
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from inlong_group_ext
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="selectByGroupId" resultType="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        select
        <include refid="Base_Column_List"/>
        from inlong_group_ext
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
        and is_deleted = 0
    </select>
    <!-- Query the undeleted extended attributes based on inlongGroupId and keyName -->
    <select id="selectByUniqueKey" resultType="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        select
        <include refid="Base_Column_List"/>
        from inlong_group_ext
        where inlong_group_id = #{inlongGroupId, jdbcType=INTEGER}
        and key_name = #{keyName, jdbcType=VARCHAR}
        and is_deleted = 0
    </select>
    <select id="selectGroupIdByKeyNameAndValue" resultType="java.lang.String">
        select distinct inlong_group_id
        from inlong_group_ext
        where key_name = #{keyName, jdbcType=VARCHAR}
          and key_value = #{keyValue, jdbcType=VARCHAR}
          and is_deleted = 0
    </select>
    <select id="selectByKeyName" resultType="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        select
        <include refid="Base_Column_List"/>
        from inlong_group_ext
        where key_name = #{keyName, jdbcType=VARCHAR}
        and is_deleted = 0
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from inlong_group_ext
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <delete id="deleteAllByGroupId">
        delete
        from inlong_group_ext
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
    </delete>
    <insert id="insert" parameterType="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        insert into inlong_group_ext (id, inlong_group_id, key_name,
                                      key_value, is_deleted, modify_time)
        values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR}, #{keyName,jdbcType=VARCHAR},
                #{keyValue,jdbcType=VARCHAR}, #{isDeleted,jdbcType=INTEGER}, #{modifyTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        insert into inlong_group_ext
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="inlongGroupId != null">
                inlong_group_id,
            </if>
            <if test="keyName != null">
                key_name,
            </if>
            <if test="keyValue != null">
                key_value,
            </if>
            <if test="isDeleted != null">
                is_deleted,
            </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="keyName != null">
                #{keyName,jdbcType=VARCHAR},
            </if>
            <if test="keyValue != null">
                #{keyValue,jdbcType=VARCHAR},
            </if>
            <if test="isDeleted != null">
                #{isDeleted,jdbcType=INTEGER},
            </if>
            <if test="modifyTime != null">
                #{modifyTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <!-- Bulk insert-->
    <insert id="insertAll" parameterType="java.util.List">
        insert into inlong_group_ext
        (id, inlong_group_id, key_name, key_value, is_deleted)
        values
        <foreach collection="extList" separator="," index="index" item="item">
            (#{item.id}, #{item.inlongGroupId}, #{item.keyName}, #{item.keyValue}, #{item.isDeleted})
        </foreach>
    </insert>
    <!-- Bulk insert,update if exists-->
    <insert id="insertOnDuplicateKeyUpdate" parameterType="java.util.List">
        insert into inlong_group_ext
        (id, inlong_group_id, key_name, key_value, is_deleted)
        values
        <foreach collection="extList" separator="," index="index" item="item">
            (#{item.id}, #{item.inlongGroupId}, #{item.keyName}, #{item.keyValue}, #{item.isDeleted})
        </foreach>
        ON DUPLICATE KEY UPDATE
        inlong_group_id = VALUES(inlong_group_id),
        key_name = VALUES(key_name),
        key_value = VALUES(key_value),
        is_deleted = VALUES(is_deleted)
    </insert>
    <update id="updateByPrimaryKey" parameterType="org.apache.inlong.manager.dao.entity.InlongGroupExtEntity">
        update inlong_group_ext
        set inlong_group_id = #{inlongGroupId,jdbcType=VARCHAR},
            key_name        = #{keyName,jdbcType=VARCHAR},
            key_value       = #{keyValue,jdbcType=VARCHAR},
            is_deleted      = #{isDeleted,jdbcType=INTEGER},
            modify_time     = #{modifyTime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="logicDeleteAllByGroupId">
        update inlong_group_ext
        set is_deleted = id
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
          and is_deleted = 0
    </update>

    <delete id="deleteByInlongGroupIds">
        delete
        from inlong_group_ext
        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