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

mappers.InlongGroupEntityMapper.xml Maven / Gradle / Ivy

<?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.InlongGroupEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongGroupEntity">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="description" jdbcType="VARCHAR" property="description"/>
        <result column="mq_type" jdbcType="VARCHAR" property="mqType"/>
        <result column="mq_resource" jdbcType="VARCHAR" property="mqResource"/>
        <result column="daily_records" jdbcType="INTEGER" property="dailyRecords"/>
        <result column="daily_storage" jdbcType="INTEGER" property="dailyStorage"/>
        <result column="peak_records" jdbcType="INTEGER" property="peakRecords"/>
        <result column="max_length" jdbcType="INTEGER" property="maxLength"/>
        <result column="enable_zookeeper" jdbcType="INTEGER" property="enableZookeeper"/>
        <result column="enable_create_resource" jdbcType="INTEGER" property="enableCreateResource"/>
        <result column="lightweight" jdbcType="INTEGER" property="lightweight"/>
        <result column="inlong_cluster_tag" jdbcType="VARCHAR" property="inlongClusterTag"/>
        <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/>

        <result column="in_charges" jdbcType="VARCHAR" property="inCharges"/>
        <result column="followers" jdbcType="VARCHAR" property="followers"/>
        <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>

    <resultMap id="statusCountMap" type="java.util.Map">
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="total" property="count" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, inlong_group_id, name, description, mq_type, mq_resource,
        daily_records, daily_storage, peak_records, max_length,
        enable_zookeeper, enable_create_resource, lightweight, inlong_cluster_tag, ext_params,
        in_charges, followers, status, previous_status, is_deleted, creator, modifier, create_time, modify_time
    </sql>

    <insert id="insert" useGeneratedKeys="true" keyProperty="id"
            parameterType="org.apache.inlong.manager.dao.entity.InlongGroupEntity">
        insert into inlong_group (id, inlong_group_id,
                                  name, description,
                                  mq_type, mq_resource,
                                  daily_records, daily_storage,
                                  peak_records, max_length,
                                  enable_zookeeper, enable_create_resource,
                                  lightweight, inlong_cluster_tag,
                                  ext_params, in_charges,
                                  followers, status,
                                  previous_status, is_deleted,
                                  creator, modifier,
                                  create_time, modify_time)
        values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR},
                #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
                #{mqType,jdbcType=VARCHAR}, #{mqResource,jdbcType=VARCHAR},
                #{dailyRecords,jdbcType=INTEGER}, #{dailyStorage,jdbcType=INTEGER},
                #{peakRecords,jdbcType=INTEGER}, #{maxLength,jdbcType=INTEGER},
                #{enableZookeeper,jdbcType=INTEGER}, #{enableCreateResource,jdbcType=INTEGER},
                #{lightweight,jdbcType=INTEGER}, #{inlongClusterTag,jdbcType=VARCHAR},
                #{extParams,jdbcType=LONGVARCHAR}, #{inCharges,jdbcType=VARCHAR},
                #{followers,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
                #{previousStatus,jdbcType=INTEGER}, #{isDeleted,jdbcType=INTEGER},
                #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR},
                #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})
    </insert>

    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from inlong_group
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="countGroupByUser" resultMap="statusCountMap">
        select count(*) as total, status
        from inlong_group
        where is_deleted = 0
          and (creator = #{username,jdbcType=VARCHAR} or find_in_set(#{username,jdbcType=VARCHAR}, in_charges))
        group by status
    </select>
    <select id="selectByGroupId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from inlong_group
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
        and is_deleted = 0
    </select>
    <select id="selectByGroupIdForUpdate" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from inlong_group
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
        and is_deleted = 0 for update
    </select>
    <select id="selectByCondition" resultMap="BaseResultMap"
            parameterType="org.apache.inlong.manager.common.pojo.group.InlongGroupPageRequest">
        select
        <include refid="Base_Column_List"/>
        from inlong_group
        <where>
            is_deleted = 0
            <if test="isAdminRole == false">
                and (
                creator = #{currentUser, jdbcType=VARCHAR} or find_in_set(#{currentUser, jdbcType=VARCHAR}, in_charges)
                )
            </if>
            <if test="keyword != null and keyword != ''">
                and (inlong_group_id like CONCAT('%',#{keyword},'%') or name like CONCAT('%',#{keyword},'%'))
            </if>
            <if test="groupIdList != null and groupIdList.size() > 0">
                and inlong_group_id in
                <foreach collection="groupIdList" item="inlongGroupId" index="index" open="(" close=")" separator=",">
                    #{inlongGroupId}
                </foreach>
            </if>
            <if test="mqType != null and mqType != ''">
                and mq_type = #{mqType, jdbcType=VARCHAR}
            </if>
            <if test="status != null and status != ''">
                and status = #{status, jdbcType=INTEGER}
            </if>
            <if test="statusList != null and statusList.size() > 0">
                and status in
                <foreach collection="statusList" item="status" index="index" open="(" close=")" separator=",">
                    #{status}
                </foreach>
            </if>
            <if test="clusterTagList != null and clusterTagList.size() > 0">
                and inlong_cluster_tag in
                <foreach collection="clusterTagList" item="tag" index="index" open="(" close=")" separator=",">
                    #{tag}
                </foreach>
            </if>
        </where>
        order by modify_time desc
    </select>
    <select id="selectBriefList" parameterType="org.apache.inlong.manager.common.pojo.group.InlongGroupPageRequest"
            resultType="org.apache.inlong.manager.common.pojo.group.InlongGroupBriefInfo">
        select id, inlong_group_id, name, mq_type, mq_resource, inlong_cluster_tag, modify_time
        from inlong_group
        <where>
            is_deleted = 0
            <if test="mqType != null and mqType != ''">
                and mq_type = #{mqType, jdbcType=VARCHAR}
            </if>
            <if test="status != null and status != ''">
                and status = #{status, jdbcType=INTEGER}
            </if>
            <if test="statusList != null and statusList.size() > 0">
                and status in
                <foreach collection="statusList" item="status" index="index" open="(" close=")" separator=",">
                    #{status}
                </foreach>
            </if>
            <if test="clusterTagList != null and clusterTagList.size() > 0">
                and inlong_cluster_tag in
                <foreach collection="clusterTagList" item="tag" index="index" open="(" close=")" separator=",">
                    #{tag}
                </foreach>
            </if>
        </where>
        order by modify_time desc
        limit 100
    </select>

    <update id="updateByPrimaryKey" parameterType="org.apache.inlong.manager.dao.entity.InlongGroupEntity">
        update inlong_group
        set inlong_group_id        = #{inlongGroupId,jdbcType=VARCHAR},
            name                   = #{name,jdbcType=VARCHAR},
            description            = #{description,jdbcType=VARCHAR},
            mq_type                = #{mqType,jdbcType=VARCHAR},
            mq_resource            = #{mqResource,jdbcType=VARCHAR},
            daily_records          = #{dailyRecords,jdbcType=INTEGER},
            daily_storage          = #{dailyStorage,jdbcType=INTEGER},
            peak_records           = #{peakRecords,jdbcType=INTEGER},
            max_length             = #{maxLength,jdbcType=INTEGER},

            enable_zookeeper       = #{enableZookeeper,jdbcType=INTEGER},
            enable_create_resource = #{enableCreateResource,jdbcType=INTEGER},
            lightweight            = #{lightweight,jdbcType=INTEGER},
            inlong_cluster_tag     = #{inlongClusterTag,jdbcType=VARCHAR},

            ext_params             = #{extParams,jdbcType=LONGVARCHAR},
            in_charges             = #{inCharges,jdbcType=VARCHAR},
            followers              = #{followers,jdbcType=VARCHAR},
            status                 = #{status,jdbcType=INTEGER},
            previous_status        = #{previous_status,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="updateByIdentifierSelective" parameterType="org.apache.inlong.manager.dao.entity.InlongGroupEntity">
        update inlong_group
        <set>
            <if test="name != null">
                name = #{name,jdbcType=VARCHAR},
            </if>
            <if test="description != null">
                description = #{description,jdbcType=VARCHAR},
            </if>
            <if test="mqType != null">
                mq_type = #{mqType,jdbcType=VARCHAR},
            </if>
            <if test="mqResource != null">
                mq_resource = #{mqResource,jdbcType=VARCHAR},
            </if>
            <if test="dailyRecords != null">
                daily_records = #{dailyRecords,jdbcType=INTEGER},
            </if>
            <if test="dailyStorage != null">
                daily_storage = #{dailyStorage,jdbcType=INTEGER},
            </if>
            <if test="peakRecords != null">
                peak_records = #{peakRecords,jdbcType=INTEGER},
            </if>
            <if test="maxLength != null">
                max_length = #{maxLength,jdbcType=INTEGER},
            </if>
            <if test="enableZookeeper != null">
                enable_zookeeper = #{enableZookeeper,jdbcType=INTEGER},
            </if>
            <if test="enableCreateResource != null">
                enable_create_resource = #{enableCreateResource,jdbcType=INTEGER},
            </if>
            <if test="lightweight != null">
                lightweight = #{lightweight,jdbcType=INTEGER},
            </if>
            <if test="inlongClusterTag != null">
                inlong_cluster_tag = #{inlongClusterTag,jdbcType=VARCHAR},
            </if>
            <if test="extParams != null">
                ext_params = #{extParams,jdbcType=LONGVARCHAR},
            </if>
            <if test="inCharges != null">
                in_charges = #{inCharges,jdbcType=VARCHAR},
            </if>
            <if test="followers != null">
                followers = #{followers,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>
        </set>
        where inlong_group_id = #{inlongGroupId, jdbcType=VARCHAR}
        and is_deleted = 0
    </update>
    <update id="updateStatus">
        update inlong_group
        set previous_status = status,
            status          = #{status, jdbcType=INTEGER},
            modifier        = #{modifier, jdbcType=VARCHAR}
        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
          and is_deleted = 0
    </update>

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy