| <?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="data_report_type" jdbcType="INTEGER" property="dataReportType"/> |
| <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"/> |
| <result column="version" jdbcType="INTEGER" property="version"/> |
| </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, data_report_type, |
| inlong_cluster_tag, ext_params, in_charges, followers, status, previous_status, is_deleted, |
| creator, modifier, create_time, modify_time, version |
| </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, data_report_type, |
| inlong_cluster_tag, ext_params, |
| in_charges, followers, |
| status, previous_status, |
| creator, modifier) |
| 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}, #{dataReportType,jdbcType=INTEGER}, |
| #{inlongClusterTag,jdbcType=VARCHAR}, #{extParams,jdbcType=LONGVARCHAR}, |
| #{inCharges,jdbcType=VARCHAR}, #{followers,jdbcType=VARCHAR}, |
| #{status,jdbcType=INTEGER}, #{previousStatus,jdbcType=INTEGER}, |
| #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}) |
| </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.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> |
| <choose> |
| <when test="orderField != null and orderField != '' and orderType != null and orderType != ''"> |
| order by ${orderField} ${orderType} |
| </when> |
| <otherwise> |
| order by create_time desc |
| </otherwise> |
| </choose> |
| </select> |
| <select id="selectBriefList" parameterType="org.apache.inlong.manager.pojo.group.InlongGroupPageRequest" |
| resultType="org.apache.inlong.manager.pojo.group.InlongGroupBriefInfo"> |
| select id, inlong_group_id, name, mq_type, mq_resource, inlong_cluster_tag, ext_params, |
| in_charges, status, creator, modifier, create_time, 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> |
| </select> |
| <select id="selectByTopicRequest" resultType="org.apache.inlong.manager.dao.entity.InlongGroupEntity"> |
| select |
| <include refid="Base_Column_List"/> |
| from inlong_group |
| <where> |
| is_deleted = 0 |
| <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> |
| </where> |
| </select> |
| <select id="selectByClusterTag" resultType="org.apache.inlong.manager.dao.entity.InlongGroupEntity"> |
| select |
| <include refid="Base_Column_List"/> |
| from inlong_group |
| where is_deleted = 0 |
| and inlong_cluster_tag = #{inlongClusterTag, jdbcType=VARCHAR} |
| limit 10 |
| </select> |
| <select id="selectAllGroups" resultType="org.apache.inlong.manager.pojo.sort.standalone.SortSourceGroupInfo"> |
| select inlong_group_id as groupId, |
| inlong_cluster_tag as clusterTag, |
| mq_resource as mqResource, |
| ext_params as extParams, |
| mq_type as mqType |
| from inlong_group |
| where is_deleted = 0 |
| </select> |
| <select id="selectDeletedGroupIds" resultType="java.lang.String"> |
| select inlong_group_id |
| from inlong_group |
| where modify_time <= #{timeBefore, jdbcType=TIMESTAMP} |
| group by inlong_group_id |
| having min(is_deleted) > 0 |
| limit #{limit, jdbcType=INTEGER} |
| </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}, |
| data_report_type = #{dataReportType,jdbcType=INTEGER}, |
| inlong_cluster_tag = #{inlongClusterTag,jdbcType=VARCHAR}, |
| |
| ext_params = #{extParams,jdbcType=LONGVARCHAR}, |
| in_charges = #{inCharges,jdbcType=VARCHAR}, |
| followers = #{followers,jdbcType=VARCHAR}, |
| previous_status = status, |
| status = #{status,jdbcType=INTEGER}, |
| is_deleted = #{isDeleted,jdbcType=INTEGER}, |
| modifier = #{modifier,jdbcType=VARCHAR}, |
| version = #{version,jdbcType=INTEGER} + 1 |
| where id = #{id,jdbcType=INTEGER} |
| and version = #{version,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="dataReportType != null"> |
| data_report_type = #{dataReportType,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"> |
| previous_status = status, |
| </if> |
| <if test="status != null"> |
| status = #{status,jdbcType=INTEGER}, |
| </if> |
| <if test="isDeleted != null"> |
| is_deleted = #{isDeleted,jdbcType=INTEGER}, |
| </if> |
| <if test="modifier != null"> |
| modifier = #{modifier,jdbcType=VARCHAR}, |
| </if> |
| version = #{version,jdbcType=INTEGER} + 1 |
| </set> |
| where inlong_group_id = #{inlongGroupId, jdbcType=VARCHAR} |
| and is_deleted = 0 |
| and version = #{version, jdbcType=INTEGER} |
| </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> |
| <delete id="deleteByInlongGroupIds"> |
| delete |
| from inlong_group |
| where inlong_group_id in |
| <foreach item="item" index="index" collection="groupIdList" open="(" close=")" separator=","> |
| #{item} |
| </foreach> |
| </delete> |
| </mapper> |